[llvm] [CMake] Disable more noisy GCC warnings (PR #159044)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 16 11:56:11 PDT 2025
================
@@ -911,6 +911,22 @@ if (LLVM_ENABLE_WARNINGS AND (LLVM_COMPILER_IS_GCC_COMPATIBLE OR CLANG_CL))
endif()
endif()
+ # Disable -Warray-bounds on GCC; this warning exists since a very long time,
+ # but since GCC 11, it produces a lot of very noisy, seemingly false positive
+ # warnings (potentially originating in libstdc++).
+ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ append("-Wno-array-bounds" CMAKE_CXX_FLAGS)
+ endif()
+
+ # Disable -Wstringop-overread on GCC; this warning produces a number of very
+ # noisy diagnostics when -Warray-bounds is disabled above; this option exists
+ # since GCC 11.
+ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
----------------
nikic wrote:
We should probably deduplicate this `CMAKE_CXX_COMPILER_ID STREQUAL "GNU"` check, as it's repeated 6 times in a row now...
https://github.com/llvm/llvm-project/pull/159044
More information about the llvm-commits
mailing list