This is an archive of the discontinued LLVM Phabricator instance.

[cmake] Replace -Wall with /W4 in clang-cl options now that -Wall aliases -Weverything
ClosedPublic

Authored by gbedwell on Nov 29 2017, 7:14 AM.

Details

Summary

We noticed that our Windows selfhost build was generating *incredibly* verbose warning output (thousands and thousands of -Wc++98-compat warnings for example). I'm pretty sure that this is down to r319116 which aliased clang-cl's -Wall to clang's -Weverything. As we were adding -Wall to clang-cl's options in our own CMake config we ended up getting -Weverything output.

Instead, reuse the code-path for cl.exe that adds /W4 instead, which for clang-cl alises clang's "-Wall -Wextra" which matches what clang-cl's /Wall previously aliased.

This should restore the verbosity of a Windows selfhost build back to its previous levels. I suspect that will fix the bot issues that Galina mentioned.

Diff Detail

Repository
rL LLVM

Event Timeline

gbedwell created this revision.Nov 29 2017, 7:14 AM
gbedwell updated this revision to Diff 124748.Nov 29 2017, 7:33 AM
rnk accepted this revision.Nov 29 2017, 9:49 AM

lgtm

This has the side effect of enabling -Wextra for Windows self-host builds. Are we sure we want to do that?

cmake/modules/HandleLLVMOptions.cmake
547 ↗(On Diff #124748)

I'd say: Don't add -Wall for clang-cl, because it maps -Wall to -Weverything for MSVC compatibility.

This revision is now accepted and ready to land.Nov 29 2017, 9:49 AM
In D40603#939278, @rnk wrote:

lgtm

This has the side effect of enabling -Wextra for Windows self-host builds. Are we sure we want to do that?

Thanks!

I think so. This is where this flag aliasing gets a bit messy! :)
Looking at the recent patch:

 def _SLASH_W4 : CLFlag<"W4">, HelpText<"Enable -Wall and -Wextra">, Alias<WCL4>;
-def _SLASH_Wall : CLFlag<"Wall">, HelpText<"Enable -Wall and -Wextra">, Alias<WCL4>;
+def _SLASH_Wall : CLFlag<"Wall">, HelpText<"Enable -Weverything">,

If the help text is to be believed, clang-cl's /Wall used to map to "-Wall -Wextra" anyway, so if I'm correct this should take us back to the old behaviour.

This revision was automatically updated to reflect the committed changes.