[libc-commits] [libc] [libc]: Add -Wextra for libc tests (PR #133643)

Vinay Deshmukh via libc-commits libc-commits at lists.llvm.org
Sun Mar 30 10:16:02 PDT 2025


https://github.com/vinay-deshmukh created https://github.com/llvm/llvm-project/pull/133643

* Relates to: https://github.com/llvm/llvm-project/issues/119281

>From ef115eeb591c6a5915d878b6a233224f3e0b1e14 Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <32487576+vinay-deshmukh at users.noreply.github.com>
Date: Sun, 30 Mar 2025 13:15:10 -0400
Subject: [PATCH] Wextra

---
 libc/CMakeLists.txt                        | 1 +
 libc/cmake/modules/LLVMLibCTestRules.cmake | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index b264dcb4974c7..0bfb7b8aad20d 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -34,6 +34,7 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
   add_definitions("-D_DEBUG")
 endif()
 
+add_compile_options("-Werror=extra")
 
 # Default to C++17
 set(CMAKE_CXX_STANDARD 17)
diff --git a/libc/cmake/modules/LLVMLibCTestRules.cmake b/libc/cmake/modules/LLVMLibCTestRules.cmake
index 0f0d612d04ba5..99386e89847ea 100644
--- a/libc/cmake/modules/LLVMLibCTestRules.cmake
+++ b/libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -31,7 +31,7 @@ function(_get_common_test_compile_options output_var c_test flags)
     endif()
 
     # list(APPEND compile_options "-Wall")
-    # list(APPEND compile_options "-Wextra")
+    list(APPEND compile_options "-Wextra")
     # -DLIBC_WNO_ERROR=ON if you can't build cleanly with -Werror.
     if(NOT LIBC_WNO_ERROR)
       # list(APPEND compile_options "-Werror")



More information about the libc-commits mailing list