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.
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] Add compile tests for each public header #122527
[libc] Add compile tests for each public header #122527
Changes from 4 commits
cc2061a
91da76c
56d789a
76b24bb
1370e51
cfa89f6
36c1dc3
ca8e8cd
57ee7ea
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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
-isystem
rather than-I
or-idirafter
or anything else. AFAICT we use-isystem
for the clang headers (the ones copied fromclang/lib/Headers
) but not for our own. So if I'm right, then using-Wsystem-headers
here 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,-idirafter
is actually the right thing to be using IMHO. But it only really matters to use that instead of-I
if 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=c89
rejects. 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#include
preprocessor 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-headers
is 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..."