-
-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
cc-wrapper: use -fwrapv instead of -fno-strict-overflow in clang #243595
Conversation
This doesn't even work as-is because @isClang@ is not always being substituted properly. I'll leave it as-is pending initial feedback. |
083b6c2
to
3ee5fe8
Compare
a645979
to
357b4e2
Compare
I'm marking this as ready for review now because I think it could be committed. On aarch64-darwin, I built |
357b4e2
to
f59e196
Compare
f59e196
to
15d21c4
Compare
LGTM but I don't use clang much so I'm not really qualified to approve this... it affects quite a lot of builds. |
15d21c4
to
acb1823
Compare
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/prs-ready-for-review/3032/2466 |
Description of changes
Please consider this a proof of concept that still needs discussion and testing. I'd appreciate opinions on whether this is the right thing to do. If it is, I'd also like thoughts on how to implement it in a simple, elegant way.Background and Motivation
Reported in #39687, builds on macOS can encounter warnings like :
If we want to suppress this warning (such as in Kitty's build), we can add:
I find these warnings distracting when I debug builds, so I'd like to fix them once and for all (if possible).
Why does Clang emit this warning?
I think it is related to code at https://github.com/llvm/llvm-project/blob/main/clang/lib/Driver/ToolChains/Clang.cpp#L6449:
That is,
-fno-strict-overflow
does nothing more than imply-fwrapv
. When upstream adds-fwrapv
(or even-fno-wrapv
) itself, then-fno-strict-overflow
does nothing, and I suspect it gets reported as unused.What does this PR do?
It simply checks if cc-wrapper is wrapping Clang and uses
-fwrapv
instead of-fno-strict-overflow
if so.However, I don't think the way I've done it is so elegant.Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)