[libc-commits] [libc] [libc] fix -Wextra-semi (PR #123783)

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


https://github.com/nickdesaulniers created https://github.com/llvm/llvm-project/pull/123783

Found while trying to consolidate our command line flags between tests and
underlying object files.

    error: extra ';' after member function definition [-Werror,-Wextra-semi]

Link: #119281


>From d23c594038703c213954b9c4b0439d58b68c08b7 Mon Sep 17 00:00:00 2001
From: Nick Desaulniers <ndesaulniers at google.com>
Date: Tue, 21 Jan 2025 09:07:34 -0800
Subject: [PATCH] [libc] fix -Wextra-semi

Found while trying to consolidate our command line flags between tests and
underlying object files.

    error: extra ';' after member function definition [-Werror,-Wextra-semi]

Link: #119281
---
 libc/cmake/modules/LLVMLibCTestRules.cmake | 2 +-
 libc/test/src/math/smoke/nan_test.cpp      | 2 +-
 libc/test/src/math/smoke/nanf128_test.cpp  | 2 +-
 libc/test/src/math/smoke/nanf16_test.cpp   | 2 +-
 libc/test/src/math/smoke/nanf_test.cpp     | 2 +-
 libc/test/src/math/smoke/nanl_test.cpp     | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/libc/cmake/modules/LLVMLibCTestRules.cmake b/libc/cmake/modules/LLVMLibCTestRules.cmake
index 4dbe5e046cc686..96fa6c3a707e47 100644
--- a/libc/cmake/modules/LLVMLibCTestRules.cmake
+++ b/libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -35,7 +35,7 @@ function(_get_common_test_compile_options output_var c_test flags)
     # list(APPEND compile_options "-Wno-sign-conversion")
     # list(APPEND compile_options "-Wimplicit-fallthrough")
     # list(APPEND compile_options "-Wwrite-strings")
-    # list(APPEND compile_options "-Wextra-semi")
+    list(APPEND compile_options "-Wextra-semi")
     # Silence this warning because _Complex is a part of C99.
     if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
       if(NOT c_test)
diff --git a/libc/test/src/math/smoke/nan_test.cpp b/libc/test/src/math/smoke/nan_test.cpp
index 46b9e9aa9563ab..da6beb94c7f05d 100644
--- a/libc/test/src/math/smoke/nan_test.cpp
+++ b/libc/test/src/math/smoke/nan_test.cpp
@@ -23,7 +23,7 @@ class LlvmLibcNanTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {
     auto actual_fp = LIBC_NAMESPACE::fputil::FPBits<double>(result);
     auto expected_fp = LIBC_NAMESPACE::fputil::FPBits<double>(bits);
     EXPECT_EQ(actual_fp.uintval(), expected_fp.uintval());
-  };
+  }
 };
 
 TEST_F(LlvmLibcNanTest, NCharSeq) {
diff --git a/libc/test/src/math/smoke/nanf128_test.cpp b/libc/test/src/math/smoke/nanf128_test.cpp
index 25dd2ef1d5b1ca..dd1986f17b9785 100644
--- a/libc/test/src/math/smoke/nanf128_test.cpp
+++ b/libc/test/src/math/smoke/nanf128_test.cpp
@@ -28,7 +28,7 @@ class LlvmLibcNanf128Test : public LIBC_NAMESPACE::testing::FEnvSafeTest {
     auto actual_fp = FPBits128(result);
     auto expected_fp = FPBits128(bits);
     EXPECT_EQ(actual_fp.uintval(), expected_fp.uintval());
-  };
+  }
 };
 
 TEST_F(LlvmLibcNanf128Test, NCharSeq) {
diff --git a/libc/test/src/math/smoke/nanf16_test.cpp b/libc/test/src/math/smoke/nanf16_test.cpp
index ec640a3b9eef92..5fafb1a36e4cdc 100644
--- a/libc/test/src/math/smoke/nanf16_test.cpp
+++ b/libc/test/src/math/smoke/nanf16_test.cpp
@@ -23,7 +23,7 @@ class LlvmLibcNanf16Test : public LIBC_NAMESPACE::testing::FEnvSafeTest {
     auto actual_fp = LIBC_NAMESPACE::fputil::FPBits<float16>(result);
     auto expected_fp = LIBC_NAMESPACE::fputil::FPBits<float16>(bits);
     EXPECT_EQ(actual_fp.uintval(), expected_fp.uintval());
-  };
+  }
 };
 
 TEST_F(LlvmLibcNanf16Test, NCharSeq) {
diff --git a/libc/test/src/math/smoke/nanf_test.cpp b/libc/test/src/math/smoke/nanf_test.cpp
index dd3124ee9c5112..19d94b40b5ffbd 100644
--- a/libc/test/src/math/smoke/nanf_test.cpp
+++ b/libc/test/src/math/smoke/nanf_test.cpp
@@ -23,7 +23,7 @@ class LlvmLibcNanfTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {
     auto actual_fp = LIBC_NAMESPACE::fputil::FPBits<float>(result);
     auto expected_fp = LIBC_NAMESPACE::fputil::FPBits<float>(bits);
     EXPECT_EQ(actual_fp.uintval(), expected_fp.uintval());
-  };
+  }
 };
 
 TEST_F(LlvmLibcNanfTest, NCharSeq) {
diff --git a/libc/test/src/math/smoke/nanl_test.cpp b/libc/test/src/math/smoke/nanl_test.cpp
index ef3f9c15dafd9f..c7217928e943b0 100644
--- a/libc/test/src/math/smoke/nanl_test.cpp
+++ b/libc/test/src/math/smoke/nanl_test.cpp
@@ -33,7 +33,7 @@ class LlvmLibcNanlTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {
     auto actual_fp = LIBC_NAMESPACE::fputil::FPBits<long double>(result);
     auto expected_fp = LIBC_NAMESPACE::fputil::FPBits<long double>(bits);
     EXPECT_EQ(actual_fp.uintval(), expected_fp.uintval());
-  };
+  }
 };
 
 TEST_F(LlvmLibcNanlTest, NCharSeq) {



More information about the libc-commits mailing list