mirror of
https://github.com/wownero/wownero.git
synced 2026-10-17 07:31:35 +02:00
Fix TryAcquireSRWLockShared being implicitly defined and causing UB
(cherry picked from commit 342c3a0fd42584385c76743bb165ff6a75584c1e)
This commit is contained in:
+7
-3
@@ -806,9 +806,8 @@ else()
|
||||
# mingw doesn't support LTO (multiple definition errors at link time)
|
||||
set(USE_LTO_DEFAULT false)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--stack,10485760")
|
||||
if(NOT BUILD_64)
|
||||
add_definitions(-DWINVER=0x0600 -D_WIN32_WINNT=0x0600)
|
||||
endif()
|
||||
# TryAcquireSRWLock* requires Windows 7 or later.
|
||||
add_definitions(-DWINVER=0x0601 -D_WIN32_WINNT=0x0601)
|
||||
endif()
|
||||
set(C_WARNINGS "-Waggregate-return -Wnested-externs -Wold-style-definition -Wstrict-prototypes")
|
||||
set(CXX_WARNINGS "-Wno-reorder -Wno-missing-field-initializers")
|
||||
@@ -911,6 +910,11 @@ else()
|
||||
add_c_flag_if_supported( -Werror=return-type C_SECURITY_FLAGS)
|
||||
add_cxx_flag_if_supported(-Werror=return-type CXX_SECURITY_FLAGS)
|
||||
|
||||
# A missing WinAPI prototype (e.g. TryAcquireSRWLock*) must fail the build
|
||||
if(MINGW)
|
||||
add_c_flag_if_supported(-Werror=implicit-function-declaration C_SECURITY_FLAGS)
|
||||
endif()
|
||||
|
||||
message(STATUS "Using C security hardening flags: ${C_SECURITY_FLAGS}")
|
||||
message(STATUS "Using C++ security hardening flags: ${CXX_SECURITY_FLAGS}")
|
||||
message(STATUS "Using linker security hardening flags: ${LD_SECURITY_FLAGS}")
|
||||
|
||||
Reference in New Issue
Block a user