[libc-commits] [libc] 009ba77 - [libc][NFC] Remove libcpp include from atanf_test (#71449)

via libc-commits libc-commits at lists.llvm.org
Tue Nov 7 10:35:13 PST 2023


Author: michaelrj-google
Date: 2023-11-07T10:35:09-08:00
New Revision: 009ba779c46829005396ac8c3c6d3c0f17b21091

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

LOG: [libc][NFC] Remove libcpp include from atanf_test (#71449)

The test for atanf used <initializer_list> to simplify iterating through
an array. This caused issues with the new features.h change by creating
a
libcpp dependency in the test. This change moves the list to an array
variable, removing the need for that dependency.

Added: 
    

Modified: 
    libc/test/src/math/atanf_test.cpp

Removed: 
    


################################################################################
diff  --git a/libc/test/src/math/atanf_test.cpp b/libc/test/src/math/atanf_test.cpp
index cd4f7b89ee282e8..61d202e22bdc6f9 100644
--- a/libc/test/src/math/atanf_test.cpp
+++ b/libc/test/src/math/atanf_test.cpp
@@ -17,8 +17,6 @@
 #include <errno.h>
 #include <stdint.h>
 
-#include <initializer_list>
-
 using LlvmLibcAtanfTest = LIBC_NAMESPACE::testing::FPTest<float>;
 
 namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
@@ -55,8 +53,9 @@ TEST_F(LlvmLibcAtanfTest, InFloatRange) {
 
 // For small values, tanh(x) is x.
 TEST_F(LlvmLibcAtanfTest, SpecialValues) {
-  for (uint32_t v : {0x3d8d6b23U, 0x3feefcfbU, 0xbd8d6b23U, 0xbfeefcfbU,
-                     0x7F800000U, 0xFF800000U}) {
+  uint32_t val_arr[] = {0x3d8d6b23U, 0x3feefcfbU, 0xbd8d6b23U,
+                        0xbfeefcfbU, 0x7F800000U, 0xFF800000U};
+  for (uint32_t v : val_arr) {
     float x = float(FPBits(v));
     EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Atan, x,
                                    LIBC_NAMESPACE::atanf(x), 0.5);


        


More information about the libc-commits mailing list