Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

underscore attributes to not collide with macros #932

Merged
merged 1 commit into from
May 7, 2024

Conversation

crosdahl
Copy link
Contributor

Attributes without underscores expand improperly when already defined as "language keywords"

#define noinline __attribute__((__noinline__))

// ok
noinline void f() {
        ...
}

// ok
__attribute__((__noinline__)) void g(void) {
        ...
}```

// error
__attribute__((noinline)) void h(void) {
        ...
}```

@Cyan4973
Copy link
Owner

Do you imply some of these attributes were effectively inactive before this patch ?

@Cyan4973 Cyan4973 self-assigned this Apr 15, 2024
@crosdahl
Copy link
Contributor Author

No, the non-underscored attribute names (e.g. noinline), clash with my usage of #define noinline __attribute__((__noinline__)). Alias attribute names with underscores exist so that you can use them even if they have been defined to something else. Currently the code depends on noinline,packed,aligned,noescape,etc not being a macro, forbidding code that uses xxhash to use those identifiers

Copy link
Owner

@Cyan4973 Cyan4973 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@Cyan4973 Cyan4973 merged commit 98684ae into Cyan4973:dev May 7, 2024
63 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants