Alternative compile options for clang-cl with MSVC driver
This PR offers an alternative to #995 for Windows builds with LLVM clang-cl and the MSVC driver.
-
/Wallwith the MSVC driver seems very broad, and results in more warnings than-Wall -Wextra -pedanticon Unix/gcc. - In #995 I proposed specific supressions for
/Wallconsidering the warnings generated. - This PR presents an alternative using /W4 with a small set of additional warnings to achieve a similar effect.
Proposed flags:
/W4 -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wmissing-variable-declarations -Wdouble-promotion -Wfloat-conversion -Wundef
Trade offs:
- Pros: Similarly reduces noise and requires less compile options than the previous approach.
- Cons: Some warnings will not trigger, and some like
-Wformatare not reliable without/Wall.
I found this issue. Perhaps this is what you are hitting. https://github.com/llvm/llvm-project/issues/102982
Thanks for the link, it highlights the confusion around the /Wall flag across platforms.
For clang-cl with the MSVC driver, using /W4 with targeted warnings seems simpler and easier to maintain while keeping it closer to the other builds. I will close the other PR.