build: disable bogus warnings for GCC 12

The array bounds and string overread check on GCC 12 report a dozen of
false positives that result in VPP build failures on ubuntu 22.04.
Work around this build issue by unconditionally disabling these two
warnings if C compiler is GCC 12 or newer version.

Type: fix
Signed-off-by: Jieqiang Wang <jieqiang.wang@arm.com>
Change-Id: I999e847bb625ebdf3ef5f11b11598c553f306670
This commit is contained in:
Jieqiang Wang
2023-07-24 15:42:22 +08:00
committed by Damjan Marion
parent 76d14b797c
commit 92ab407a59

View File

@ -59,6 +59,14 @@ elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU")
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL GCC_STRING_OVERFLOW_WARNING_DISABLE_VERSION)
add_compile_options(-Wno-stringop-overflow)
endif()
set(GCC_STRING_OVERREAD_WARNING_DISABLE_VERSION 12.0.0)
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL GCC_STRING_OVERREAD_WARNING_DISABLE_VERSION)
add_compile_options(-Wno-stringop-overread)
endif()
set(GCC_ARRAY_BOUNDS_WARNING_DISABLE_VERSION 12.0.0)
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL GCC_ARRAY_BOUNDS_WARNING_DISABLE_VERSION)
add_compile_options(-Wno-array-bounds)
endif()
else()
message(WARNING "WARNING: Unsupported C compiler `${CMAKE_C_COMPILER_ID}` is used")
set (PRINT_MIN_C_COMPILER_VER TRUE)