Disable stringop-overflow warnings under GCC12

They are really buggy and produce tons of false positives and, as far as
I've seen, no true positives so just disable them.

I kept this only to 12.x in the hope that gcc 13 will improve the
warning's usefulness.
This commit is contained in:
Jason Rhinelander 2022-12-20 18:23:39 -04:00
parent fb3b414118
commit 466e08e413
No known key found for this signature in database
GPG Key ID: C4992CE7A88D4262
1 changed files with 6 additions and 0 deletions

View File

@ -623,6 +623,12 @@ else()
add_cxx_flag_if_supported(-fstack-clash-protection CXX_SECURITY_FLAGS)
endif()
# GCC 12's stringop-overflow warnings are really broken, with tons and tons of false positives all
# over the place (not just in our code, but also in its own stdlibc++ code).
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 12 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13)
set(CXX_WARNINGS "${CXX_WARNINGS} -Wno-stringop-overflow")
endif()
# Removed in GCC 9.1 (or before ?), but still accepted, so spams the output
if (NOT CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_VERSION VERSION_LESS 9.1)
add_c_flag_if_supported(-mmitigate-rop C_SECURITY_FLAGS)