Skip to content

Commit

Permalink
Build with MSVC /W4 (#1432)
Browse files Browse the repository at this point in the history
Summary:
X-link: facebook/react-native#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.

Pull Request resolved: #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 0d28b28 commit f1f869b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmake/project-defaults.cmake
Original file line number Diff line number Diff line change
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
2 changes: 1 addition & 1 deletion yoga/bits/NumericBitfield.h
Original file line number Diff line number Diff line change
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 f1f869b

Please sign in to comment.