[libc-commits] [libc] [libc] `-Wimplicit-fallthrough`, `-Wwrite-strings` and non-GCC warnings (PR #124036)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Tue Jan 28 09:21:43 PST 2025


================
@@ -46,13 +46,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:

> -Wstrict-prototypes is supported by both compilers, so it should not be in a clang specific list. Rather, it should be enabled for both compilers. Please move it up to the block on L36-L37.

Ah, shoot! Something I missed was:

```
cc1plus: error: command-line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
```
So while GCC _does_ support `-Wstrict-prototypes`, it only does so for C mode (not C++).  So sorry for the goose chase, but my previous feedback here was wrong and bad advice. Do you mind moving `-Wstrict-prototypes` back to just being set for clang?

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


More information about the libc-commits mailing list