https://git.reactos.org/?p=reactos.git;a=commitdiff;h=fc2b105e5d86c49b66570…
commit fc2b105e5d86c49b66570eb481dc9ed8caede5ae
Author: Victor Perevertkin <victor.perevertkin(a)reactos.org>
AuthorDate: Wed Mar 3 04:54:37 2021 +0300
Commit: Victor Perevertkin <victor.perevertkin(a)reactos.org>
CommitDate: Wed Mar 3 06:04:25 2021 +0300
[CMAKE] Use remove_target_compile_option when disabling manually enabled warnings
---
base/applications/wordpad/CMakeLists.txt | 2 +-
base/services/nfsd/CMakeLists.txt | 2 +-
dll/3rdparty/libtirpc/CMakeLists.txt | 4 +++-
dll/win32/comctl32/CMakeLists.txt | 4 ++--
dll/win32/dbghelp/CMakeLists.txt | 5 +++--
.../apitests/compiler/ms/seh/CMakeLists.txt | 22 +++++++++++-----------
modules/rostests/winetests/d3dx9_36/CMakeLists.txt | 2 +-
modules/rostests/winetests/kernel32/CMakeLists.txt | 2 +-
modules/rostests/winetests/user32/CMakeLists.txt | 2 +-
9 files changed, 24 insertions(+), 21 deletions(-)
diff --git a/base/applications/wordpad/CMakeLists.txt
b/base/applications/wordpad/CMakeLists.txt
index 759331f3546..6d007eafa85 100644
--- a/base/applications/wordpad/CMakeLists.txt
+++ b/base/applications/wordpad/CMakeLists.txt
@@ -20,5 +20,5 @@ add_cd_file(TARGET wordpad DESTINATION reactos/system32 FOR all)
if(MSVC)
# Disable warning C4477 (printf format warnings)
- target_compile_options(wordpad PRIVATE /wd4477)
+ remove_target_compile_option(wordpad "/we4477")
endif()
diff --git a/base/services/nfsd/CMakeLists.txt b/base/services/nfsd/CMakeLists.txt
index 5726c898cb6..d5f5dbd913c 100644
--- a/base/services/nfsd/CMakeLists.txt
+++ b/base/services/nfsd/CMakeLists.txt
@@ -50,7 +50,7 @@ add_executable(nfsd ${SOURCE} nfsd.rc)
if(MSVC AND (NOT USE_CLANG_CL))
# Disable warning C4477 (printf format warnings)
- target_compile_options(nfsd PRIVATE "/wd4477")
+ remove_target_compile_option(nfsd "/we4477")
else()
# FIXME: Tons of warnings.
target_compile_options(nfsd PRIVATE "-w")
diff --git a/dll/3rdparty/libtirpc/CMakeLists.txt b/dll/3rdparty/libtirpc/CMakeLists.txt
index 0ef4cc49132..d2d97f2cb73 100644
--- a/dll/3rdparty/libtirpc/CMakeLists.txt
+++ b/dll/3rdparty/libtirpc/CMakeLists.txt
@@ -96,8 +96,10 @@ add_library(libtirpc MODULE
if(MSVC)
# error C4133: '=': incompatible types - from 'char *' to
'int32_t *'
remove_target_compile_option(libtirpc "/we4133")
+ # Disable warning C4313 (format string conflicts)
+ remove_target_compile_option(libtirpc "/we4313")
# Disable warning C4477 (printf format warnings)
- target_compile_options(libtirpc PRIVATE /wd4313)
+ remove_target_compile_option(libtirpc "/we4477")
if (NOT USE_CLANG_CL)
remove_target_compile_option(libtirpc "/we4101")
target_compile_options(libtirpc PRIVATE /wd4101 /wd4133 /wd4473 /wd4477)
diff --git a/dll/win32/comctl32/CMakeLists.txt b/dll/win32/comctl32/CMakeLists.txt
index 60c571c58ed..6675e8f3500 100644
--- a/dll/win32/comctl32/CMakeLists.txt
+++ b/dll/win32/comctl32/CMakeLists.txt
@@ -64,9 +64,9 @@ add_library(comctl32 MODULE
rsrc.rc
${CMAKE_CURRENT_BINARY_DIR}/comctl32.def)
-if (MSVC)
+if(MSVC)
# Disable warning C4477 (printf format warnings)
- target_compile_options(comctl32 PRIVATE /wd4477)
+ remove_target_compile_option(comctl32 "/we4477")
endif()
set_module_type(comctl32 win32dll UNICODE)
diff --git a/dll/win32/dbghelp/CMakeLists.txt b/dll/win32/dbghelp/CMakeLists.txt
index b72e79e7584..ab1edd17410 100644
--- a/dll/win32/dbghelp/CMakeLists.txt
+++ b/dll/win32/dbghelp/CMakeLists.txt
@@ -80,7 +80,8 @@ else()
add_pch(dbghelp precomp.h SOURCE)
add_cd_file(TARGET dbghelp DESTINATION reactos/system32 FOR all)
- if (MSVC)
- target_compile_options(dbghelp PRIVATE /wd4477)
+ if(MSVC)
+ # Disable warning C4477 (printf format warnings)
+ remove_target_compile_option(dbghelp "/we4477")
endif()
endif()
diff --git a/modules/rostests/apitests/compiler/ms/seh/CMakeLists.txt
b/modules/rostests/apitests/compiler/ms/seh/CMakeLists.txt
index 1ad102959fc..34da6e3e4bc 100644
--- a/modules/rostests/apitests/compiler/ms/seh/CMakeLists.txt
+++ b/modules/rostests/apitests/compiler/ms/seh/CMakeLists.txt
@@ -1,15 +1,4 @@
-if(MSVC)
- add_compile_options("/wd4189") # error C4189: 'Index2': local
variable is initialized but not referenced
- add_compile_options("/wd4197") # warning C4197: 'volatile LONG':
top-level volatile in cast is ignored
- add_compile_options("/wd4532") # warning C4532: 'break': jump out
of __finally block has undefined behavior during termination handling
-else()
- add_compile_options("-Wno-format")
- add_compile_options("-Wno-implicit-function-declaration")
- add_compile_options("-Wno-unused-label")
- add_compile_options("-Wno-unused-variable")
-endif()
-
foreach(num RANGE 1 9)
list(APPEND SOURCE seh000${num}.c)
set_source_files_properties(seh000${num}.c PROPERTIES COMPILE_DEFINITIONS
@@ -24,3 +13,14 @@ endforeach()
add_library(ms_seh_test ${SOURCE})
add_dependencies(ms_seh_test psdk)
+
+if(MSVC)
+ # error C4189: 'Index2': local variable is initialized but not referenced
+ # warning C4197: 'volatile LONG': top-level volatile in cast is ignored
+ # warning C4532: 'break': jump out of __finally block has undefined behavior
during termination handling
+ remove_target_compile_option(ms_seh_test "/we4189")
+ target_compile_options(ms_seh_test PRIVATE /wd4189 /wd4197 /wd4532)
+else()
+ target_compile_options(ms_seh_test
+ PRIVATE -Wno-format -Wno-implicit-function-declaration -Wno-unused-label
-Wno-unused-variable)
+endif()
diff --git a/modules/rostests/winetests/d3dx9_36/CMakeLists.txt
b/modules/rostests/winetests/d3dx9_36/CMakeLists.txt
index 2a1dab147b7..1f4156ce271 100644
--- a/modules/rostests/winetests/d3dx9_36/CMakeLists.txt
+++ b/modules/rostests/winetests/d3dx9_36/CMakeLists.txt
@@ -16,7 +16,7 @@ add_executable(d3dx9_36_winetest
target_compile_definitions(d3dx9_36_winetest PRIVATE -DUSE_WINE_TODOS -D__WINESRC__
-Disnan=_isnan)
if(MSVC)
# Disable warning C4477 (printf format warnings)
- target_compile_options(d3dx9_36_winetest PRIVATE "/wd4477")
+ remove_target_compile_option(d3dx9_36_winetest "/we4477")
endif()
target_link_libraries(d3dx9_36_winetest uuid dxguid)
diff --git a/modules/rostests/winetests/kernel32/CMakeLists.txt
b/modules/rostests/winetests/kernel32/CMakeLists.txt
index 6720ce33df7..d652970ff98 100644
--- a/modules/rostests/winetests/kernel32/CMakeLists.txt
+++ b/modules/rostests/winetests/kernel32/CMakeLists.txt
@@ -47,7 +47,7 @@ add_executable(kernel32_winetest
if(MSVC)
# Disable warning C4477 (printf format warnings)
- target_compile_options(kernel32_winetest PRIVATE /wd4477)
+ remove_target_compile_option(kernel32_winetest "/we4477")
endif()
if(USE_CLANG_CL OR (NOT MSVC))
diff --git a/modules/rostests/winetests/user32/CMakeLists.txt
b/modules/rostests/winetests/user32/CMakeLists.txt
index 226edab9690..132170024a8 100644
--- a/modules/rostests/winetests/user32/CMakeLists.txt
+++ b/modules/rostests/winetests/user32/CMakeLists.txt
@@ -39,7 +39,7 @@ add_executable(user32_winetest
if(MSVC)
# Disable warning C4477 (printf format warnings)
- target_compile_options(user32_winetest PRIVATE /wd4477)
+ remove_target_compile_option(user32_winetest "/we4477")
elseif(GCC)
target_compile_options(user32_winetest PRIVATE -Wno-format-overflow)
endif()