@@ -876,52 +876,42 @@ if (LLVM_ENABLE_WARNINGS AND (LLVM_COMPILER_IS_GCC_COMPATIBLE OR CLANG_CL))
876876 append_if(USE_NO_UNINITIALIZED "-Wno-uninitialized" CMAKE_CXX_FLAGS )
877877 append_if(USE_NO_MAYBE_UNINITIALIZED "-Wno-maybe-uninitialized" CMAKE_CXX_FLAGS )
878878
879- # Disable -Wnonnull for GCC warning as it is emitting a lot of false positives.
880879 if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
880+ # Disable -Wnonnull for GCC warning as it is emitting a lot of false positives.
881881 append ("-Wno-nonnull" CMAKE_CXX_FLAGS )
882- endif ()
883882
884- # Disable -Wclass-memaccess, a C++-only warning from GCC 8 that fires on
885- # LLVM's ADT classes.
886- if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
883+ # Disable -Wclass-memaccess, a C++-only warning from GCC 8 that fires on
884+ # LLVM's ADT classes.
887885 if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1)
888886 append ("-Wno-class-memaccess" CMAKE_CXX_FLAGS )
889887 endif ()
890- endif ()
891888
892- # Disable -Wdangling-reference, a C++-only warning from GCC 13 that seems
893- # to produce a large number of false positives.
894- if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
889+ # Disable -Wdangling-reference, a C++-only warning from GCC 13 that seems
890+ # to produce a large number of false positives.
895891 if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1)
896892 append ("-Wno-dangling-reference" CMAKE_CXX_FLAGS )
897893 endif ()
898- endif ()
899894
900- # Disable -Wredundant-move and -Wpessimizing-move on GCC>=9. GCC wants to
901- # remove std::move in code like
902- # "A foo(ConvertibleToA a) { return std::move(a); }",
903- # but this code does not compile (or uses the copy
904- # constructor instead) on clang<=3.8. Clang also has a -Wredundant-move and
905- # -Wpessimizing-move, but they only fire when the types match exactly, so we
906- # can keep them here.
907- if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
895+ # Disable -Wredundant-move and -Wpessimizing-move on GCC>=9. GCC wants to
896+ # remove std::move in code like
897+ # "A foo(ConvertibleToA a) { return std::move(a); }",
898+ # but this code does not compile (or uses the copy
899+ # constructor instead) on clang<=3.8. Clang also has a -Wredundant-move and
900+ # -Wpessimizing-move, but they only fire when the types match exactly, so we
901+ # can keep them here.
908902 if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 9.1)
909903 append ("-Wno-redundant-move" CMAKE_CXX_FLAGS )
910904 append ("-Wno-pessimizing-move" CMAKE_CXX_FLAGS )
911905 endif ()
912- endif ()
913906
914- # Disable -Warray-bounds on GCC; this warning exists since a very long time,
915- # but since GCC 11, it produces a lot of very noisy, seemingly false positive
916- # warnings (potentially originating in libstdc++).
917- if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
907+ # Disable -Warray-bounds on GCC; this warning exists since a very long time,
908+ # but since GCC 11, it produces a lot of very noisy, seemingly false positive
909+ # warnings (potentially originating in libstdc++).
918910 append ("-Wno-array-bounds" CMAKE_CXX_FLAGS )
919- endif ()
920911
921- # Disable -Wstringop-overread on GCC; this warning produces a number of very
922- # noisy diagnostics when -Warray-bounds is disabled above; this option exists
923- # since GCC 11.
924- if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
912+ # Disable -Wstringop-overread on GCC; this warning produces a number of very
913+ # noisy diagnostics when -Warray-bounds is disabled above; this option exists
914+ # since GCC 11.
925915 if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 11.1)
926916 append ("-Wno-stringop-overread" CMAKE_CXX_FLAGS )
927917 endif ()
0 commit comments