cmake/gcc: disable [-Werror=maybe-uninitialized] for GCC >= 12.1.0

With GCC 12.1.0 there are numerous false-positive warnings on
"maybe uninitialized" variables.
master
Robert Falkenberg 3 years ago
parent 0c9ba5b87e
commit 21a4a675dd

@ -540,6 +540,12 @@ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
endif()
# GCC >= 12.1.0: Disable analysis on "maybe-uninitialized" variables because of the high false-positive rate
if(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-maybe-uninitialized")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-maybe-uninitialized")
endif()
if(CMAKE_C_COMPILER_ID MATCHES "GNU")
# Increase inlining limit to allow gcc compilation on e.g. RPi2
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --param large-function-growth=1600")

Loading…
Cancel
Save