-
Notifications
You must be signed in to change notification settings - Fork 14.8k
[libc] Fix typo and amend restrict qualifier #152410
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
dlinfo
indlfcn.yaml
is declared with: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.
FWIW I wasn't sure about annotating dlinfo.cpp/dlinfo.h. For example, I looked at how the existing
dlsym
added__restrict
in dlfcn.yaml[0] but omits the qualifiers in its source files[1].[0] https://github.com/llvm/llvm-project/blob/main/libc/include/dlfcn.yaml#L110-L116
[1] https://github.com/llvm/llvm-project/blob/main/libc/src/dlfcn/dlsym.cpp
Double checking to proceed with adding
__restrict
on the stub definition? (I can add it on the other dlfcn stubs as well).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.
Yes please. We should keep the signatures consistent. Thanks,
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.
For standard qualifiers like this, the declaration is authoritative and if the definition doesn't match and the compiler doesn't make that an error then it means it doesn't change the semantics to have it only on the declaration. (The situation is different for certain attributes.)
However, note that there won't be any cross-checking of the public (
extern "C"
) signature and the namespaced internal signature unless you're doing a production build where the definitions are aliases and the compiler will complain about mismatches. So it's important to take care that thesrc/fooheader/barfunc.h
internal declaration precisely matches the public C signature in the generated public function.And, notwithstanding the first paragraph, for comprehensibility and maintenance reasons, it should always be our practice to use the full precise signature in the definition just as it is in the definition (modulo function attributes).
Ergo, this is missing dladdr.{cpp,h} changes to match the generated declaration, and dlinfo.{cpp,h}| were better as they were.
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.
done in d01192e