From 41feaa17f3b1db488027d9754c02eda8a375f980 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 19 May 2022 10:33:02 +1000 Subject: Cleanup: suppress 'address' warnings for ./extern/glew Also add comments noting why some warnings shouldn't be added to strict-flags. --- CMakeLists.txt | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 13f4e6b9cc4..c0ff56fb0f0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -937,7 +937,10 @@ set(PLATFORM_CFLAGS) set(C_WARNINGS) set(CXX_WARNINGS) -# for gcc -Wno-blah-blah +# NOTE: These flags are intended for situations where where it's impractical to +# suppress warnings by modifying the code or for code which is maintained externally. +# For GCC this typically means adding `-Wno-*` arguments to negate warnings +# that are useful in the general case. set(C_REMOVE_STRICT_FLAGS) set(CXX_REMOVE_STRICT_FLAGS) @@ -1617,6 +1620,18 @@ if(CMAKE_COMPILER_IS_GNUCC) ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_IMPLICIT_FALLTHROUGH -Wimplicit-fallthrough=5) endif() + + #---------------------- + # Suppress Strict Flags + # + # Exclude the following warnings from this list: + # - `-Wno-address`: + # This can give useful hints that point to bugs/misleading logic. + # - `-Wno-strict-prototypes`: + # No need to support older C-style prototypes. + # + # If code in `./extern/` needs to suppress these flags that can be done on a case-by-case basis. + # flags to undo strict flags ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_DEPRECATED_DECLARATIONS -Wno-deprecated-declarations) ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter) @@ -1672,6 +1687,9 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Clang") # ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNUSED_MACROS -Wunused-macros) # ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNUSED_MACROS -Wunused-macros) + #---------------------- + # Suppress Strict Flags + # flags to undo strict flags ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter) ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_VARIABLE -Wno-unused-variable) -- cgit v1.2.3