-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[libc] Allow each function can have extra attributes by defining LLVM_LIBC_FUNCTION_ATTR_func macro. #116160
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
[libc] Allow each function can have extra attributes by defining LLVM_LIBC_FUNCTION_ATTR_func macro. #116160
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -21,9 +21,24 @@ | |||||
| #define LLVM_LIBC_FUNCTION_ATTR | ||||||
| #endif | ||||||
|
|
||||||
| // Allow each function `func` can have extra attributes specified by defining: | ||||||
| // `LLVM_LIBC_FUNCTION_ATTR_func` macro, which should always start with | ||||||
| // "LLVM_LIBC_EMPTY," | ||||||
| // | ||||||
| // For example: | ||||||
| // #define LLVM_LIBC_FUNCTION_ATTR_memcpy LLVM_LIBC_EMPTY, __attribute__((weak)) | ||||||
|
||||||
| // #define LLVM_LIBC_FUNCTION_ATTR_memcpy LLVM_LIBC_EMPTY, __attribute__((weak)) | |
| // #define LLVM_LIBC_FUNCTION_ATTR_memcpy LLVM_LIBC_EMPTY, [[gnu::weak]] |
Let's encourage the usage of the C++11/C23 style attribute syntax, rather than the GNU C extension syntax.
Though, don't we expect this to be used by the command line cmake invocation? Perhaps an example of that in this comment, or moving our bazel files over to use that would be welcome additions to this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps worth documenting any new command line options in docs/dev/implementation_standard.rst.
lntue marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
lntue marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need EXPAND_ATTR and can just use LLVM_LIBC_ATTR below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're right, EXPAND_ATTR is not needed.
Uh oh!
There was an error while loading. Please reload this page.