From 89ad538cccefee74a30bc9ba687d08958231b4cf Mon Sep 17 00:00:00 2001 From: Matthew Parkinson Date: Sun, 12 Apr 2020 08:56:12 +0100 Subject: [PATCH] Disable GCC warning. --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 13887a6..fb3d38a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,14 @@ macro(warnings_high) add_compile_options(-Wsign-conversion) endif () add_compile_options(-Wall -Wextra -Werror -Wundef) + # There are a few places with subtle reasons for array access being correct + # GCC's warnings are too aggressive and incorrectly assume the code is wrong. + # Disabling only in Release is so the ASSUME can be mapped to assert and check + # at runtime in debug. This ensures we are covering the cases of concern with + # debug checks, but not incurring runtime penalties in release. + if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_BUILD_TYPE STREQUAL "Release")) + add_compile_options(-Wno-array-bounds) + endif () endif() endmacro()