-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Disable new warnings introduced with clang 18 #99811
Conversation
clang 18 introduces `-Wswitch-default`, which requires that every switch must have a `default` branch. We can add missing `default` in switches, but the other option `-Wcovered-switch-default` complains if all the cases in a switch are exhaustive and `default` doesn't do anything. So disable one of these mutually exclusive warnings. We will also need to merge in the changes from dotnet/arcade#14572 to actually try and use clang-18/clang++-18.
How feasible it is to fix the warning instead of suppressing it? We will soon have CI legs with clang18 (dotnet/dotnet-buildtools-prereqs-docker#976). |
Like I wrote in the commit message, it's an issue because 2 conflicting warnings are now both enabled with clang 18. It's not possible to modify the code to make both warnings go away. See my issue that I reported to clang folks: llvm/llvm-project#85233 We can pick which warning to disable (or turn off |
Ah, I missed that. Good investigation and I agree with your choice. 👍 |
Wouldn't it make more sense to keep that one and add default with unreachable asserts to enum switches? |
I am leaning towards no Suppose we have an enum + a switch that goes over it. Without using That said, I don't own any code in this repo, so I am happy to do what the maintainers tell me they want 😄 |
|
I agree with @omajid here. Let's keep this change as is. |
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.
LGTM, thank you!
This is a targeted backport from a few other PRs that makes it possible to build dotnet/runtme's 8.0 branch on Fedora 40 which includes clang 18. - dotnet/arcade#14572 - dotnet#94782 - dotnet#99811
This is a targeted backport from a few other PRs that makes it possible to build dotnet/runtme's 8.0 branch on Fedora 40 which includes clang 18. - dotnet/arcade#14572 - #94782 - #99811
clang 18 introduces
-Wswitch-default
, which requires that every switch must have adefault
branch. We can add missingdefault
in switches, but the other option-Wcovered-switch-default
complains if all the cases in a switch are exhaustive anddefault
doesn't do anything. So disable one of these mutually exclusive warnings.We will also need to merge in the changes from
dotnet/arcade#14572 to actually try and use clang-18/clang++-18.