Skip to content

Commit

Permalink
Disable the array-bounds warnings for g++-13 because of false posit…
Browse files Browse the repository at this point in the history
…ives (ad-freiburg#1069)

For g++-13, add option `-Wno-error=array-bounds` because of false positives.

For g++-12, replace the more general `-Wno-error` (which was also there because of false positives) by the more fine-grained `-Wno-error=array-bounds -Wno-error=restrict`.
  • Loading branch information
joka921 authored Aug 28, 2023
1 parent 651bdd6 commit e1d08fc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
8 changes: 0 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,6 @@ if ("${CMAKE_GENERATOR}" STREQUAL "Ninja")
endif ()
endif ()

if (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") AND
(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12") AND
(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "13"))
message(STATUS "Adding -Wno-error for g++12.0 because of the many false positive warnings from stdlib headers")
add_compile_options(-Wno-error)
else()
endif ()

###############################################################################
##### Essential settings #####
###############################################################################
Expand Down
2 changes: 2 additions & 0 deletions toolchains/gcc12.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Toolchain that uses G++ 12
set(CMAKE_C_COMPILER gcc-12)
set(CMAKE_CXX_COMPILER g++-12)
# Disable errors for known false-positive warnings
set(CMAKE_CXX_FLAGS "-Wno-error=array-bounds -Wno-error=restrict")
2 changes: 2 additions & 0 deletions toolchains/gcc13.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Toolchain that uses G++ 13
set(CMAKE_C_COMPILER gcc-13)
set(CMAKE_CXX_COMPILER g++-13)
# Disable errors for known false-positive warnings
set(CMAKE_CXX_FLAGS "-Wno-error=array-bounds")

0 comments on commit e1d08fc

Please sign in to comment.