Skip to content

Commit

Permalink
Build with MSVC /W4 (#41044)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #41044

The reference Clang/GCC build has a pretty strict set of warnings enabled. The reference MSVC build has less strict warnings, which can be a problem for MSVC users building at higher warning levels (e.g. React Native for Windows in OSS uses `/W4` as its baseline warning level).

This bumps up the MSVC warning level to `/W4`, since we are nearly clean already.

There are some limitations. E.g. we don't test binary with MSVC (some issues I didn't work out), and only test building statically linked. But but we do have a minimal C benchmark we compile with MSVC.

X-link: facebook/yoga#1432

Test Plan: GitHub Actions running benchmark MSVC build.

Reviewed By: yungsters

Differential Revision: D50398443

Pulled By: NickGerleman

fbshipit-source-id: 6616034d79b1a308b32d5d3387bae70f40b7b5ab
  • Loading branch information
NickGerleman authored and facebook-github-bot committed Oct 19, 2023
1 parent 03594c2 commit 8eb0617
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Expand Up @@ -17,7 +17,7 @@ add_compile_options(
# "Standard C++ exception handling" (C++ stack unwinding including extern c)
/EHsc
# Enable warnings and warnings as errors
/W3
/W4
/WX
# Disable RTTI
$<$<COMPILE_LANGUAGE:CXX>:/GR->
Expand Down
Expand Up @@ -34,7 +34,7 @@ template <
typename Enum,
std::enable_if_t<(ordinalCount<Enum>() > 0), bool> = true>
constexpr uint8_t minimumBitCount() {
return details::log2ceilFn(ordinalCount<Enum>() - 1);
return details::log2ceilFn(static_cast<uint8_t>(ordinalCount<Enum>() - 1));
}

template <typename Enum>
Expand Down

0 comments on commit 8eb0617

Please sign in to comment.