Skip to content

Commit

Permalink
[cmake] Disable all -Wuninitialized warnings on GCC older than 12. (#…
Browse files Browse the repository at this point in the history
…76251)

As discussed in #75183, avoids dealing with GCC false positives.
  • Loading branch information
cjacek committed Dec 26, 2023
1 parent 75073e0 commit 898320d
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions llvm/cmake/config-ix.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -431,15 +431,13 @@ set(USE_NO_UNINITIALIZED 0)
# Disable gcc's potentially uninitialized use analysis as it presents lots of
# false positives.
if (CMAKE_COMPILER_IS_GNUCXX)
check_cxx_compiler_flag("-Wmaybe-uninitialized" HAS_MAYBE_UNINITIALIZED)
if (HAS_MAYBE_UNINITIALIZED)
set(USE_NO_MAYBE_UNINITIALIZED 1)
else()
# Only recent versions of gcc make the distinction between -Wuninitialized
# and -Wmaybe-uninitialized. If -Wmaybe-uninitialized isn't supported, just
# turn off all uninitialized use warnings.
# Disable all -Wuninitialized warning for old GCC versions.
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.0)
check_cxx_compiler_flag("-Wuninitialized" HAS_UNINITIALIZED)
set(USE_NO_UNINITIALIZED ${HAS_UNINITIALIZED})
else()
check_cxx_compiler_flag("-Wmaybe-uninitialized" HAS_MAYBE_UNINITIALIZED)
set(USE_NO_MAYBE_UNINITIALIZED ${HAS_MAYBE_UNINITIALIZED})
endif()
endif()

Expand Down

0 comments on commit 898320d

Please sign in to comment.