[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 11:57:46 PDT 2025
https://github.com/vinay-deshmukh updated https://github.com/llvm/llvm-project/pull/133643
>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 1/2] 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")
>From 555a99f80c490140e55354612950212be5218571 Mon Sep 17 00:00:00 2001
From: Vinay Deshmukh <32487576+vinay-deshmukh at users.noreply.github.com>
Date: Sun, 30 Mar 2025 14:57:24 -0400
Subject: [PATCH 2/2] unused
---
libc/test/UnitTest/LibcTest.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libc/test/UnitTest/LibcTest.h b/libc/test/UnitTest/LibcTest.h
index fbeafd0bacb75..b65271dd84b4a 100644
--- a/libc/test/UnitTest/LibcTest.h
+++ b/libc/test/UnitTest/LibcTest.h
@@ -81,7 +81,7 @@ struct Message {
// A trivial object to catch the Message, this enables custom logging and
// returning from the test function, see LIBC_TEST_SCAFFOLDING_ below.
struct Failure {
- void operator=(Message msg) {}
+ void operator=(Message /*msg*/) {}
};
struct RunContext {
More information about the libc-commits
mailing list