box2d icon indicating copy to clipboard operation
box2d copied to clipboard

Alternative compile options for clang-cl with MSVC driver

Open Hymenium opened this issue 2 months ago • 2 comments

This PR offers an alternative to #995 for Windows builds with LLVM clang-cl and the MSVC driver.

  • /Wall with the MSVC driver seems very broad, and results in more warnings than -Wall -Wextra -pedantic on Unix/gcc.
  • In #995 I proposed specific supressions for /Wall considering 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 -Wformat are not reliable without /Wall.

Hymenium avatar Oct 19 '25 21:10 Hymenium

I found this issue. Perhaps this is what you are hitting. https://github.com/llvm/llvm-project/issues/102982

erincatto avatar Oct 19 '25 22:10 erincatto

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.

Hymenium avatar Oct 19 '25 22:10 Hymenium