Skip to content

Alternative compile options for clang-cl with MSVC driver#1001

Open
Hymenium wants to merge 1 commit intoerincatto:mainfrom
Hymenium:clang-cl-wall-2
Open

Alternative compile options for clang-cl with MSVC driver#1001
Hymenium wants to merge 1 commit intoerincatto:mainfrom
Hymenium:clang-cl-wall-2

Conversation

@Hymenium
Copy link
Copy Markdown

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 Fix cmake clang cl wall #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 Hymenium mentioned this pull request Oct 19, 2025
@erincatto
Copy link
Copy Markdown
Owner

I found this issue. Perhaps this is what you are hitting. llvm/llvm-project#102982

@Hymenium
Copy link
Copy Markdown
Author

Hymenium commented Oct 19, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants