From 5035c018d425b5e9711ababdde75074e942b0913 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Wed, 29 Mar 2023 11:50:28 -0500 Subject: [PATCH] CMake: separate warning flags into DEAL_II_WARNING_FLAGS variable --- cmake/configure/configure_20_boost.cmake | 2 +- cmake/configure/configure_40_cuda.cmake | 2 +- cmake/setup_compiler_flags_gnu.cmake | 44 +++++++++--------- cmake/setup_compiler_flags_intel.cmake | 58 ++++++++++++------------ cmake/setup_compiler_flags_msvc.cmake | 28 ++++++------ 5 files changed, 67 insertions(+), 67 deletions(-) diff --git a/cmake/configure/configure_20_boost.cmake b/cmake/configure/configure_20_boost.cmake index 3d5f00cf9f..d37d9eb4c1 100644 --- a/cmake/configure/configure_20_boost.cmake +++ b/cmake/configure/configure_20_boost.cmake @@ -152,7 +152,7 @@ macro(feature_boost_configure_external) # # Avoid a number of warnings: # - enable_if_supported(DEAL_II_CXX_FLAGS "-Wno-unused-local-typedefs") + enable_if_supported(DEAL_II_WARNING_FLAGS "-Wno-unused-local-typedefs") # # At least BOOST 1.74 has the problem that some of the BOOST headers diff --git a/cmake/configure/configure_40_cuda.cmake b/cmake/configure/configure_40_cuda.cmake index c576153d00..46b9e9c205 100644 --- a/cmake/configure/configure_40_cuda.cmake +++ b/cmake/configure/configure_40_cuda.cmake @@ -95,7 +95,7 @@ macro(feature_cuda_configure_external) # produces a lot of warnings when pedantic is enabled. So filter out the # flag: # - string(REPLACE "-pedantic" "" DEAL_II_CXX_FLAGS "${DEAL_II_CXX_FLAGS}") + string(REPLACE "-pedantic" "" DEAL_II_WARNING_FLAGS "${DEAL_II_WARNING_FLAGS}") endmacro() diff --git a/cmake/setup_compiler_flags_gnu.cmake b/cmake/setup_compiler_flags_gnu.cmake index b7e8ac7347..ac3de0b282 100644 --- a/cmake/setup_compiler_flags_gnu.cmake +++ b/cmake/setup_compiler_flags_gnu.cmake @@ -58,68 +58,68 @@ endif() # # Set -pedantic if the compiler supports it. # -enable_if_supported(DEAL_II_CXX_FLAGS "-pedantic") +enable_if_supported(DEAL_II_WARNING_FLAGS "-pedantic") # # Setup various warnings: # -enable_if_supported(DEAL_II_CXX_FLAGS "-Wall") -enable_if_supported(DEAL_II_CXX_FLAGS "-Wextra") -enable_if_supported(DEAL_II_CXX_FLAGS "-Wmissing-braces") -enable_if_supported(DEAL_II_CXX_FLAGS "-Woverloaded-virtual") -enable_if_supported(DEAL_II_CXX_FLAGS "-Wpointer-arith") -enable_if_supported(DEAL_II_CXX_FLAGS "-Wsign-compare") -enable_if_supported(DEAL_II_CXX_FLAGS "-Wsuggest-override") -enable_if_supported(DEAL_II_CXX_FLAGS "-Wswitch") -enable_if_supported(DEAL_II_CXX_FLAGS "-Wsynth") -enable_if_supported(DEAL_II_CXX_FLAGS "-Wwrite-strings") +enable_if_supported(DEAL_II_WARNING_FLAGS "-Wall") +enable_if_supported(DEAL_II_WARNING_FLAGS "-Wextra") +enable_if_supported(DEAL_II_WARNING_FLAGS "-Wmissing-braces") +enable_if_supported(DEAL_II_WARNING_FLAGS "-Woverloaded-virtual") +enable_if_supported(DEAL_II_WARNING_FLAGS "-Wpointer-arith") +enable_if_supported(DEAL_II_WARNING_FLAGS "-Wsign-compare") +enable_if_supported(DEAL_II_WARNING_FLAGS "-Wsuggest-override") +enable_if_supported(DEAL_II_WARNING_FLAGS "-Wswitch") +enable_if_supported(DEAL_II_WARNING_FLAGS "-Wsynth") +enable_if_supported(DEAL_II_WARNING_FLAGS "-Wwrite-strings") # # Disable Wplacement-new that will trigger a lot of warnings # in the BOOST function classes that we include via the # BOOST signals classes: # -enable_if_supported(DEAL_II_CXX_FLAGS "-Wno-placement-new") +enable_if_supported(DEAL_II_WARNING_FLAGS "-Wno-placement-new") # # Disable deprecation warnings # -enable_if_supported(DEAL_II_CXX_FLAGS "-Wno-deprecated-declarations") +enable_if_supported(DEAL_II_WARNING_FLAGS "-Wno-deprecated-declarations") # # Disable warning generated by Debian version of openmpi # -enable_if_supported(DEAL_II_CXX_FLAGS "-Wno-literal-suffix") +enable_if_supported(DEAL_II_WARNING_FLAGS "-Wno-literal-suffix") # # Disable warning about ABI changes # -enable_if_supported(DEAL_II_CXX_FLAGS "-Wno-psabi") +enable_if_supported(DEAL_II_WARNING_FLAGS "-Wno-psabi") # # Disable warnings regarding improper direct memory access # if compiling without C++17 support # if(NOT DEAL_II_HAVE_CXX17) - enable_if_supported(DEAL_II_CXX_FLAGS "-Wno-class-memaccess") + enable_if_supported(DEAL_II_WARNING_FLAGS "-Wno-class-memaccess") endif() if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") # Enable warnings for conversion from real types to integer types. # The warning is too noisy in gcc and therefore only enabled for clang. - enable_if_supported(DEAL_II_CXX_FLAGS "-Wfloat-conversion") + enable_if_supported(DEAL_II_WARNING_FLAGS "-Wfloat-conversion") # # Silence Clang warnings about unused compiler parameters (works around a # regression in the clang driver frontend of certain versions): # - enable_if_supported(DEAL_II_CXX_FLAGS "-Qunused-arguments") + enable_if_supported(DEAL_II_WARNING_FLAGS "-Qunused-arguments") # # Clang verbosely warns about not supporting all our friend declarations # (and consequently removing access control altogether) # - enable_if_supported(DEAL_II_CXX_FLAGS "-Wno-unsupported-friend") + enable_if_supported(DEAL_II_WARNING_FLAGS "-Wno-unsupported-friend") # # Clang versions prior to 3.6 emit a lot of false positives wrt @@ -134,12 +134,12 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.6") OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.3")) - enable_if_supported(DEAL_II_CXX_FLAGS "-Wno-unused-function") + enable_if_supported(DEAL_II_WARNING_FLAGS "-Wno-unused-function") endif() elseif(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.6" OR ( NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.0" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.3") ) - enable_if_supported(DEAL_II_CXX_FLAGS "-Wno-unused-function") + enable_if_supported(DEAL_II_WARNING_FLAGS "-Wno-unused-function") endif() # @@ -153,7 +153,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") # # Let us simply disable the warning for now. # - enable_if_supported(DEAL_II_CXX_FLAGS "-Wno-pass-failed") + enable_if_supported(DEAL_II_WARNING_FLAGS "-Wno-pass-failed") endif() diff --git a/cmake/setup_compiler_flags_intel.cmake b/cmake/setup_compiler_flags_intel.cmake index 5da2a793b9..18dc3d53ae 100644 --- a/cmake/setup_compiler_flags_intel.cmake +++ b/cmake/setup_compiler_flags_intel.cmake @@ -37,13 +37,13 @@ endif() # # Enable verbose warnings: # -enable_if_supported(DEAL_II_CXX_FLAGS "-w2") +enable_if_supported(DEAL_II_WARNING_FLAGS "-w2") # # Disable remarks like "Inlining inhibited by limit max-size" # -enable_if_supported(DEAL_II_CXX_FLAGS "-diag-disable=remark") -enable_if_supported(DEAL_II_CXX_FLAGS "-diag-disable=16219") +enable_if_supported(DEAL_II_WARNING_FLAGS "-diag-disable=remark") +enable_if_supported(DEAL_II_WARNING_FLAGS "-diag-disable=16219") # # Disable some warnings that lead to a lot of false positives: @@ -97,27 +97,27 @@ enable_if_supported(DEAL_II_CXX_FLAGS "-diag-disable=16219") # -w15531 A portion of SIMD loop is serialized # -w15552 loop was not vectorized with "simd" # -enable_if_supported(DEAL_II_CXX_FLAGS "-wd21") -enable_if_supported(DEAL_II_CXX_FLAGS "-wd68") -enable_if_supported(DEAL_II_CXX_FLAGS "-wd135") -enable_if_supported(DEAL_II_CXX_FLAGS "-wd175") -enable_if_supported(DEAL_II_CXX_FLAGS "-wd177") -enable_if_supported(DEAL_II_CXX_FLAGS "-wd191") -enable_if_supported(DEAL_II_CXX_FLAGS "-wd193") -enable_if_supported(DEAL_II_CXX_FLAGS "-wd279") -enable_if_supported(DEAL_II_CXX_FLAGS "-wd327") -enable_if_supported(DEAL_II_CXX_FLAGS "-wd383") -enable_if_supported(DEAL_II_CXX_FLAGS "-wd854") -enable_if_supported(DEAL_II_CXX_FLAGS "-wd981") -enable_if_supported(DEAL_II_CXX_FLAGS "-wd1418") -enable_if_supported(DEAL_II_CXX_FLAGS "-wd1478") -enable_if_supported(DEAL_II_CXX_FLAGS "-wd1572") -enable_if_supported(DEAL_II_CXX_FLAGS "-wd2259") -enable_if_supported(DEAL_II_CXX_FLAGS "-wd2536") -enable_if_supported(DEAL_II_CXX_FLAGS "-wd2651") -enable_if_supported(DEAL_II_CXX_FLAGS "-wd3415") -enable_if_supported(DEAL_II_CXX_FLAGS "-wd15531") -enable_if_supported(DEAL_II_CXX_FLAGS "-wd15552") +enable_if_supported(DEAL_II_WARNING_FLAGS "-wd21") +enable_if_supported(DEAL_II_WARNING_FLAGS "-wd68") +enable_if_supported(DEAL_II_WARNING_FLAGS "-wd135") +enable_if_supported(DEAL_II_WARNING_FLAGS "-wd175") +enable_if_supported(DEAL_II_WARNING_FLAGS "-wd177") +enable_if_supported(DEAL_II_WARNING_FLAGS "-wd191") +enable_if_supported(DEAL_II_WARNING_FLAGS "-wd193") +enable_if_supported(DEAL_II_WARNING_FLAGS "-wd279") +enable_if_supported(DEAL_II_WARNING_FLAGS "-wd327") +enable_if_supported(DEAL_II_WARNING_FLAGS "-wd383") +enable_if_supported(DEAL_II_WARNING_FLAGS "-wd854") +enable_if_supported(DEAL_II_WARNING_FLAGS "-wd981") +enable_if_supported(DEAL_II_WARNING_FLAGS "-wd1418") +enable_if_supported(DEAL_II_WARNING_FLAGS "-wd1478") +enable_if_supported(DEAL_II_WARNING_FLAGS "-wd1572") +enable_if_supported(DEAL_II_WARNING_FLAGS "-wd2259") +enable_if_supported(DEAL_II_WARNING_FLAGS "-wd2536") +enable_if_supported(DEAL_II_WARNING_FLAGS "-wd2651") +enable_if_supported(DEAL_II_WARNING_FLAGS "-wd3415") +enable_if_supported(DEAL_II_WARNING_FLAGS "-wd15531") +enable_if_supported(DEAL_II_WARNING_FLAGS "-wd15552") # @@ -136,11 +136,11 @@ enable_if_supported(DEAL_II_CXX_FLAGS "-wd15552") # -w280 selector expression is constant # When writing 'switch(dim)' # -enable_if_supported(DEAL_II_CXX_FLAGS "-wd111") -enable_if_supported(DEAL_II_CXX_FLAGS "-wd128") -enable_if_supported(DEAL_II_CXX_FLAGS "-wd185") -enable_if_supported(DEAL_II_CXX_FLAGS "-wd186") -enable_if_supported(DEAL_II_CXX_FLAGS "-wd280") +enable_if_supported(DEAL_II_WARNING_FLAGS "-wd111") +enable_if_supported(DEAL_II_WARNING_FLAGS "-wd128") +enable_if_supported(DEAL_II_WARNING_FLAGS "-wd185") +enable_if_supported(DEAL_II_WARNING_FLAGS "-wd186") +enable_if_supported(DEAL_II_WARNING_FLAGS "-wd280") ############################# diff --git a/cmake/setup_compiler_flags_msvc.cmake b/cmake/setup_compiler_flags_msvc.cmake index e129122cbc..df3e32ace9 100644 --- a/cmake/setup_compiler_flags_msvc.cmake +++ b/cmake/setup_compiler_flags_msvc.cmake @@ -51,7 +51,7 @@ list(APPEND DEAL_II_DEFINITIONS "NOMINMAX") # happening in debug mode with visual studio 2015 enable_if_supported(DEAL_II_CXX_FLAGS "/bigobj") -add_flags(DEAL_II_CXX_FLAGS "/W3") +add_flags(DEAL_II_WARNING_FLAGS "/W3") # # Selectively disable a bunch of warnings: @@ -69,23 +69,23 @@ add_flags(DEAL_II_CXX_FLAGS "/W3") # 4700 - uninitialized local variable # 4789 - destination of memory copy is too small # 4808 - case 'value' is not a valid value for switch condition of type 'bool -enable_if_supported(DEAL_II_CXX_FLAGS "/wd4068") -enable_if_supported(DEAL_II_CXX_FLAGS "/wd4244") -enable_if_supported(DEAL_II_CXX_FLAGS "/wd4267") -enable_if_supported(DEAL_II_CXX_FLAGS "/wd4996") -enable_if_supported(DEAL_II_CXX_FLAGS "/wd4355") -enable_if_supported(DEAL_II_CXX_FLAGS "/wd4800") -enable_if_supported(DEAL_II_CXX_FLAGS "/wd4146") -enable_if_supported(DEAL_II_CXX_FLAGS "/wd4667") -enable_if_supported(DEAL_II_CXX_FLAGS "/wd4520") -enable_if_supported(DEAL_II_CXX_FLAGS "/wd4700") -enable_if_supported(DEAL_II_CXX_FLAGS "/wd4789") -enable_if_supported(DEAL_II_CXX_FLAGS "/wd4808") +enable_if_supported(DEAL_II_WARNING_FLAGS "/wd4068") +enable_if_supported(DEAL_II_WARNING_FLAGS "/wd4244") +enable_if_supported(DEAL_II_WARNING_FLAGS "/wd4267") +enable_if_supported(DEAL_II_WARNING_FLAGS "/wd4996") +enable_if_supported(DEAL_II_WARNING_FLAGS "/wd4355") +enable_if_supported(DEAL_II_WARNING_FLAGS "/wd4800") +enable_if_supported(DEAL_II_WARNING_FLAGS "/wd4146") +enable_if_supported(DEAL_II_WARNING_FLAGS "/wd4667") +enable_if_supported(DEAL_II_WARNING_FLAGS "/wd4520") +enable_if_supported(DEAL_II_WARNING_FLAGS "/wd4700") +enable_if_supported(DEAL_II_WARNING_FLAGS "/wd4789") +enable_if_supported(DEAL_II_WARNING_FLAGS "/wd4808") # Bug in MSVC 2017: bogus warning C5037: an out-of-line definition of a member of a class template cannot have default arguments # see https://developercommunity.visualstudio.com/content/problem/81223/incorrect-error-c5037-with-permissive.html -enable_if_supported(DEAL_II_CXX_FLAGS "/wd5037") +enable_if_supported(DEAL_II_WARNING_FLAGS "/wd5037") ############################# # # -- 2.39.5