From 82bd020a3047d43817c06b5d012e52eca0bfd298 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 15 Jan 2023 23:29:02 +1100 Subject: [PATCH] CMake: suppress GCC warnings stringop-overread & stringop-overflow As noted in comments, there are a lot of false positives which can't be conveniently suppressed. Many of these warnings were caused by `float x, y, z` being passed as `float[3]` using a pointer to `x`. --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9dfb962a57e..0b2f4eec61a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1427,6 +1427,9 @@ if(CMAKE_COMPILER_IS_GNUCC) add_check_c_compiler_flag(C_WARNINGS C_WARN_TYPE_LIMITS -Wtype-limits) add_check_c_compiler_flag(C_WARNINGS C_WARN_FORMAT_SIGN -Wformat-signedness) add_check_c_compiler_flag(C_WARNINGS C_WARN_RESTRICT -Wrestrict) + # Useful but too many false positives and inconvenient to suppress each occurrence. + add_check_c_compiler_flag(C_WARNINGS C_WARN_NO_STRINGOP_OVERREAD -Wno-stringop-overread) + add_check_c_compiler_flag(C_WARNINGS C_WARN_NO_STRINGOP_OVERFLOW -Wno-stringop-overflow) # C-only. add_check_c_compiler_flag(C_WARNINGS C_WARN_NO_NULL -Wnonnull) @@ -1466,6 +1469,9 @@ if(CMAKE_COMPILER_IS_GNUCC) add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_RESTRICT -Wrestrict) add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_NO_SUGGEST_OVERRIDE -Wno-suggest-override) add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_UNINITIALIZED -Wuninitialized) + # Useful but too many false positives and inconvenient to suppress each occurrence. + add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_NO_STRINGOP_OVERREAD -Wno-stringop-overread) + add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_NO_STRINGOP_OVERFLOW -Wno-stringop-overflow) # causes too many warnings if(NOT APPLE)