BUILD: Suppress stringop-overflow and stringop-truncation GCC warnings

Too many false-positives.
This commit is contained in:
Orgad Shaneh
2025-05-19 08:38:47 +03:00
committed by Filippos Karapetis
parent 3e33c8908d
commit e472be2ee4
2 changed files with 16 additions and 2 deletions
Vendored
+6
View File
@@ -2383,6 +2383,12 @@ if test "$have_gcc" = yes; then
if test $_cxx_major -ge 5; then
append_var CXXFLAGS "-Wshadow"
if test $_cxx_major -ge 7; then
append_var CXXFLAGS "-Wno-stringop-overflow"
if test $_cxx_major -ge 8; then
append_var CXXFLAGS "-Wno-stringop-truncation"
fi
fi
else
append_var CXXFLAGS "-Wno-missing-field-initializers"
+10 -2
View File
@@ -349,8 +349,16 @@ void CMakeProvider::writeWarnings(std::ofstream &output) const {
output << ' ' << warning;
}
output << "\")\n";
output << "\tif(CMAKE_CXX_COMPILER_ID STREQUAL \"GNU\" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12.0)\n";
output << "\t\tset(CMAKE_CXX_FLAGS \"${CMAKE_CXX_FLAGS} -Wno-address-of-packed-member\")\n";
output << "\tif(CMAKE_CXX_COMPILER_ID STREQUAL \"GNU\")\n";
output << "\t\tif(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 7.1)\n";
output << "\t\t\tset(CMAKE_CXX_FLAGS \"${CMAKE_CXX_FLAGS} -Wno-stringop-overflow\")\n";
output << "\t\tendif()\n";
output << "\t\tif(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1)\n";
output << "\t\t\tset(CMAKE_CXX_FLAGS \"${CMAKE_CXX_FLAGS} -Wno-stringop-truncation\")\n";
output << "\t\tendif()\n";
output << "\t\tif(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12.0)\n";
output << "\t\t\tset(CMAKE_CXX_FLAGS \"${CMAKE_CXX_FLAGS} -Wno-address-of-packed-member\")\n";
output << "\t\tendif()\n";
output << "\tendif()\n";
output << "endif()\n";
}