Skip to content

Commit 908e02d

Browse files
Merge #1328: build: Bump MSVC warning level up to W3
1549db0 build: Level up MSVC warnings (Hennadii Stepanov) Pull request description: Solves one item in #1235. ACKs for top commit: sipa: utACK 1549db0 real-or-random: ACK 1549db0 Tree-SHA512: 769386f734709537291ddee45c7fbee501185d3eebe9daa117d36e13e8504fabd1127857bc661a751fdf63f2eee1e7e9507121bdb020c97eb87b8758cb0879f8
2 parents 20a5da5 + 1549db0 commit 908e02d

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

CMakeLists.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,12 @@ endif()
212212
include(TryAppendCFlags)
213213
if(MSVC)
214214
# Keep the following commands ordered lexicographically.
215-
try_append_c_flags(/W2) # Moderate warning level.
215+
try_append_c_flags(/W3) # Production quality warning level.
216216
try_append_c_flags(/wd4146) # Disable warning C4146 "unary minus operator applied to unsigned type, result still unsigned".
217+
try_append_c_flags(/wd4244) # Disable warning C4244 "'conversion' conversion from 'type1' to 'type2', possible loss of data".
218+
try_append_c_flags(/wd4267) # Disable warning C4267 "'var' : conversion from 'size_t' to 'type', possible loss of data".
219+
# Eliminate deprecation warnings for the older, less secure functions.
220+
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
217221
else()
218222
# Keep the following commands ordered lexicographically.
219223
try_append_c_flags(-pedantic)

configure.ac

+6-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,12 @@ AC_DEFUN([SECP_TRY_APPEND_DEFAULT_CFLAGS], [
121121
# libtool makes the same assumption internally.
122122
# Note that "/opt" and "-opt" are equivalent for MSVC; we use "-opt" because "/opt" looks like a path.
123123
if test x"$GCC" != x"yes" && test x"$build_windows" = x"yes"; then
124-
SECP_TRY_APPEND_CFLAGS([-W2 -wd4146], $1) # Moderate warning level, disable warning C4146 "unary minus operator applied to unsigned type, result still unsigned"
124+
SECP_TRY_APPEND_CFLAGS([-W3], $1) # Production quality warning level.
125+
SECP_TRY_APPEND_CFLAGS([-wd4146], $1) # Disable warning C4146 "unary minus operator applied to unsigned type, result still unsigned".
126+
SECP_TRY_APPEND_CFLAGS([-wd4244], $1) # Disable warning C4244 "'conversion' conversion from 'type1' to 'type2', possible loss of data".
127+
SECP_TRY_APPEND_CFLAGS([-wd4267], $1) # Disable warning C4267 "'var' : conversion from 'size_t' to 'type', possible loss of data".
128+
# Eliminate deprecation warnings for the older, less secure functions.
129+
CPPFLAGS="-D_CRT_SECURE_NO_WARNINGS $CPPFLAGS"
125130
# We pass -ignore:4217 to the MSVC linker to suppress warning 4217 when
126131
# importing variables from a statically linked secp256k1.
127132
# (See the libtool manual, section "Windows DLLs" for background.)

0 commit comments

Comments
 (0)