Skip to content

Commit 6b7e5b7

Browse files
Merge #1275: build: Fix C4005 "macro redefinition" MSVC warnings in examples
dc0657c build: Fix C4005 "macro redefinition" MSVC warnings in examples (Hennadii Stepanov) Pull request description: This PR: - fixes C4005 "macro redefinition" MSVC warnings in examples - removes warning suppressions in both build systems, Autotools-based and CMake-based ones ACKs for top commit: real-or-random: utACK dc0657c Tree-SHA512: fe3bb8f06b3ff1d51e5e20754a289e0e6b99ddf4c0bd4e6e4786e2558e71e043ab23ff7782a83a902df5db28d18ae65312674c373fdc49f5af252763a22bd0fb
2 parents 1c89536 + dc0657c commit 6b7e5b7

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

configure.ac

-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ AC_DEFUN([SECP_TRY_APPEND_DEFAULT_CFLAGS], [
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
124124
SECP_TRY_APPEND_CFLAGS([-W2 -wd4146], $1) # Moderate warning level, disable warning C4146 "unary minus operator applied to unsigned type, result still unsigned"
125-
SECP_TRY_APPEND_CFLAGS([-external:anglebrackets -external:W0], $1) # Suppress warnings from #include <...> files
126125
# We pass -ignore:4217 to the MSVC linker to suppress warning 4217 when
127126
# importing variables from a statically linked secp256k1.
128127
# (See the libtool manual, section "Windows DLLs" for background.)

examples/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ add_library(example INTERFACE)
22
target_include_directories(example INTERFACE
33
${PROJECT_SOURCE_DIR}/include
44
)
5-
target_compile_options(example INTERFACE
6-
$<$<C_COMPILER_ID:MSVC>:/wd4005>
7-
)
85
target_link_libraries(example INTERFACE
96
secp256k1
107
$<$<PLATFORM_ID:Windows>:bcrypt>

examples/examples_util.h

+6
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@
1717
*/
1818

1919
#if defined(_WIN32)
20+
/*
21+
* The defined WIN32_NO_STATUS macro disables return code definitions in
22+
* windows.h, which avoids "macro redefinition" MSVC warnings in ntstatus.h.
23+
*/
24+
#define WIN32_NO_STATUS
2025
#include <windows.h>
26+
#undef WIN32_NO_STATUS
2127
#include <ntstatus.h>
2228
#include <bcrypt.h>
2329
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)

0 commit comments

Comments
 (0)