This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] Don't add -Wall when building in MSVC mode
ClosedPublic

Authored by mstorsjo on Mar 5 2021, 4:49 AM.

Details

Summary

The MSVC -Wall (or /Wall) option maps (in clang-cl) to the GCC style
option -Weverything, which we don't really want.

This silences the build with clang-cl, which previously used to
output 100 warnings per translation unit.

Diff Detail

Event Timeline

mstorsjo created this revision.Mar 5 2021, 4:49 AM
mstorsjo requested review of this revision.Mar 5 2021, 4:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 5 2021, 4:49 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
ldionne accepted this revision.Mar 5 2021, 6:22 AM
ldionne added a subscriber: ldionne.

Does libcxxabi need a similar fix? Otherwise LGTM.

This revision is now accepted and ready to land.Mar 5 2021, 6:22 AM
Quuxplusone accepted this revision.Mar 5 2021, 6:35 AM
Quuxplusone added a subscriber: Quuxplusone.
Quuxplusone added inline comments.
libcxx/CMakeLists.txt
584

LGTM too. I'm in the habit of treating -W4 as the MSVC equivalent of -Wall; you might consider trying out -W4 here if you haven't already, just for curiosity's sake.

curdeius added inline comments.
libcxx/CMakeLists.txt
584

It would be nice indeed to use -W4 if possible, and otherwise -W3 (or lower level).
If -W4/-W3 is not ok, maybe you might add a FIXME comment and we will work on it later (when a Windows CI builder is available)?

mstorsjo updated this revision to Diff 328512.Mar 5 2021, 6:55 AM

Added -W4 for MSVC

Does libcxxabi need a similar fix? Otherwise LGTM.

Not sure actually, one doesn't really use libcxxabi in MSVC mode, as one normally would run it on top of the MSVC ABI runtime.

libcxx/CMakeLists.txt
584

-W4 actually works fine, amended the commit to include that.

There's D96408 that tries to silence some warnings in -W4 mode, but when building with CMake, we try to add -Wno-unused-parameter anyway, so the warnings that are fixed there shouldn't show up as long as building with cmake instead of custom project files.

curdeius added inline comments.Mar 5 2021, 7:00 AM
libcxx/CMakeLists.txt
575–583

Nit: better to write if (MSVC) ... else ... (without negation+else).

mstorsjo updated this revision to Diff 328519.Mar 5 2021, 7:11 AM

Avoided the negation+else, simplified the comment wording

This revision was landed with ongoing or failed builds.Mar 5 2021, 1:48 PM
This revision was automatically updated to reflect the committed changes.