Skip to content

Commit 491a740

Browse files
Merge pull request #2016 from niranjan-nilakantan:msvc_warnings
PiperOrigin-RevId: 613474416
2 parents 9d1f7e2 + 4834436 commit 491a740

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

CMakeLists.txt

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,52 @@ if (MSVC)
182182
set(HWY_FLAGS
183183
# fix build error C1128 in blockwise*_test & arithmetic_test
184184
/bigobj
185+
186+
# Warnings
187+
/W4
188+
# Disable some W4 warnings. Enable them individually after they are cleaned up.
189+
/wd4100
190+
/wd4127
191+
/wd4324
192+
/wd4456
193+
/wd4701
194+
/wd4702
195+
/wd4723
196+
197+
# CMake automatically adds exception handling flags. Remove them.
198+
/GR-
199+
/EHs-c-
200+
# Disable exceptions in STL code.
201+
-D_HAS_EXCEPTIONS=0
185202
)
203+
204+
# This adds extra warnings for the clang-cl compiler on Windows.
205+
# This is the same as the sections in the else part.
206+
# These could be refactored.
207+
if (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
208+
list(APPEND HWY_FLAGS
209+
# These are not included in Wall nor Wextra:
210+
-Wconversion
211+
-Wsign-conversion
212+
-Wvla
213+
-Wnon-virtual-dtor
214+
215+
-Wfloat-overflow-conversion
216+
-Wfloat-zero-conversion
217+
-Wfor-loop-analysis
218+
-Wgnu-redeclared-enum
219+
-Winfinite-recursion
220+
-Wself-assign
221+
-Wstring-conversion
222+
-Wtautological-overlap-compare
223+
-Wthread-safety-analysis
224+
-Wundefined-func-template
225+
)
226+
endif()
227+
228+
if (HWY_WARNINGS_ARE_ERRORS)
229+
list(APPEND HWY_FLAGS /WX)
230+
endif()
186231
else()
187232
set(HWY_FLAGS
188233
# Avoid changing binaries based on the current time and date.

0 commit comments

Comments
 (0)