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

via libc-commits libc-commits at lists.llvm.org
Mon Nov 6 14:32:07 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: None (michaelrj-google)

<details>
<summary>Changes</summary>

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.



---
Full diff: https://github.com/llvm/llvm-project/pull/71449.diff


1 Files Affected:

- (modified) libc/test/src/math/atanf_test.cpp (+3-4) 


``````````diff
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);

``````````

</details>


https://github.com/llvm/llvm-project/pull/71449


More information about the libc-commits mailing list