[libc-commits] [libc] [libc] Build with -Wshadow (PR #196519)

via libc-commits libc-commits at lists.llvm.org
Fri May 8 04:59:52 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Nico Weber (nico)

<details>
<summary>Changes</summary>

This way, clients including libc/shared/math.h don't need to `#pragma GCC diagnostic ignored "-Wshadow"` around the include.

This works locally after #<!-- -->196337 #<!-- -->196342 #<!-- -->196346 (…and can't land before all of those are in). In the meantime, red CI will (hopefully) prove that this will make CI find Wshadow violations :)

---
Full diff: https://github.com/llvm/llvm-project/pull/196519.diff


1 Files Affected:

- (modified) libc/cmake/modules/LLVMLibCCompileOptionRules.cmake (+1) 


``````````diff
diff --git a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
index 2d3703eefa0ac..db541a4dfb985 100644
--- a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
+++ b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
@@ -301,6 +301,7 @@ function(_get_common_compile_options output_var flags)
     if(NOT CMAKE_COMPILER_IS_GNUCXX)
       list(APPEND compile_options "-Wnewline-eof")
       list(APPEND compile_options "-Wnonportable-system-include-path")
+      list(APPEND compile_options "-Wshadow")
       list(APPEND compile_options "-Wstrict-prototypes")
       list(APPEND compile_options "-Wthread-safety")
       list(APPEND compile_options "-Wglobal-constructors")

``````````

</details>


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


More information about the libc-commits mailing list