[libc-commits] [libc] bc98834 - [libc][stdfix][NFC] Add header guards and update file headers in test headers (#239054)

via libc-commits libc-commits at lists.llvm.org
Sun Nov 8 08:14:00 PST 2026


Author: Jaeyong Lee
Date: 2026-11-08T11:13:54-05:00
New Revision: bc988348174b8e0b9ced0618a4c3413a4cf60ecc

URL: https://github.com/llvm/llvm-project/commit/bc988348174b8e0b9ced0618a4c3413a4cf60ecc
DIFF: https://github.com/llvm/llvm-project/commit/bc988348174b8e0b9ced0618a4c3413a4cf60ecc.diff

LOG: [libc][stdfix][NFC] Add header guards and update file headers in test headers (#239054)

Update the file headers of `libc/test/src/stdfix/*.h` to the latest LLVM
standard and add header guards.

Additionally fix a typo in `ExpTest.h`: `integer sqrt` -> `fixed-point
exp`.

Follows
https://github.com/llvm/llvm-project/pull/235602#issuecomment-6612292607.
Follows
https://github.com/llvm/llvm-project/pull/235602#discussion_r4458964901.

Added: 
    

Modified: 
    libc/test/src/stdfix/AbsTest.h
    libc/test/src/stdfix/BitsFxTest.h
    libc/test/src/stdfix/CountlsTest.h
    libc/test/src/stdfix/DiviFxTest.h
    libc/test/src/stdfix/ExpTest.h
    libc/test/src/stdfix/FxBitsTest.h
    libc/test/src/stdfix/FxDiviTest.h
    libc/test/src/stdfix/ISqrtTest.h
    libc/test/src/stdfix/IdivFxTest.h
    libc/test/src/stdfix/MuliFxTest.h
    libc/test/src/stdfix/RoundTest.h
    libc/test/src/stdfix/SqrtTest.h

Removed: 
    


################################################################################
diff  --git a/libc/test/src/stdfix/AbsTest.h b/libc/test/src/stdfix/AbsTest.h
index 3d23a475720c25..94a24d129ac2be 100644
--- a/libc/test/src/stdfix/AbsTest.h
+++ b/libc/test/src/stdfix/AbsTest.h
@@ -1,10 +1,18 @@
-//===-- Utility class to test fixed-point abs -------------------*- C++ -*-===//
+//===----------------------------------------------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
+///
+/// \file
+/// Utility class to test fixed-point abs.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_TEST_SRC_STDFIX_ABSTEST_H
+#define LLVM_LIBC_TEST_SRC_STDFIX_ABSTEST_H
 
 #include "test/UnitTest/Test.h"
 
@@ -35,3 +43,5 @@ template <typename T> class AbsTest : public LIBC_NAMESPACE::testing::Test {
   using LlvmLibcAbsTest = AbsTest<T>;                                          \
   TEST_F(LlvmLibcAbsTest, SpecialNumbers) { testSpecialNumbers(&func); }       \
   static_assert(true, "Require semicolon.")
+
+#endif // LLVM_LIBC_TEST_SRC_STDFIX_ABSTEST_H

diff  --git a/libc/test/src/stdfix/BitsFxTest.h b/libc/test/src/stdfix/BitsFxTest.h
index cdb363f07053b7..0bd6ba01b39d57 100644
--- a/libc/test/src/stdfix/BitsFxTest.h
+++ b/libc/test/src/stdfix/BitsFxTest.h
@@ -1,10 +1,18 @@
-//===-- Utility class to test bitsfx functions ------------------*- C++ -*-===//
+//===----------------------------------------------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
+///
+/// \file
+/// Utility class to test bitsfx functions.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_TEST_SRC_STDFIX_BITSFXTEST_H
+#define LLVM_LIBC_TEST_SRC_STDFIX_BITSFXTEST_H
 
 #include "test/UnitTest/Test.h"
 
@@ -81,3 +89,5 @@ class BitsFxTest : public LIBC_NAMESPACE::testing::Test {
     testSpecialNumbers(&func);                                                 \
   }                                                                            \
   static_assert(true, "Require semicolon.")
+
+#endif // LLVM_LIBC_TEST_SRC_STDFIX_BITSFXTEST_H

diff  --git a/libc/test/src/stdfix/CountlsTest.h b/libc/test/src/stdfix/CountlsTest.h
index a8201acb455b52..455b7e511096ef 100644
--- a/libc/test/src/stdfix/CountlsTest.h
+++ b/libc/test/src/stdfix/CountlsTest.h
@@ -1,10 +1,18 @@
-//===-- Utility class to test countls -------------------*- C++ -*-===//
+//===----------------------------------------------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
+///
+/// \file
+/// Utility class to test countls.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_TEST_SRC_STDFIX_COUNTLSTEST_H
+#define LLVM_LIBC_TEST_SRC_STDFIX_COUNTLSTEST_H
 
 #include "test/UnitTest/Test.h"
 
@@ -56,3 +64,5 @@ template <typename T> class CountlsTest : public LIBC_NAMESPACE::testing::Test {
   using LlvmLibcCountlsTest = CountlsTest<T>;                                  \
   TEST_F(LlvmLibcCountlsTest, SpecialNumbers) { testSpecialNumbers(&func); }   \
   static_assert(true, "Require semicolon.")
+
+#endif // LLVM_LIBC_TEST_SRC_STDFIX_COUNTLSTEST_H

diff  --git a/libc/test/src/stdfix/DiviFxTest.h b/libc/test/src/stdfix/DiviFxTest.h
index c74285692e1083..2a1674de256770 100644
--- a/libc/test/src/stdfix/DiviFxTest.h
+++ b/libc/test/src/stdfix/DiviFxTest.h
@@ -1,10 +1,18 @@
-//===-- Utility class to test divifx functions ------------------*- C++ -*-===//
+//===----------------------------------------------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
+///
+/// \file
+/// Utility class to test divifx functions.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_TEST_SRC_STDFIX_DIVIFXTEST_H
+#define LLVM_LIBC_TEST_SRC_STDFIX_DIVIFXTEST_H
 
 #include "test/UnitTest/Test.h"
 
@@ -176,3 +184,5 @@ class DiviFxTest : public LIBC_NAMESPACE::testing::Test {
   TEST_F(LlvmLibcDivi##Name##Test, EdgeCases) { testEdgeCases(&func); }        \
   static_assert(true, "Require semicolon.")
 #endif // LIBC_ADD_NULL_CHECKS
+
+#endif // LLVM_LIBC_TEST_SRC_STDFIX_DIVIFXTEST_H

diff  --git a/libc/test/src/stdfix/ExpTest.h b/libc/test/src/stdfix/ExpTest.h
index e588cebf621b90..3513c8583caf7a 100644
--- a/libc/test/src/stdfix/ExpTest.h
+++ b/libc/test/src/stdfix/ExpTest.h
@@ -1,10 +1,18 @@
-//===-- Utility class to test integer sqrt ----------------------*- C++ -*-===//
+//===----------------------------------------------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
+///
+/// \file
+/// Utility class to test fixed-point exp.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_TEST_SRC_STDFIX_EXPTEST_H
+#define LLVM_LIBC_TEST_SRC_STDFIX_EXPTEST_H
 
 #include "test/UnitTest/FPMatcher.h"
 #include "test/UnitTest/Test.h"
@@ -75,3 +83,5 @@ template <typename T> class ExpTest : public LIBC_NAMESPACE::testing::Test {
     test_negative_range(&func);                                                \
   }                                                                            \
   static_assert(true, "Require semicolon.")
+
+#endif // LLVM_LIBC_TEST_SRC_STDFIX_EXPTEST_H

diff  --git a/libc/test/src/stdfix/FxBitsTest.h b/libc/test/src/stdfix/FxBitsTest.h
index 18dacadf08b033..78a42c1d05ff3c 100644
--- a/libc/test/src/stdfix/FxBitsTest.h
+++ b/libc/test/src/stdfix/FxBitsTest.h
@@ -1,10 +1,18 @@
-//===-- Utility class to test int to fixed point conversions ----*- C++ -*-===//
+//===----------------------------------------------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
+///
+/// \file
+/// Utility class to test int to fixed point conversions.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_TEST_SRC_STDFIX_FXBITSTEST_H
+#define LLVM_LIBC_TEST_SRC_STDFIX_FXBITSTEST_H
 
 #include "test/UnitTest/Test.h"
 
@@ -52,3 +60,5 @@ class FxBitsTest : public LIBC_NAMESPACE::testing::Test {
     test_special_numbers(&func);                                               \
   }                                                                            \
   static_assert(true, "Require semicolon.")
+
+#endif // LLVM_LIBC_TEST_SRC_STDFIX_FXBITSTEST_H

diff  --git a/libc/test/src/stdfix/FxDiviTest.h b/libc/test/src/stdfix/FxDiviTest.h
index 4ff14c41b621d0..960ec341626e42 100644
--- a/libc/test/src/stdfix/FxDiviTest.h
+++ b/libc/test/src/stdfix/FxDiviTest.h
@@ -1,10 +1,18 @@
-//===-- Utility class to test fxdivi functions ------------------*- C++ -*-===//
+//===----------------------------------------------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
+///
+/// \file
+/// Utility class to test fxdivi functions.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_TEST_SRC_STDFIX_FXDIVITEST_H
+#define LLVM_LIBC_TEST_SRC_STDFIX_FXDIVITEST_H
 
 #include "src/__support/CPP/type_traits/conditional.h"
 #include "test/UnitTest/Test.h"
@@ -250,3 +258,5 @@ class FxDiviTest : public LIBC_NAMESPACE::testing::Test {
   }                                                                            \
   static_assert(true, "Require semicolon.")
 #endif // LIBC_ADD_NULL_CHECKS
+
+#endif // LLVM_LIBC_TEST_SRC_STDFIX_FXDIVITEST_H

diff  --git a/libc/test/src/stdfix/ISqrtTest.h b/libc/test/src/stdfix/ISqrtTest.h
index 692488b383551c..a789f2d766dabc 100644
--- a/libc/test/src/stdfix/ISqrtTest.h
+++ b/libc/test/src/stdfix/ISqrtTest.h
@@ -1,10 +1,18 @@
-//===-- Utility class to test integer sqrt ----------------------*- C++ -*-===//
+//===----------------------------------------------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
+///
+/// \file
+/// Utility class to test integer sqrt.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_TEST_SRC_STDFIX_ISQRTTEST_H
+#define LLVM_LIBC_TEST_SRC_STDFIX_ISQRTTEST_H
 
 #include "test/UnitTest/FPMatcher.h"
 #include "test/UnitTest/Test.h"
@@ -67,3 +75,5 @@ template <typename T> class ISqrtTest : public LIBC_NAMESPACE::testing::Test {
     testSpecialNumbers(&func);                                                 \
   }                                                                            \
   static_assert(true, "Require semicolon.")
+
+#endif // LLVM_LIBC_TEST_SRC_STDFIX_ISQRTTEST_H

diff  --git a/libc/test/src/stdfix/IdivFxTest.h b/libc/test/src/stdfix/IdivFxTest.h
index 883669f0bf1c75..14abf75d846d40 100644
--- a/libc/test/src/stdfix/IdivFxTest.h
+++ b/libc/test/src/stdfix/IdivFxTest.h
@@ -1,10 +1,18 @@
-//===-- Utility class to test idivfx functions ------------------*- C++ -*-===//
+//===----------------------------------------------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
+///
+/// \file
+/// Utility class to test idivfx functions.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_TEST_SRC_STDFIX_IDIVFXTEST_H
+#define LLVM_LIBC_TEST_SRC_STDFIX_IDIVFXTEST_H
 
 #include "test/UnitTest/Test.h"
 
@@ -89,3 +97,5 @@ class IdivFxTest : public LIBC_NAMESPACE::testing::Test {
   }                                                                            \
   static_assert(true, "Require semicolon.")
 #endif // LIBC_ADD_NULL_CHECKS
+
+#endif // LLVM_LIBC_TEST_SRC_STDFIX_IDIVFXTEST_H

diff  --git a/libc/test/src/stdfix/MuliFxTest.h b/libc/test/src/stdfix/MuliFxTest.h
index 97dfc7ce112206..8e6cd20871b30e 100644
--- a/libc/test/src/stdfix/MuliFxTest.h
+++ b/libc/test/src/stdfix/MuliFxTest.h
@@ -11,6 +11,9 @@
 ///
 //===----------------------------------------------------------------------===//
 
+#ifndef LLVM_LIBC_TEST_SRC_STDFIX_MULIFXTEST_H
+#define LLVM_LIBC_TEST_SRC_STDFIX_MULIFXTEST_H
+
 #include "test/UnitTest/Test.h"
 
 #include "llvm-libc-macros/stdfix-macros.h"
@@ -158,3 +161,5 @@ class MuliFxTest : public LIBC_NAMESPACE::testing::Test {
   TEST_F(LlvmLibcMuli##Name##Test, BasicNumbers) { testBasicNumbers(&func); }  \
   TEST_F(LlvmLibcMuli##Name##Test, EdgeCases) { testEdgeCases(&func); }        \
   static_assert(true, "Require semicolon.")
+
+#endif // LLVM_LIBC_TEST_SRC_STDFIX_MULIFXTEST_H

diff  --git a/libc/test/src/stdfix/RoundTest.h b/libc/test/src/stdfix/RoundTest.h
index d3ae04db9749ba..92dbb1f53fcb12 100644
--- a/libc/test/src/stdfix/RoundTest.h
+++ b/libc/test/src/stdfix/RoundTest.h
@@ -1,10 +1,18 @@
-//===-- Utility class to test fixed-point round -----------------*- C++ -*-===//
+//===----------------------------------------------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
+///
+/// \file
+/// Utility class to test fixed-point round.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_TEST_SRC_STDFIX_ROUNDTEST_H
+#define LLVM_LIBC_TEST_SRC_STDFIX_ROUNDTEST_H
 
 #include "test/UnitTest/Test.h"
 
@@ -63,3 +71,5 @@ template <typename T> class RoundTest : public LIBC_NAMESPACE::testing::Test {
   using LlvmLibcRoundTest = RoundTest<T>;                                      \
   TEST_F(LlvmLibcRoundTest, SpecialNumbers) { testSpecialNumbers(&func); }     \
   static_assert(true, "Require semicolon.")
+
+#endif // LLVM_LIBC_TEST_SRC_STDFIX_ROUNDTEST_H

diff  --git a/libc/test/src/stdfix/SqrtTest.h b/libc/test/src/stdfix/SqrtTest.h
index 2a8a825abb460c..403da988c4bee8 100644
--- a/libc/test/src/stdfix/SqrtTest.h
+++ b/libc/test/src/stdfix/SqrtTest.h
@@ -1,10 +1,18 @@
-//===-- Utility class to test fixed-point sqrt ------------------*- C++ -*-===//
+//===----------------------------------------------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
+///
+/// \file
+/// Utility class to test fixed-point sqrt.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_TEST_SRC_STDFIX_SQRTTEST_H
+#define LLVM_LIBC_TEST_SRC_STDFIX_SQRTTEST_H
 
 #include "test/UnitTest/Test.h"
 
@@ -65,3 +73,5 @@ template <typename T> class SqrtTest : public LIBC_NAMESPACE::testing::Test {
   using LlvmLibcSqrtTest = SqrtTest<T>;                                        \
   TEST_F(LlvmLibcSqrtTest, SpecialNumbers) { testSpecialNumbers(&func); }      \
   static_assert(true, "Require semicolon.")
+
+#endif // LLVM_LIBC_TEST_SRC_STDFIX_SQRTTEST_H


        


More information about the libc-commits mailing list