From ccc340316ab94ee5370bb25c299851f3ee50cc4a Mon Sep 17 00:00:00 2001 From: Alexey Samsonov Date: Wed, 10 Sep 2025 11:18:08 -0700 Subject: [libc] Clean up errno header usage in math tests. (#157898) This is one more follow-up to PR https://github.com/llvm/llvm-project/pull/157517 that cleans up the usage of libc_errno in math unit-tests (non-smoke). It follows the same rule: * if you use libc_errno in code literally, include src/__support/libc_errno.h * if you only rely on errno constants, include hdr/errno_macros.h Several tests for exp/log still retain the direct libc_errno usage, since in some cases they skip doing any validation if the error was raised. But the direct usage of libc_errno is removed from all other cases. --- libc/test/src/math/cosf_test.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'libc/test/src/math/cosf_test.cpp') diff --git a/libc/test/src/math/cosf_test.cpp b/libc/test/src/math/cosf_test.cpp index e2b444f87084..6afaa42e1f57 100644 --- a/libc/test/src/math/cosf_test.cpp +++ b/libc/test/src/math/cosf_test.cpp @@ -6,10 +6,10 @@ // //===----------------------------------------------------------------------===// +#include "hdr/errno_macros.h" #include "hdr/math_macros.h" #include "hdr/stdint_proxy.h" #include "src/__support/FPUtil/FPBits.h" -#include "src/__support/libc_errno.h" #include "src/math/cosf.h" #include "test/UnitTest/FPMatcher.h" #include "test/UnitTest/Test.h" @@ -22,8 +22,6 @@ using LlvmLibcCosfTest = LIBC_NAMESPACE::testing::FPTest; namespace mpfr = LIBC_NAMESPACE::testing::mpfr; TEST_F(LlvmLibcCosfTest, SpecialNumbers) { - libc_errno = 0; - EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::cosf(aNaN)); EXPECT_MATH_ERRNO(0); -- cgit v1.2.3