1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
Author: Andreas Beckmann <anbe@debian.org>
Description: fix disabling warnings
g++ silently accepts -Wno-unknown-foo but errors out on -Wunknown-foo
cc1plus warns on -Wno-unknown-foo
--- a/cub/cmake/AppendOptionIfAvailable.cmake
+++ b/cub/cmake/AppendOptionIfAvailable.cmake
@@ -11,3 +11,14 @@ if (${${_VAR}})
endif ()
endmacro ()
+
+macro (disable_cxx_warning_if_available _WARNING _LIST)
+
+string(MAKE_C_IDENTIFIER "CXX_FLAG_-W${_WARNING}" _VAR)
+check_cxx_compiler_flag("-W${_WARNING}" ${_VAR})
+
+if (${${_VAR}})
+ list(APPEND ${_LIST} "-Wno-${_WARNING}")
+endif ()
+
+endmacro ()
--- a/cub/cmake/CubBuildCompilerTargets.cmake
+++ b/cub/cmake/CubBuildCompilerTargets.cmake
@@ -56,11 +56,11 @@ function(cub_build_compiler_targets)
# Disable GNU extensions (flag is clang only)
append_option_if_available("-Wgnu" cxx_compile_options)
- append_option_if_available("-Wno-gnu-line-marker" cxx_compile_options) # WAR 3916341
+ disable_cxx_warning_if_available("gnu-line-marker" cxx_compile_options) # WAR 3916341
# Calling a variadic macro with zero args is a GNU extension until C++20,
# but the THRUST_PP_ARITY macro is used with zero args. Need to see if this
# is a real problem worth fixing.
- append_option_if_available("-Wno-gnu-zero-variadic-macro-arguments" cxx_compile_options)
+ disable_cxx_warning_if_available("gnu-zero-variadic-macro-arguments" cxx_compile_options)
# This complains about functions in CUDA system headers when used with nvcc.
append_option_if_available("-Wno-unused-function" cxx_compile_options)
--- a/thrust/cmake/AppendOptionIfAvailable.cmake
+++ b/thrust/cmake/AppendOptionIfAvailable.cmake
@@ -12,3 +12,13 @@ endif ()
endmacro ()
+macro (disable_cxx_warning_if_available _WARNING _LIST)
+
+string(MAKE_C_IDENTIFIER "CXX_FLAG_-W${_WARNING}" _VAR)
+check_cxx_compiler_flag("-W${_WARNING}" ${_VAR})
+
+if (${${_VAR}})
+ list(APPEND ${_LIST} "-Wno-${_WARNING}")
+endif ()
+
+endmacro ()
--- a/thrust/cmake/ThrustBuildCompilerTargets.cmake
+++ b/thrust/cmake/ThrustBuildCompilerTargets.cmake
@@ -93,11 +93,11 @@ function(thrust_build_compiler_targets)
# Disable GNU extensions (flag is clang only)
append_option_if_available("-Wgnu" cxx_compile_options)
- append_option_if_available("-Wno-gnu-line-marker" cxx_compile_options) # WAR 3916341
+ disable_cxx_warning_if_available("gnu-line-marker" cxx_compile_options) # WAR 3916341
# Calling a variadic macro with zero args is a GNU extension until C++20,
# but the THRUST_PP_ARITY macro is used with zero args. Need to see if this
# is a real problem worth fixing.
- append_option_if_available("-Wno-gnu-zero-variadic-macro-arguments" cxx_compile_options)
+ disable_cxx_warning_if_available("gnu-zero-variadic-macro-arguments" cxx_compile_options)
# This complains about functions in CUDA system headers when used with nvcc.
append_option_if_available("-Wno-unused-function" cxx_compile_options)
|