Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for excessive compiler warnings when building with clang-cl #2600

Merged
merged 2 commits into from
May 6, 2021

Conversation

nickhutchinson
Copy link
Contributor

@nickhutchinson nickhutchinson commented May 2, 2021

Updates CMake build to pass /clang:-Wall instead of -Wall when clang-cl is used. clang-cl accepts many arguments supported by either MSVC and Clang, but when they conflict, interprets them as MSVC would. In this instance, -Wall was being mapped to -Weverything and enabling every available warning.

Also adds clang-cl Appveyor build jobs.

Fixes #2448

@terrelln
Copy link
Contributor

terrelln commented May 5, 2021

Thanks for the PR @nickhutchinson! I love the added Appveyor test!

if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang" OR MINGW) #Not only UNIX but also WIN32 for MinGW
#Not only UNIX but also WIN32 for MinGW
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR
(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT MSVC) OR
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If only -Wall is the problem, could you only turn off -Wall for clang-cl. E.g. leave this if as-is and do:

if (NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND MSVC))
    EnableCompilerFlag("-Wall" true true)
endif ()

Copy link
Contributor

@terrelln terrelln left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for making that change! I'll merge once the tests all pass.

@terrelln terrelln merged commit e7e4b74 into facebook:dev May 6, 2021
@nickhutchinson nickhutchinson deleted the clang-cl branch May 6, 2021 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CMake build enables all compiler warnings when building with clang-cl
3 participants