From 92ab407a5960d2e269b39826cac05f8133cb277b Mon Sep 17 00:00:00 2001 From: Jieqiang Wang Date: Mon, 24 Jul 2023 15:42:22 +0800 Subject: [PATCH] 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 Change-Id: I999e847bb625ebdf3ef5f11b11598c553f306670 --- src/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b6d48f5b5ea..4ef4259d8f6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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) -- 2.16.6