[libc-commits] [libc] [libc] [Task] Enable most libc disabled warnings (PR #122835)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Tue Jan 14 11:17:04 PST 2025


================
@@ -262,13 +263,13 @@ function(_get_common_test_compile_options output_var c_test flags)
       list(APPEND compile_options "-Wno-gnu-imaginary-constant")
     endif()
     list(APPEND compile_options "-Wno-pedantic")
-    # if(NOT CMAKE_COMPILER_IS_GNUCXX)
-    #   list(APPEND compile_options "-Wnewline-eof")
-    #   list(APPEND compile_options "-Wnonportable-system-include-path")
-    #   list(APPEND compile_options "-Wstrict-prototypes")
-    #   list(APPEND compile_options "-Wthread-safety")
-    #   list(APPEND compile_options "-Wglobal-constructors")
-    # endif()
+    if(NOT CMAKE_COMPILER_IS_GNUCXX)
----------------
nickdesaulniers wrote:

https://cmake.org/cmake/help/latest/variable/CMAKE_COMPILER_IS_GNUCXX.html mentions that this is deprecated and that `CMAKE_CXX_COMPILER_ID` should be used instead.

It looks fishy to me because "not gcc" isn't necessarily clang, and yet `-Wthread-safety` is very much so currently a clang specific diagnostic. Instead, the conditional should be phrased as "if clang" rather than "if not gcc."

So if anything this looks like it should be folded into the above `else` clause that's already testing `CMAKE_CXX_COMPILER_ID`, or rather a new clause that's `elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")

https://github.com/llvm/llvm-project/pull/122835


More information about the libc-commits mailing list