Skip to content

Commit 480e334

Browse files
committed
Disable array-bounds checking without assertions to avoid false positives detected when compiling with GCC
1 parent 0dd6428 commit 480e334

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ if (ENABLE_WERROR)
8080
if (HAS_STRINGOP_OVERFLOW)
8181
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=stringop-overflow")
8282
endif()
83+
if (ASSERT_LEVEL STREQUAL "MINIMAL")
84+
check_cxx_compiler_flag("-Warray-bounds" HAS_ARRAY_BOUNDS)
85+
if (HAS_ARRAY_BOUNDS)
86+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=array-bounds")
87+
endif()
88+
endif()
8389
endif()
8490
endif ()
8591

0 commit comments

Comments
 (0)