-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[libc] Add compile tests for each public header #122527
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 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
cc2061a
[libc] Add compile tests for each public header
frobtech 91da76c
add mising file
frobtech 56d789a
Use HERMETIC_TEST_ONLY, not UNIT_TEST_ONLY
frobtech 76b24bb
Reformat template
frobtech 1370e51
Use a single main declaration.
frobtech cfa89f6
Merge branch 'main' into p/libc-header-tests
frobtech 36c1dc3
Use -Wsystem-headers; fix license typo.
frobtech ca8e8cd
Merge branch 'main' into p/libc-header-tests
frobtech 57ee7ea
Merge remote-tracking branch 'refs/remotes/fork/p/libc-header-tests' …
frobtech 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
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.
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.
Do you need to be setting
-Wsystem-headers?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 we need to, but it shouldn't hurt. I'll try it.
These will only be considered "system headers" by the compiler if they're found in a directory that's put on the path with
-isystemrather than-Ior-idirafteror anything else. AFAICT we use-isystemfor the clang headers (the ones copied fromclang/lib/Headers) but not for our own. So if I'm right, then using-Wsystem-headershere will only make things fail if the clang headers are not warning-clean, not the libc headers. (I personally am a big fan of thorough warning-clean behavior and-Wsystem-headers, but many headers both in OS installs and perhaps clang and libc++ headers are not actually warning clean in my experience, unfortunately.) For the libc headers,-idirafteris actually the right thing to be using IMHO. But it only really matters to use that instead of-Iif you're using toolchain-supplied libc++ headers, which the libc cmake build does not.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 am wrong! I'm not sure yet how we're plumbing things, but we are getting the system header exception for the libc headers. And boy howdy do we need it! To start with, every file uses
//comments that-std=c89rejects. But there are many other issues that look like real bugs. So I think I will indeed turn it on, and the list of fixes needed to get these tests passing is even longer than we thought.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.
From what I can recall, the use of
<>vs""for#includepreprocessor directives changes one of the numbers in the generated line markers. Those control whether the diagnostic is considered from a system header or not. Unless-Wsystem-headersis set, such diagnostics are elided rather than emitted. There's a few other command line flags, a pragma, and specific system directories that can change this, too. I remember setting it once, seeing the additional diagnostics from my system headers, and thinking "ok, well, won't be fixing those any time soon, better leave that warning flag off for now..."