[libc] [llvm] [libc] Remove direct math.h includes from src (PR #85324)
Michael Jones via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 14 15:17:49 PDT 2024
https://github.com/michaelrj-google created https://github.com/llvm/llvm-project/pull/85324
A downstream overlay mode user ran into issues with the isnan macro not
working in our sources with a specific libc configuration. This patch
replaces the last direct includes of math.h with our internal
math_macros.h, along with the necessary build system changes.
>From 9e78597a86a3b2aca8a8bea582b4200d9a1159d7 Mon Sep 17 00:00:00 2001
From: Michael Jones <michaelrj at google.com>
Date: Tue, 12 Mar 2024 16:12:22 -0700
Subject: [PATCH 1/3] [libc] Remove direct math.h includes from src
A downstream overlay mode user ran into issues with the isnan macro not
working in our sources with a specific libc configuration. This patch
replaces the last direct includes of math.h with our internal
math_macros.h, along with the necessary build system changes.
---
libc/src/__support/FPUtil/FEnvImpl.h | 2 +-
.../src/__support/FPUtil/ManipulationFunctions.h | 2 +-
.../__support/FPUtil/NearestIntegerOperations.h | 2 +-
libc/src/math/generic/math_utils.h | 2 +-
libc/test/src/math/ILogbTest.h | 2 +-
.../bazel/llvm-project-overlay/libc/BUILD.bazel | 16 +++++++++++++++-
.../libc/test/src/__support/BUILD.bazel | 1 +
.../libc/test/src/math/BUILD.bazel | 1 +
8 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/libc/src/__support/FPUtil/FEnvImpl.h b/libc/src/__support/FPUtil/FEnvImpl.h
index 6810659733de2c..4a84d1dc086c07 100644
--- a/libc/src/__support/FPUtil/FEnvImpl.h
+++ b/libc/src/__support/FPUtil/FEnvImpl.h
@@ -14,8 +14,8 @@
#include "src/__support/macros/properties/architectures.h"
#include "src/errno/libc_errno.h"
+#include "include/llvm-libc-macros/math-macros.h"
#include <fenv.h>
-#include <math.h>
#if defined(LIBC_TARGET_ARCH_IS_AARCH64)
#if defined(__APPLE__)
diff --git a/libc/src/__support/FPUtil/ManipulationFunctions.h b/libc/src/__support/FPUtil/ManipulationFunctions.h
index f148d984f5f35c..1aa1efcb4eb7dd 100644
--- a/libc/src/__support/FPUtil/ManipulationFunctions.h
+++ b/libc/src/__support/FPUtil/ManipulationFunctions.h
@@ -22,7 +22,7 @@
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
-#include <math.h>
+#include "include/llvm-libc-macros/math-macros.h"
namespace LIBC_NAMESPACE {
namespace fputil {
diff --git a/libc/src/__support/FPUtil/NearestIntegerOperations.h b/libc/src/__support/FPUtil/NearestIntegerOperations.h
index 19ae75ea788912..da3d80ceb097e5 100644
--- a/libc/src/__support/FPUtil/NearestIntegerOperations.h
+++ b/libc/src/__support/FPUtil/NearestIntegerOperations.h
@@ -16,7 +16,7 @@
#include "src/__support/CPP/type_traits.h"
#include "src/__support/common.h"
-#include <math.h>
+#include "include/llvm-libc-macros/math-macros.h"
namespace LIBC_NAMESPACE {
namespace fputil {
diff --git a/libc/src/math/generic/math_utils.h b/libc/src/math/generic/math_utils.h
index e884fe2deae284..396a70d7713b2c 100644
--- a/libc/src/math/generic/math_utils.h
+++ b/libc/src/math/generic/math_utils.h
@@ -14,7 +14,7 @@
#include "src/__support/common.h"
#include "src/errno/libc_errno.h"
-#include <math.h>
+#include "include/llvm-libc-macros/math-macros.h"
#include <stdint.h>
diff --git a/libc/test/src/math/ILogbTest.h b/libc/test/src/math/ILogbTest.h
index 3e2db33e2c0524..dcc9d554eb3c28 100644
--- a/libc/test/src/math/ILogbTest.h
+++ b/libc/test/src/math/ILogbTest.h
@@ -9,11 +9,11 @@
#ifndef LLVM_LIBC_TEST_SRC_MATH_ILOGBTEST_H
#define LLVM_LIBC_TEST_SRC_MATH_ILOGBTEST_H
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/CPP/limits.h" // INT_MAX
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
class LlvmLibcILogbTest : public LIBC_NAMESPACE::testing::Test {
public:
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index 5f6c43cd6af7c1..8fec108df3124a 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -62,7 +62,17 @@ config_setting(
flag_values = {":mpfr": "system"},
)
-############################## Support libraries #############################
+################################# Include Files ################################
+
+libc_support_library(
+ name = "internal_includes",
+ hdrs = glob([
+ "include/llvm-libc-macros/*.h",
+ "include/llvm-libc/types/*",
+ ]),
+)
+
+############################### Support libraries ##############################
libc_support_library(
name = "__support_macros_properties_architectures",
@@ -669,6 +679,7 @@ libc_support_library(
":__support_macros_properties_architectures",
":__support_macros_sanitizer",
":errno",
+ ":internal_includes",
],
)
@@ -738,6 +749,7 @@ libc_support_library(
":__support_fputil_normal_float",
":__support_macros_optimization",
":__support_uint128",
+ ":internal_includes",
],
)
@@ -751,6 +763,7 @@ libc_support_library(
":__support_fputil_fp_bits",
":__support_fputil_rounding_mode",
":__support_macros_attributes",
+ ":internal_includes",
],
)
@@ -1172,6 +1185,7 @@ libc_support_library(
"__support_cpp_type_traits",
":__support_common",
":errno",
+ ":internal_includes",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/__support/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/__support/BUILD.bazel
index 6837b9880d5a41..7c8ad71853e5e4 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/__support/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/__support/BUILD.bazel
@@ -64,6 +64,7 @@ libc_test(
name = "integer_to_string_test",
srcs = ["integer_to_string_test.cpp"],
deps = [
+ "//libc:__support_cpp_limits",
"//libc:__support_cpp_span",
"//libc:__support_cpp_string_view",
"//libc:__support_integer_literals",
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel
index 63e18b83710918..391b509854f998 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/math/BUILD.bazel
@@ -296,6 +296,7 @@ libc_support_library(
"//libc:__support_cpp_limits",
"//libc:__support_fputil_fp_bits",
"//libc:__support_fputil_manipulation_functions",
+ "//libc:internal_includes",
"//libc/test/UnitTest:LibcUnitTest",
],
)
>From 9cf73020a806bd6f783e8862b7e09c3038c1b9c8 Mon Sep 17 00:00:00 2001
From: Michael Jones <michaelrj at google.com>
Date: Wed, 13 Mar 2024 16:56:52 -0700
Subject: [PATCH 2/3] format includes
---
libc/src/__support/FPUtil/FEnvImpl.h | 3 +--
libc/src/__support/FPUtil/ManipulationFunctions.h | 3 +--
libc/src/__support/FPUtil/NearestIntegerOperations.h | 3 +--
libc/src/math/generic/math_utils.h | 3 +--
4 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/libc/src/__support/FPUtil/FEnvImpl.h b/libc/src/__support/FPUtil/FEnvImpl.h
index 4a84d1dc086c07..a6a533dcfdf4aa 100644
--- a/libc/src/__support/FPUtil/FEnvImpl.h
+++ b/libc/src/__support/FPUtil/FEnvImpl.h
@@ -9,12 +9,11 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_FPUTIL_FENVIMPL_H
#define LLVM_LIBC_SRC___SUPPORT_FPUTIL_FENVIMPL_H
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/macros/attributes.h" // LIBC_INLINE
#include "src/__support/macros/config.h" // LIBC_HAS_BUILTIN
#include "src/__support/macros/properties/architectures.h"
#include "src/errno/libc_errno.h"
-
-#include "include/llvm-libc-macros/math-macros.h"
#include <fenv.h>
#if defined(LIBC_TARGET_ARCH_IS_AARCH64)
diff --git a/libc/src/__support/FPUtil/ManipulationFunctions.h b/libc/src/__support/FPUtil/ManipulationFunctions.h
index 1aa1efcb4eb7dd..e9ca6dc33acc77 100644
--- a/libc/src/__support/FPUtil/ManipulationFunctions.h
+++ b/libc/src/__support/FPUtil/ManipulationFunctions.h
@@ -15,6 +15,7 @@
#include "dyadic_float.h"
#include "rounding_mode.h"
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/CPP/bit.h"
#include "src/__support/CPP/limits.h" // INT_MAX, INT_MIN
#include "src/__support/CPP/type_traits.h"
@@ -22,8 +23,6 @@
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
-#include "include/llvm-libc-macros/math-macros.h"
-
namespace LIBC_NAMESPACE {
namespace fputil {
diff --git a/libc/src/__support/FPUtil/NearestIntegerOperations.h b/libc/src/__support/FPUtil/NearestIntegerOperations.h
index da3d80ceb097e5..e890e38ba4ae7d 100644
--- a/libc/src/__support/FPUtil/NearestIntegerOperations.h
+++ b/libc/src/__support/FPUtil/NearestIntegerOperations.h
@@ -13,11 +13,10 @@
#include "FPBits.h"
#include "rounding_mode.h"
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/CPP/type_traits.h"
#include "src/__support/common.h"
-#include "include/llvm-libc-macros/math-macros.h"
-
namespace LIBC_NAMESPACE {
namespace fputil {
diff --git a/libc/src/math/generic/math_utils.h b/libc/src/math/generic/math_utils.h
index 396a70d7713b2c..cced761fc8c822 100644
--- a/libc/src/math/generic/math_utils.h
+++ b/libc/src/math/generic/math_utils.h
@@ -9,13 +9,12 @@
#ifndef LLVM_LIBC_SRC_MATH_GENERIC_MATH_UTILS_H
#define LLVM_LIBC_SRC_MATH_GENERIC_MATH_UTILS_H
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/CPP/bit.h"
#include "src/__support/CPP/type_traits.h"
#include "src/__support/common.h"
#include "src/errno/libc_errno.h"
-#include "include/llvm-libc-macros/math-macros.h"
-
#include <stdint.h>
// TODO: evaluate which functions from this file are actually used.
>From 5221512665af5e13827e150467d8ee6d65690c41 Mon Sep 17 00:00:00 2001
From: Michael Jones <michaelrj at google.com>
Date: Thu, 14 Mar 2024 15:16:48 -0700
Subject: [PATCH 3/3] update tests
---
libc/fuzzing/math/RemQuoDiff.h | 2 +-
libc/fuzzing/math/SingleInputSingleOutputDiff.h | 2 --
libc/fuzzing/math/TwoInputSingleOutputDiff.h | 2 --
libc/fuzzing/stdlib/strtofloat_fuzz.cpp | 2 +-
libc/test/UnitTest/FPMatcher.h | 2 +-
libc/test/src/__support/uint_test.cpp | 2 +-
libc/test/src/math/CMakeLists.txt | 2 ++
libc/test/src/math/CeilTest.h | 2 +-
libc/test/src/math/CopySignTest.h | 2 +-
libc/test/src/math/FAbsTest.h | 2 +-
libc/test/src/math/FDimTest.h | 2 +-
libc/test/src/math/FMaxTest.h | 2 +-
libc/test/src/math/FMinTest.h | 2 +-
libc/test/src/math/FModTest.h | 2 +-
libc/test/src/math/FloorTest.h | 2 +-
libc/test/src/math/FrexpTest.h | 2 +-
libc/test/src/math/HypotTest.h | 2 +-
libc/test/src/math/LdExpTest.h | 2 +-
libc/test/src/math/LogbTest.h | 2 +-
libc/test/src/math/ModfTest.h | 2 +-
libc/test/src/math/NextAfterTest.h | 2 +-
libc/test/src/math/RIntTest.h | 2 +-
libc/test/src/math/RemQuoTest.h | 2 +-
libc/test/src/math/RoundTest.h | 2 +-
libc/test/src/math/RoundToIntegerTest.h | 2 +-
libc/test/src/math/SqrtTest.h | 2 +-
libc/test/src/math/TruncTest.h | 2 +-
libc/test/src/math/acosf_test.cpp | 2 +-
libc/test/src/math/acoshf_test.cpp | 2 +-
libc/test/src/math/asinf_test.cpp | 2 +-
libc/test/src/math/asinhf_test.cpp | 2 +-
libc/test/src/math/atanf_test.cpp | 2 +-
libc/test/src/math/atanhf_test.cpp | 2 +-
libc/test/src/math/cos_test.cpp | 2 +-
libc/test/src/math/cosf_test.cpp | 2 +-
libc/test/src/math/coshf_test.cpp | 2 +-
libc/test/src/math/erff_test.cpp | 2 +-
.../src/math/exhaustive/fmod_generic_impl_test.cpp | 4 +++-
libc/test/src/math/exp10_test.cpp | 2 +-
libc/test/src/math/exp10f_test.cpp | 2 +-
libc/test/src/math/exp2_test.cpp | 2 +-
libc/test/src/math/exp2f_test.cpp | 2 +-
libc/test/src/math/exp_test.cpp | 2 +-
libc/test/src/math/expf_test.cpp | 2 +-
libc/test/src/math/explogxf_test.cpp | 10 ++++++----
libc/test/src/math/expm1_test.cpp | 2 +-
libc/test/src/math/expm1f_test.cpp | 2 +-
libc/test/src/math/fdim_test.cpp | 2 +-
libc/test/src/math/fdimf_test.cpp | 2 +-
libc/test/src/math/fdiml_test.cpp | 2 +-
libc/test/src/math/ilogb_test.cpp | 2 +-
libc/test/src/math/ilogbf_test.cpp | 2 +-
libc/test/src/math/ilogbl_test.cpp | 2 +-
libc/test/src/math/inv_trigf_utils_test.cpp | 2 +-
libc/test/src/math/log10_test.cpp | 2 +-
libc/test/src/math/log10f_test.cpp | 2 +-
libc/test/src/math/log1p_test.cpp | 2 +-
libc/test/src/math/log1pf_test.cpp | 2 +-
libc/test/src/math/log2_test.cpp | 2 +-
libc/test/src/math/log2f_test.cpp | 2 +-
libc/test/src/math/log_test.cpp | 2 +-
libc/test/src/math/logf_test.cpp | 2 +-
libc/test/src/math/powf_test.cpp | 2 +-
libc/test/src/math/sin_test.cpp | 2 +-
libc/test/src/math/sincosf_test.cpp | 2 +-
libc/test/src/math/sinf_test.cpp | 2 +-
libc/test/src/math/sinhf_test.cpp | 2 +-
libc/test/src/math/smoke/CeilTest.h | 2 +-
libc/test/src/math/smoke/CopySignTest.h | 2 +-
libc/test/src/math/smoke/FAbsTest.h | 2 +-
libc/test/src/math/smoke/FModTest.h | 2 +-
libc/test/src/math/smoke/FloorTest.h | 2 +-
libc/test/src/math/smoke/HypotTest.h | 2 +-
libc/test/src/math/smoke/ModfTest.h | 2 +-
libc/test/src/math/smoke/NextAfterTest.h | 2 +-
libc/test/src/math/smoke/NextTowardTest.h | 2 +-
libc/test/src/math/smoke/RIntTest.h | 2 +-
libc/test/src/math/smoke/RemQuoTest.h | 2 +-
libc/test/src/math/smoke/RoundTest.h | 2 +-
libc/test/src/math/smoke/RoundToIntegerTest.h | 2 +-
libc/test/src/math/smoke/SqrtTest.h | 2 +-
libc/test/src/math/smoke/TruncTest.h | 2 +-
libc/test/src/math/smoke/acosf_test.cpp | 2 +-
libc/test/src/math/smoke/acoshf_test.cpp | 2 +-
libc/test/src/math/smoke/asinf_test.cpp | 2 +-
libc/test/src/math/smoke/asinhf_test.cpp | 2 +-
libc/test/src/math/smoke/atanf_test.cpp | 2 +-
libc/test/src/math/smoke/atanhf_test.cpp | 2 +-
libc/test/src/math/smoke/cosf_test.cpp | 2 +-
libc/test/src/math/smoke/coshf_test.cpp | 2 +-
libc/test/src/math/smoke/erff_test.cpp | 2 +-
libc/test/src/math/smoke/exp10_test.cpp | 2 +-
libc/test/src/math/smoke/exp10f_test.cpp | 2 +-
libc/test/src/math/smoke/exp2_test.cpp | 2 +-
libc/test/src/math/smoke/exp2f_test.cpp | 2 +-
libc/test/src/math/smoke/exp_test.cpp | 2 +-
libc/test/src/math/smoke/expf_test.cpp | 2 +-
libc/test/src/math/smoke/expm1_test.cpp | 2 +-
libc/test/src/math/smoke/expm1f_test.cpp | 2 +-
libc/test/src/math/smoke/log10_test.cpp | 2 +-
libc/test/src/math/smoke/log10f_test.cpp | 2 +-
libc/test/src/math/smoke/log1p_test.cpp | 2 +-
libc/test/src/math/smoke/log1pf_test.cpp | 2 +-
libc/test/src/math/smoke/log2_test.cpp | 2 +-
libc/test/src/math/smoke/log2f_test.cpp | 2 +-
libc/test/src/math/smoke/log_test.cpp | 2 +-
libc/test/src/math/smoke/logf_test.cpp | 2 +-
libc/test/src/math/smoke/powf_test.cpp | 2 +-
libc/test/src/math/smoke/sincosf_test.cpp | 2 +-
libc/test/src/math/smoke/sinf_test.cpp | 2 +-
libc/test/src/math/smoke/sinhf_test.cpp | 2 +-
libc/test/src/math/smoke/tanf_test.cpp | 2 +-
libc/test/src/math/smoke/tanhf_test.cpp | 2 +-
libc/test/src/math/tan_test.cpp | 2 +-
libc/test/src/math/tanf_test.cpp | 2 +-
libc/test/src/math/tanhf_test.cpp | 2 +-
libc/test/utils/FPUtil/x86_long_double_test.cpp | 2 +-
libc/utils/MPFRWrapper/MPFRUtils.cpp | 2 +-
118 files changed, 124 insertions(+), 122 deletions(-)
diff --git a/libc/fuzzing/math/RemQuoDiff.h b/libc/fuzzing/math/RemQuoDiff.h
index 2a962249617673..95a9866f29dbbe 100644
--- a/libc/fuzzing/math/RemQuoDiff.h
+++ b/libc/fuzzing/math/RemQuoDiff.h
@@ -11,7 +11,7 @@
#include "src/__support/FPUtil/FPBits.h"
-#include <math.h>
+#include "include/llvm-libc-macros/math-macros.h"
#include <stddef.h>
#include <stdint.h>
diff --git a/libc/fuzzing/math/SingleInputSingleOutputDiff.h b/libc/fuzzing/math/SingleInputSingleOutputDiff.h
index 8c1e4b0d0290ed..bdf54ee9af6c4f 100644
--- a/libc/fuzzing/math/SingleInputSingleOutputDiff.h
+++ b/libc/fuzzing/math/SingleInputSingleOutputDiff.h
@@ -10,9 +10,7 @@
#define LLVM_LIBC_FUZZING_MATH_SINGLE_INPUT_SINGLE_OUTPUT_DIFF_H
#include "fuzzing/math/Compare.h"
-#include "src/__support/FPUtil/FPBits.h"
-#include <math.h>
#include <stddef.h>
#include <stdint.h>
diff --git a/libc/fuzzing/math/TwoInputSingleOutputDiff.h b/libc/fuzzing/math/TwoInputSingleOutputDiff.h
index e3e3fe703b139e..f017dbd63f4af5 100644
--- a/libc/fuzzing/math/TwoInputSingleOutputDiff.h
+++ b/libc/fuzzing/math/TwoInputSingleOutputDiff.h
@@ -10,9 +10,7 @@
#define LLVM_LIBC_FUZZING_MATH_TWO_INPUT_SINGLE_OUTPUT_DIFF_H
#include "fuzzing/math/Compare.h"
-#include "src/__support/FPUtil/FPBits.h"
-#include <math.h>
#include <stddef.h>
#include <stdint.h>
diff --git a/libc/fuzzing/stdlib/strtofloat_fuzz.cpp b/libc/fuzzing/stdlib/strtofloat_fuzz.cpp
index b773043bda67d8..b000321854d16d 100644
--- a/libc/fuzzing/stdlib/strtofloat_fuzz.cpp
+++ b/libc/fuzzing/stdlib/strtofloat_fuzz.cpp
@@ -16,7 +16,7 @@
#include "src/__support/FPUtil/FPBits.h"
-#include <math.h>
+#include "include/llvm-libc-macros/math-macros.h"
#include <stddef.h>
#include <stdint.h>
diff --git a/libc/test/UnitTest/FPMatcher.h b/libc/test/UnitTest/FPMatcher.h
index 4525b9e830195e..01a83c9a0f948f 100644
--- a/libc/test/UnitTest/FPMatcher.h
+++ b/libc/test/UnitTest/FPMatcher.h
@@ -17,7 +17,7 @@
#include "test/UnitTest/StringUtils.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
+#include "include/llvm-libc-macros/math-macros.h"
namespace LIBC_NAMESPACE {
namespace testing {
diff --git a/libc/test/src/__support/uint_test.cpp b/libc/test/src/__support/uint_test.cpp
index 851656e9fcbbb0..5764324ca28815 100644
--- a/libc/test/src/__support/uint_test.cpp
+++ b/libc/test/src/__support/uint_test.cpp
@@ -10,8 +10,8 @@
#include "src/__support/UInt.h"
#include "src/__support/macros/properties/types.h" // LIBC_TYPES_HAS_INT128
+#include "include/llvm-libc-macros/math-macros.h" // HUGE_VALF, HUGE_VALF
#include "test/UnitTest/Test.h"
-#include <math.h> // HUGE_VALF, HUGE_VALF
namespace LIBC_NAMESPACE {
diff --git a/libc/test/src/math/CMakeLists.txt b/libc/test/src/math/CMakeLists.txt
index b8a4aafcd97aa2..20d97666f50899 100644
--- a/libc/test/src/math/CMakeLists.txt
+++ b/libc/test/src/math/CMakeLists.txt
@@ -1503,6 +1503,8 @@ add_fp_unittest(
DEPENDS
libc.include.math
libc.src.math.generic.explogxf
+ libc.src.math.fabs
+ libc.src.math.fabsf
libc.src.__support.FPUtil.fp_bits
)
diff --git a/libc/test/src/math/CeilTest.h b/libc/test/src/math/CeilTest.h
index 5ea4f349d008b3..74cc90614dfc2a 100644
--- a/libc/test/src/math/CeilTest.h
+++ b/libc/test/src/math/CeilTest.h
@@ -10,7 +10,7 @@
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
+#include "include/llvm-libc-macros/math-macros.h"
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
diff --git a/libc/test/src/math/CopySignTest.h b/libc/test/src/math/CopySignTest.h
index 8b81e8d7de2523..206626d66f5806 100644
--- a/libc/test/src/math/CopySignTest.h
+++ b/libc/test/src/math/CopySignTest.h
@@ -10,7 +10,7 @@
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
+#include "include/llvm-libc-macros/math-macros.h"
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
diff --git a/libc/test/src/math/FAbsTest.h b/libc/test/src/math/FAbsTest.h
index 54f5f87e08e7e3..942991f23be1c6 100644
--- a/libc/test/src/math/FAbsTest.h
+++ b/libc/test/src/math/FAbsTest.h
@@ -13,7 +13,7 @@
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
+#include "include/llvm-libc-macros/math-macros.h"
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
diff --git a/libc/test/src/math/FDimTest.h b/libc/test/src/math/FDimTest.h
index e00b4fd5c42ec0..76f0f18bbc68d6 100644
--- a/libc/test/src/math/FDimTest.h
+++ b/libc/test/src/math/FDimTest.h
@@ -6,11 +6,11 @@
//
//===---------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/FPUtil/FPBits.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
template <typename T>
class FDimTestTemplate : public LIBC_NAMESPACE::testing::Test {
diff --git a/libc/test/src/math/FMaxTest.h b/libc/test/src/math/FMaxTest.h
index f8046f380f5fd5..2c7dc3dc13ec5a 100644
--- a/libc/test/src/math/FMaxTest.h
+++ b/libc/test/src/math/FMaxTest.h
@@ -13,7 +13,7 @@
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
+#include "include/llvm-libc-macros/math-macros.h"
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
diff --git a/libc/test/src/math/FMinTest.h b/libc/test/src/math/FMinTest.h
index 7a6534f320c92a..a986d5240d0da7 100644
--- a/libc/test/src/math/FMinTest.h
+++ b/libc/test/src/math/FMinTest.h
@@ -13,7 +13,7 @@
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
+#include "include/llvm-libc-macros/math-macros.h"
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
diff --git a/libc/test/src/math/FModTest.h b/libc/test/src/math/FModTest.h
index 2b1442923268d9..96ad299258a176 100644
--- a/libc/test/src/math/FModTest.h
+++ b/libc/test/src/math/FModTest.h
@@ -14,7 +14,7 @@
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
+#include "include/llvm-libc-macros/math-macros.h"
#define TEST_SPECIAL(x, y, expected, dom_err, expected_exception) \
EXPECT_FP_EQ(expected, f(x, y)); \
diff --git a/libc/test/src/math/FloorTest.h b/libc/test/src/math/FloorTest.h
index 66b37d69d7ba3d..21ae291e61bc7e 100644
--- a/libc/test/src/math/FloorTest.h
+++ b/libc/test/src/math/FloorTest.h
@@ -13,7 +13,7 @@
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
+#include "include/llvm-libc-macros/math-macros.h"
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
diff --git a/libc/test/src/math/FrexpTest.h b/libc/test/src/math/FrexpTest.h
index f3a64ce4aac31f..f971b45628f09f 100644
--- a/libc/test/src/math/FrexpTest.h
+++ b/libc/test/src/math/FrexpTest.h
@@ -11,7 +11,7 @@
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
+#include "include/llvm-libc-macros/math-macros.h"
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
diff --git a/libc/test/src/math/HypotTest.h b/libc/test/src/math/HypotTest.h
index 8f84024a6ee117..46fcc462a2793a 100644
--- a/libc/test/src/math/HypotTest.h
+++ b/libc/test/src/math/HypotTest.h
@@ -14,7 +14,7 @@
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
+#include "include/llvm-libc-macros/math-macros.h"
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
diff --git a/libc/test/src/math/LdExpTest.h b/libc/test/src/math/LdExpTest.h
index fe84b5f4c192a4..738135d6afe27e 100644
--- a/libc/test/src/math/LdExpTest.h
+++ b/libc/test/src/math/LdExpTest.h
@@ -15,7 +15,7 @@
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
+#include "include/llvm-libc-macros/math-macros.h"
#include <stdint.h>
template <typename T>
diff --git a/libc/test/src/math/LogbTest.h b/libc/test/src/math/LogbTest.h
index d64c5c44e4281a..3859b56582e5e4 100644
--- a/libc/test/src/math/LogbTest.h
+++ b/libc/test/src/math/LogbTest.h
@@ -11,7 +11,7 @@
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
+#include "include/llvm-libc-macros/math-macros.h"
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
diff --git a/libc/test/src/math/ModfTest.h b/libc/test/src/math/ModfTest.h
index a7e5e8810611b1..84e26db49695d5 100644
--- a/libc/test/src/math/ModfTest.h
+++ b/libc/test/src/math/ModfTest.h
@@ -12,7 +12,7 @@
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
+#include "include/llvm-libc-macros/math-macros.h"
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
diff --git a/libc/test/src/math/NextAfterTest.h b/libc/test/src/math/NextAfterTest.h
index 2f1450a16fd1e5..d45d819bfdb6cd 100644
--- a/libc/test/src/math/NextAfterTest.h
+++ b/libc/test/src/math/NextAfterTest.h
@@ -9,13 +9,13 @@
#ifndef LLVM_LIBC_TEST_SRC_MATH_NEXTAFTERTEST_H
#define LLVM_LIBC_TEST_SRC_MATH_NEXTAFTERTEST_H
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/CPP/bit.h"
#include "src/__support/CPP/type_traits.h"
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/FPUtil/FPBits.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
template <typename T>
class NextAfterTestTemplate : public LIBC_NAMESPACE::testing::Test {
diff --git a/libc/test/src/math/RIntTest.h b/libc/test/src/math/RIntTest.h
index 3b16b902bcf5d3..d392d4fb14a2e2 100644
--- a/libc/test/src/math/RIntTest.h
+++ b/libc/test/src/math/RIntTest.h
@@ -15,8 +15,8 @@
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
+#include "include/llvm-libc-macros/math-macros.h"
#include <fenv.h>
-#include <math.h>
#include <stdio.h>
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
diff --git a/libc/test/src/math/RemQuoTest.h b/libc/test/src/math/RemQuoTest.h
index 7b3011d23055d9..d61b97554199e7 100644
--- a/libc/test/src/math/RemQuoTest.h
+++ b/libc/test/src/math/RemQuoTest.h
@@ -9,12 +9,12 @@
#ifndef LLVM_LIBC_TEST_SRC_MATH_REMQUOTEST_H
#define LLVM_LIBC_TEST_SRC_MATH_REMQUOTEST_H
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/FPUtil/FPBits.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
diff --git a/libc/test/src/math/RoundTest.h b/libc/test/src/math/RoundTest.h
index b255ecc4fa84e8..17da00f869d3b3 100644
--- a/libc/test/src/math/RoundTest.h
+++ b/libc/test/src/math/RoundTest.h
@@ -13,7 +13,7 @@
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
+#include "include/llvm-libc-macros/math-macros.h"
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
diff --git a/libc/test/src/math/RoundToIntegerTest.h b/libc/test/src/math/RoundToIntegerTest.h
index 9bd4ba52f61ba8..017f5867fc8de7 100644
--- a/libc/test/src/math/RoundToIntegerTest.h
+++ b/libc/test/src/math/RoundToIntegerTest.h
@@ -15,8 +15,8 @@
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
+#include "include/llvm-libc-macros/math-macros.h"
#include <errno.h>
-#include <math.h>
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
diff --git a/libc/test/src/math/SqrtTest.h b/libc/test/src/math/SqrtTest.h
index 75eb411810f5ee..9811b2767ee337 100644
--- a/libc/test/src/math/SqrtTest.h
+++ b/libc/test/src/math/SqrtTest.h
@@ -11,7 +11,7 @@
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
+#include "include/llvm-libc-macros/math-macros.h"
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
diff --git a/libc/test/src/math/TruncTest.h b/libc/test/src/math/TruncTest.h
index 6d0ea1182ec11b..c3a89dbb837b52 100644
--- a/libc/test/src/math/TruncTest.h
+++ b/libc/test/src/math/TruncTest.h
@@ -13,7 +13,7 @@
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
+#include "include/llvm-libc-macros/math-macros.h"
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
diff --git a/libc/test/src/math/acosf_test.cpp b/libc/test/src/math/acosf_test.cpp
index c273184d58f3e6..6f8321bd7182ae 100644
--- a/libc/test/src/math/acosf_test.cpp
+++ b/libc/test/src/math/acosf_test.cpp
@@ -6,13 +6,13 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/acosf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/acoshf_test.cpp b/libc/test/src/math/acoshf_test.cpp
index a0e845b2b247ee..41d1166fb430db 100644
--- a/libc/test/src/math/acoshf_test.cpp
+++ b/libc/test/src/math/acoshf_test.cpp
@@ -6,13 +6,13 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/acoshf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/asinf_test.cpp b/libc/test/src/math/asinf_test.cpp
index a24fdcc36e140a..4e36f03f489551 100644
--- a/libc/test/src/math/asinf_test.cpp
+++ b/libc/test/src/math/asinf_test.cpp
@@ -7,13 +7,13 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/asinf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/asinhf_test.cpp b/libc/test/src/math/asinhf_test.cpp
index 3127861c9a1be5..9a3bfbed1068d8 100644
--- a/libc/test/src/math/asinhf_test.cpp
+++ b/libc/test/src/math/asinhf_test.cpp
@@ -6,13 +6,13 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/asinhf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/atanf_test.cpp b/libc/test/src/math/atanf_test.cpp
index 1fa7165805c7d1..fdd69d3dc7914f 100644
--- a/libc/test/src/math/atanf_test.cpp
+++ b/libc/test/src/math/atanf_test.cpp
@@ -6,13 +6,13 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/atanf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/atanhf_test.cpp b/libc/test/src/math/atanhf_test.cpp
index 1b45436094da44..39c067f3e764c2 100644
--- a/libc/test/src/math/atanhf_test.cpp
+++ b/libc/test/src/math/atanhf_test.cpp
@@ -6,13 +6,13 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/atanhf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/cos_test.cpp b/libc/test/src/math/cos_test.cpp
index 1f55e9e9a14959..6a1122997c51a2 100644
--- a/libc/test/src/math/cos_test.cpp
+++ b/libc/test/src/math/cos_test.cpp
@@ -11,7 +11,7 @@
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
+#include "include/llvm-libc-macros/math-macros.h"
using LlvmLibcCosTest = LIBC_NAMESPACE::testing::FPTest<double>;
diff --git a/libc/test/src/math/cosf_test.cpp b/libc/test/src/math/cosf_test.cpp
index 93ab06dc80b261..8a5eb17fdcea50 100644
--- a/libc/test/src/math/cosf_test.cpp
+++ b/libc/test/src/math/cosf_test.cpp
@@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/cosf.h"
@@ -13,7 +14,6 @@
#include "test/UnitTest/Test.h"
#include "test/src/math/sdcomp26094.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/coshf_test.cpp b/libc/test/src/math/coshf_test.cpp
index 3b8e14fb5f0342..8792f56b03461a 100644
--- a/libc/test/src/math/coshf_test.cpp
+++ b/libc/test/src/math/coshf_test.cpp
@@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/CPP/array.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
@@ -13,7 +14,6 @@
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/erff_test.cpp b/libc/test/src/math/erff_test.cpp
index 8ebde4ec24fb55..1e43c206aef0da 100644
--- a/libc/test/src/math/erff_test.cpp
+++ b/libc/test/src/math/erff_test.cpp
@@ -6,12 +6,12 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/math/erff.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/exhaustive/fmod_generic_impl_test.cpp b/libc/test/src/math/exhaustive/fmod_generic_impl_test.cpp
index 25a5e3898599ae..c9b20d3f2c0be8 100644
--- a/libc/test/src/math/exhaustive/fmod_generic_impl_test.cpp
+++ b/libc/test/src/math/exhaustive/fmod_generic_impl_test.cpp
@@ -12,6 +12,7 @@
#include "utils/MPFRWrapper/MPFRUtils.h"
#include <array>
+#include <cmath>
#include <limits>
namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
@@ -36,7 +37,8 @@ class LlvmLibcFModTest : public LIBC_NAMESPACE::testing::Test {
T(1.0) + std::numeric_limits<T>::epsilon(),
T(M_PI),
T(M_SQRT2),
- T(M_E)};
+ T(M_E),
+ };
public:
void testExtensive() {
diff --git a/libc/test/src/math/exp10_test.cpp b/libc/test/src/math/exp10_test.cpp
index d71b5a22303745..778189626a6179 100644
--- a/libc/test/src/math/exp10_test.cpp
+++ b/libc/test/src/math/exp10_test.cpp
@@ -6,13 +6,13 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/exp10.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/exp10f_test.cpp b/libc/test/src/math/exp10f_test.cpp
index 4e2d065f1292ab..9d44e8f65deccf 100644
--- a/libc/test/src/math/exp10f_test.cpp
+++ b/libc/test/src/math/exp10f_test.cpp
@@ -6,13 +6,13 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/exp10f.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
#include <stdint.h>
diff --git a/libc/test/src/math/exp2_test.cpp b/libc/test/src/math/exp2_test.cpp
index 2f9d7b3a2a6c90..845fda5451d4b7 100644
--- a/libc/test/src/math/exp2_test.cpp
+++ b/libc/test/src/math/exp2_test.cpp
@@ -6,13 +6,13 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/exp2.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/exp2f_test.cpp b/libc/test/src/math/exp2f_test.cpp
index f5ea8554be5c0f..f63f091eab9a83 100644
--- a/libc/test/src/math/exp2f_test.cpp
+++ b/libc/test/src/math/exp2f_test.cpp
@@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA
#include "src/errno/libc_errno.h"
@@ -13,7 +14,6 @@
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
#include <stdint.h>
diff --git a/libc/test/src/math/exp_test.cpp b/libc/test/src/math/exp_test.cpp
index 006db00b91949e..42018e608ae45b 100644
--- a/libc/test/src/math/exp_test.cpp
+++ b/libc/test/src/math/exp_test.cpp
@@ -6,13 +6,13 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/exp.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/expf_test.cpp b/libc/test/src/math/expf_test.cpp
index ffd9da500488b1..634958bdc43e56 100644
--- a/libc/test/src/math/expf_test.cpp
+++ b/libc/test/src/math/expf_test.cpp
@@ -6,13 +6,13 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/expf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
#include <stdint.h>
diff --git a/libc/test/src/math/explogxf_test.cpp b/libc/test/src/math/explogxf_test.cpp
index 24f9f3c0f8e45e..a536a9f3ab8dea 100644
--- a/libc/test/src/math/explogxf_test.cpp
+++ b/libc/test/src/math/explogxf_test.cpp
@@ -7,12 +7,14 @@
//===----------------------------------------------------------------------===//
#include "in_float_range_test_helper.h"
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
+#include "src/math/fabs.h"
+#include "src/math/fabsf.h"
#include "src/math/generic/explogxf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
using LlvmLibcExplogfTest = LIBC_NAMESPACE::testing::FPTest<float>;
@@ -22,7 +24,7 @@ constexpr int def_count = 100003;
constexpr float def_prec = 0.500001f;
auto f_normal = [](float x) -> bool {
- return !(isnan(x) || isinf(x) || fabs(x) < 2E-38);
+ return !(isnan(x) || isinf(x) || LIBC_NAMESPACE::fabs(x) < 2E-38);
};
TEST_F(LlvmLibcExplogfTest, ExpInFloatRange) {
@@ -32,8 +34,8 @@ TEST_F(LlvmLibcExplogfTest, ExpInFloatRange) {
return static_cast<float>(result.mh * r);
};
auto f_check = [](float x) -> bool {
- return !(
- (isnan(x) || isinf(x) || x < -70 || x > 70 || fabsf(x) < 0x1.0p-10));
+ return !((isnan(x) || isinf(x) || x < -70 || x > 70 ||
+ LIBC_NAMESPACE::fabsf(x) < 0x1.0p-10));
};
CHECK_DATA(0.0f, neg_inf, mpfr::Operation::Exp, fx, f_check, def_count,
def_prec);
diff --git a/libc/test/src/math/expm1_test.cpp b/libc/test/src/math/expm1_test.cpp
index ccc6e36095481f..198e6d5cdd8ab2 100644
--- a/libc/test/src/math/expm1_test.cpp
+++ b/libc/test/src/math/expm1_test.cpp
@@ -6,13 +6,13 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/expm1.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/expm1f_test.cpp b/libc/test/src/math/expm1f_test.cpp
index 94a9301f8eb222..c72815887ba8b3 100644
--- a/libc/test/src/math/expm1f_test.cpp
+++ b/libc/test/src/math/expm1f_test.cpp
@@ -6,13 +6,13 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/expm1f.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
#include <stdint.h>
diff --git a/libc/test/src/math/fdim_test.cpp b/libc/test/src/math/fdim_test.cpp
index 2f00a30ad1ee6f..6c0c3e204c5f9d 100644
--- a/libc/test/src/math/fdim_test.cpp
+++ b/libc/test/src/math/fdim_test.cpp
@@ -8,11 +8,11 @@
#include "FDimTest.h"
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/math/fdim.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
using LlvmLibcFDimTest = FDimTestTemplate<double>;
diff --git a/libc/test/src/math/fdimf_test.cpp b/libc/test/src/math/fdimf_test.cpp
index 27511baf25b6da..a74011b5a22498 100644
--- a/libc/test/src/math/fdimf_test.cpp
+++ b/libc/test/src/math/fdimf_test.cpp
@@ -8,11 +8,11 @@
#include "FDimTest.h"
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/math/fdimf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
using LlvmLibcFDimTest = FDimTestTemplate<float>;
diff --git a/libc/test/src/math/fdiml_test.cpp b/libc/test/src/math/fdiml_test.cpp
index 45aedb0a1cdea6..d3f2e68a7c1d79 100644
--- a/libc/test/src/math/fdiml_test.cpp
+++ b/libc/test/src/math/fdiml_test.cpp
@@ -8,11 +8,11 @@
#include "FDimTest.h"
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/math/fdiml.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
using LlvmLibcFDimTest = FDimTestTemplate<long double>;
diff --git a/libc/test/src/math/ilogb_test.cpp b/libc/test/src/math/ilogb_test.cpp
index 7011c43386e66a..45756ffa3d9a7c 100644
--- a/libc/test/src/math/ilogb_test.cpp
+++ b/libc/test/src/math/ilogb_test.cpp
@@ -8,12 +8,12 @@
#include "ILogbTest.h"
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/math/ilogb.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
TEST_F(LlvmLibcILogbTest, SpecialNumbers_ilogb) {
test_special_numbers<double>(&LIBC_NAMESPACE::ilogb);
diff --git a/libc/test/src/math/ilogbf_test.cpp b/libc/test/src/math/ilogbf_test.cpp
index dcff8eeb151805..ff19dd145a198d 100644
--- a/libc/test/src/math/ilogbf_test.cpp
+++ b/libc/test/src/math/ilogbf_test.cpp
@@ -8,12 +8,12 @@
#include "ILogbTest.h"
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/math/ilogbf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
TEST_F(LlvmLibcILogbTest, SpecialNumbers_ilogbf) {
test_special_numbers<float>(&LIBC_NAMESPACE::ilogbf);
diff --git a/libc/test/src/math/ilogbl_test.cpp b/libc/test/src/math/ilogbl_test.cpp
index 29a221ad7f08f7..b2c5246669946a 100644
--- a/libc/test/src/math/ilogbl_test.cpp
+++ b/libc/test/src/math/ilogbl_test.cpp
@@ -8,12 +8,12 @@
#include "ILogbTest.h"
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/math/ilogbl.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
TEST_F(LlvmLibcILogbTest, SpecialNumbers_ilogbl) {
test_special_numbers<long double>(&LIBC_NAMESPACE::ilogbl);
diff --git a/libc/test/src/math/inv_trigf_utils_test.cpp b/libc/test/src/math/inv_trigf_utils_test.cpp
index 23420edcd0ca1a..ebf21765b26d28 100644
--- a/libc/test/src/math/inv_trigf_utils_test.cpp
+++ b/libc/test/src/math/inv_trigf_utils_test.cpp
@@ -7,12 +7,12 @@
//===----------------------------------------------------------------------===//
#include "in_float_range_test_helper.h"
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/math/generic/inv_trigf_utils.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
using LlvmLibcAtanfTest = LIBC_NAMESPACE::testing::FPTest<float>;
diff --git a/libc/test/src/math/log10_test.cpp b/libc/test/src/math/log10_test.cpp
index ed4a24b9515951..dc4ac895546c43 100644
--- a/libc/test/src/math/log10_test.cpp
+++ b/libc/test/src/math/log10_test.cpp
@@ -6,13 +6,13 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/log10.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/log10f_test.cpp b/libc/test/src/math/log10f_test.cpp
index c38a5159682cfd..f8a137e44c351e 100644
--- a/libc/test/src/math/log10f_test.cpp
+++ b/libc/test/src/math/log10f_test.cpp
@@ -6,12 +6,12 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/math/log10f.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/log1p_test.cpp b/libc/test/src/math/log1p_test.cpp
index d769659356c941..975fb8e05c35ea 100644
--- a/libc/test/src/math/log1p_test.cpp
+++ b/libc/test/src/math/log1p_test.cpp
@@ -6,13 +6,13 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/log1p.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/log1pf_test.cpp b/libc/test/src/math/log1pf_test.cpp
index 2f6330ee6ce631..a1108fee48196f 100644
--- a/libc/test/src/math/log1pf_test.cpp
+++ b/libc/test/src/math/log1pf_test.cpp
@@ -6,13 +6,13 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/log1pf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/log2_test.cpp b/libc/test/src/math/log2_test.cpp
index f4ee0ff5185b47..8765279005798a 100644
--- a/libc/test/src/math/log2_test.cpp
+++ b/libc/test/src/math/log2_test.cpp
@@ -6,13 +6,13 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/log2.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/log2f_test.cpp b/libc/test/src/math/log2f_test.cpp
index d8b4808f5cda12..c05b6b93cff777 100644
--- a/libc/test/src/math/log2f_test.cpp
+++ b/libc/test/src/math/log2f_test.cpp
@@ -6,13 +6,13 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/log2f.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
#include <stdint.h>
diff --git a/libc/test/src/math/log_test.cpp b/libc/test/src/math/log_test.cpp
index b1f1ab775462b1..06a0dc574be518 100644
--- a/libc/test/src/math/log_test.cpp
+++ b/libc/test/src/math/log_test.cpp
@@ -6,13 +6,13 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/log.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/logf_test.cpp b/libc/test/src/math/logf_test.cpp
index 3ab67ba807823b..1ab480744ba596 100644
--- a/libc/test/src/math/logf_test.cpp
+++ b/libc/test/src/math/logf_test.cpp
@@ -6,12 +6,12 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/math/logf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
#include <stdint.h>
diff --git a/libc/test/src/math/powf_test.cpp b/libc/test/src/math/powf_test.cpp
index 3dffeb603499fe..cf674ecf8f99e7 100644
--- a/libc/test/src/math/powf_test.cpp
+++ b/libc/test/src/math/powf_test.cpp
@@ -6,12 +6,12 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/math/powf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/sin_test.cpp b/libc/test/src/math/sin_test.cpp
index 69981ed22ee69f..fa1c5370c30fbb 100644
--- a/libc/test/src/math/sin_test.cpp
+++ b/libc/test/src/math/sin_test.cpp
@@ -12,7 +12,7 @@
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
+#include "include/llvm-libc-macros/math-macros.h"
using LlvmLibcSinTest = LIBC_NAMESPACE::testing::FPTest<double>;
diff --git a/libc/test/src/math/sincosf_test.cpp b/libc/test/src/math/sincosf_test.cpp
index 2c0c7eaaa25f07..a7372fd53b319e 100644
--- a/libc/test/src/math/sincosf_test.cpp
+++ b/libc/test/src/math/sincosf_test.cpp
@@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/sincosf.h"
@@ -13,7 +14,6 @@
#include "test/UnitTest/Test.h"
#include "test/src/math/sdcomp26094.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/sinf_test.cpp b/libc/test/src/math/sinf_test.cpp
index 94c1114e688984..a3c5384e3e626f 100644
--- a/libc/test/src/math/sinf_test.cpp
+++ b/libc/test/src/math/sinf_test.cpp
@@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/sinf.h"
@@ -13,7 +14,6 @@
#include "test/UnitTest/Test.h"
#include "test/src/math/sdcomp26094.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/sinhf_test.cpp b/libc/test/src/math/sinhf_test.cpp
index f14150bb04420e..bea976055dbdff 100644
--- a/libc/test/src/math/sinhf_test.cpp
+++ b/libc/test/src/math/sinhf_test.cpp
@@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/CPP/array.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
@@ -13,7 +14,6 @@
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/smoke/CeilTest.h b/libc/test/src/math/smoke/CeilTest.h
index 5248dbca503701..ec70258fddec15 100644
--- a/libc/test/src/math/smoke/CeilTest.h
+++ b/libc/test/src/math/smoke/CeilTest.h
@@ -12,7 +12,7 @@
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
+#include "include/llvm-libc-macros/math-macros.h"
template <typename T> class CeilTest : public LIBC_NAMESPACE::testing::Test {
diff --git a/libc/test/src/math/smoke/CopySignTest.h b/libc/test/src/math/smoke/CopySignTest.h
index 9ee34338ba8073..70a6a419e0a030 100644
--- a/libc/test/src/math/smoke/CopySignTest.h
+++ b/libc/test/src/math/smoke/CopySignTest.h
@@ -12,7 +12,7 @@
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
+#include "include/llvm-libc-macros/math-macros.h"
template <typename T>
class CopySignTest : public LIBC_NAMESPACE::testing::Test {
diff --git a/libc/test/src/math/smoke/FAbsTest.h b/libc/test/src/math/smoke/FAbsTest.h
index cf05882e22f97d..9309c2ada4a11f 100644
--- a/libc/test/src/math/smoke/FAbsTest.h
+++ b/libc/test/src/math/smoke/FAbsTest.h
@@ -12,7 +12,7 @@
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
+#include "include/llvm-libc-macros/math-macros.h"
template <typename T> class FAbsTest : public LIBC_NAMESPACE::testing::Test {
diff --git a/libc/test/src/math/smoke/FModTest.h b/libc/test/src/math/smoke/FModTest.h
index 2b1442923268d9..96ad299258a176 100644
--- a/libc/test/src/math/smoke/FModTest.h
+++ b/libc/test/src/math/smoke/FModTest.h
@@ -14,7 +14,7 @@
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
+#include "include/llvm-libc-macros/math-macros.h"
#define TEST_SPECIAL(x, y, expected, dom_err, expected_exception) \
EXPECT_FP_EQ(expected, f(x, y)); \
diff --git a/libc/test/src/math/smoke/FloorTest.h b/libc/test/src/math/smoke/FloorTest.h
index 610f5c206ed3a0..8886e8e7518368 100644
--- a/libc/test/src/math/smoke/FloorTest.h
+++ b/libc/test/src/math/smoke/FloorTest.h
@@ -12,7 +12,7 @@
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
+#include "include/llvm-libc-macros/math-macros.h"
template <typename T> class FloorTest : public LIBC_NAMESPACE::testing::Test {
diff --git a/libc/test/src/math/smoke/HypotTest.h b/libc/test/src/math/smoke/HypotTest.h
index 619879188a3b31..43499267b71136 100644
--- a/libc/test/src/math/smoke/HypotTest.h
+++ b/libc/test/src/math/smoke/HypotTest.h
@@ -13,7 +13,7 @@
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
+#include "include/llvm-libc-macros/math-macros.h"
template <typename T>
class HypotTestTemplate : public LIBC_NAMESPACE::testing::Test {
diff --git a/libc/test/src/math/smoke/ModfTest.h b/libc/test/src/math/smoke/ModfTest.h
index d7e15a7ed68206..107963665b8357 100644
--- a/libc/test/src/math/smoke/ModfTest.h
+++ b/libc/test/src/math/smoke/ModfTest.h
@@ -11,7 +11,7 @@
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
+#include "include/llvm-libc-macros/math-macros.h"
template <typename T> class ModfTest : public LIBC_NAMESPACE::testing::Test {
diff --git a/libc/test/src/math/smoke/NextAfterTest.h b/libc/test/src/math/smoke/NextAfterTest.h
index dda86eeeb6e03c..23b3b15347407d 100644
--- a/libc/test/src/math/smoke/NextAfterTest.h
+++ b/libc/test/src/math/smoke/NextAfterTest.h
@@ -9,13 +9,13 @@
#ifndef LLVM_LIBC_TEST_SRC_MATH_NEXTAFTERTEST_H
#define LLVM_LIBC_TEST_SRC_MATH_NEXTAFTERTEST_H
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/CPP/bit.h"
#include "src/__support/CPP/type_traits.h"
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/FPUtil/FPBits.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
#define ASSERT_FP_EQ_WITH_EXCEPTION(result, expected, expected_exception) \
ASSERT_FP_EQ(result, expected); \
diff --git a/libc/test/src/math/smoke/NextTowardTest.h b/libc/test/src/math/smoke/NextTowardTest.h
index 42a9a56aeb0a72..caf98262c5d157 100644
--- a/libc/test/src/math/smoke/NextTowardTest.h
+++ b/libc/test/src/math/smoke/NextTowardTest.h
@@ -9,6 +9,7 @@
#ifndef LLVM_LIBC_TEST_SRC_MATH_NEXTTOWARDTEST_H
#define LLVM_LIBC_TEST_SRC_MATH_NEXTTOWARDTEST_H
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/CPP/bit.h"
#include "src/__support/CPP/type_traits.h"
#include "src/__support/FPUtil/BasicOperations.h"
@@ -16,7 +17,6 @@
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
#include <fenv.h>
-#include <math.h>
#define ASSERT_FP_EQ_WITH_EXCEPTION(result, expected, expected_exception) \
ASSERT_FP_EQ(result, expected); \
diff --git a/libc/test/src/math/smoke/RIntTest.h b/libc/test/src/math/smoke/RIntTest.h
index 4c90dffa39cb15..903fbe9ce34300 100644
--- a/libc/test/src/math/smoke/RIntTest.h
+++ b/libc/test/src/math/smoke/RIntTest.h
@@ -14,8 +14,8 @@
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
+#include "include/llvm-libc-macros/math-macros.h"
#include <fenv.h>
-#include <math.h>
#include <stdio.h>
static constexpr int ROUNDING_MODES[4] = {FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO,
diff --git a/libc/test/src/math/smoke/RemQuoTest.h b/libc/test/src/math/smoke/RemQuoTest.h
index 87551faeda9cf1..a9fa405b270001 100644
--- a/libc/test/src/math/smoke/RemQuoTest.h
+++ b/libc/test/src/math/smoke/RemQuoTest.h
@@ -9,11 +9,11 @@
#ifndef LLVM_LIBC_TEST_SRC_MATH_REMQUOTEST_H
#define LLVM_LIBC_TEST_SRC_MATH_REMQUOTEST_H
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/FPUtil/FPBits.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
template <typename T>
class RemQuoTestTemplate : public LIBC_NAMESPACE::testing::Test {
diff --git a/libc/test/src/math/smoke/RoundTest.h b/libc/test/src/math/smoke/RoundTest.h
index d2a5906b1e29ea..8cf96f4569034a 100644
--- a/libc/test/src/math/smoke/RoundTest.h
+++ b/libc/test/src/math/smoke/RoundTest.h
@@ -12,7 +12,7 @@
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
+#include "include/llvm-libc-macros/math-macros.h"
template <typename T> class RoundTest : public LIBC_NAMESPACE::testing::Test {
diff --git a/libc/test/src/math/smoke/RoundToIntegerTest.h b/libc/test/src/math/smoke/RoundToIntegerTest.h
index e86533ca09e178..1b5135d016cc41 100644
--- a/libc/test/src/math/smoke/RoundToIntegerTest.h
+++ b/libc/test/src/math/smoke/RoundToIntegerTest.h
@@ -14,8 +14,8 @@
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
+#include "include/llvm-libc-macros/math-macros.h"
#include <errno.h>
-#include <math.h>
static constexpr int ROUNDING_MODES[4] = {FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO,
FE_TONEAREST};
diff --git a/libc/test/src/math/smoke/SqrtTest.h b/libc/test/src/math/smoke/SqrtTest.h
index edb6e74236e316..eea5dc1534e0bb 100644
--- a/libc/test/src/math/smoke/SqrtTest.h
+++ b/libc/test/src/math/smoke/SqrtTest.h
@@ -10,7 +10,7 @@
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
+#include "include/llvm-libc-macros/math-macros.h"
template <typename T> class SqrtTest : public LIBC_NAMESPACE::testing::Test {
diff --git a/libc/test/src/math/smoke/TruncTest.h b/libc/test/src/math/smoke/TruncTest.h
index 71b1ab9df3f08b..5612d27fef21d8 100644
--- a/libc/test/src/math/smoke/TruncTest.h
+++ b/libc/test/src/math/smoke/TruncTest.h
@@ -12,7 +12,7 @@
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
+#include "include/llvm-libc-macros/math-macros.h"
template <typename T> class TruncTest : public LIBC_NAMESPACE::testing::Test {
diff --git a/libc/test/src/math/smoke/acosf_test.cpp b/libc/test/src/math/smoke/acosf_test.cpp
index 864c9ea4d3175d..573a2c39492f0c 100644
--- a/libc/test/src/math/smoke/acosf_test.cpp
+++ b/libc/test/src/math/smoke/acosf_test.cpp
@@ -6,12 +6,12 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/acosf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/smoke/acoshf_test.cpp b/libc/test/src/math/smoke/acoshf_test.cpp
index b3ba740c2024d3..f561f23eb99ad3 100644
--- a/libc/test/src/math/smoke/acoshf_test.cpp
+++ b/libc/test/src/math/smoke/acoshf_test.cpp
@@ -6,12 +6,12 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/acoshf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/smoke/asinf_test.cpp b/libc/test/src/math/smoke/asinf_test.cpp
index e6afb23a397fe1..39d25e72c143b9 100644
--- a/libc/test/src/math/smoke/asinf_test.cpp
+++ b/libc/test/src/math/smoke/asinf_test.cpp
@@ -6,12 +6,12 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/asinf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/smoke/asinhf_test.cpp b/libc/test/src/math/smoke/asinhf_test.cpp
index 7a520cdc050a22..9637bfa5394885 100644
--- a/libc/test/src/math/smoke/asinhf_test.cpp
+++ b/libc/test/src/math/smoke/asinhf_test.cpp
@@ -6,12 +6,12 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/asinhf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/smoke/atanf_test.cpp b/libc/test/src/math/smoke/atanf_test.cpp
index 8cc1b418f869c2..abd9835d38a057 100644
--- a/libc/test/src/math/smoke/atanf_test.cpp
+++ b/libc/test/src/math/smoke/atanf_test.cpp
@@ -6,12 +6,12 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/atanf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/smoke/atanhf_test.cpp b/libc/test/src/math/smoke/atanhf_test.cpp
index e1d6d2532d39e3..df0746e0c9c3aa 100644
--- a/libc/test/src/math/smoke/atanhf_test.cpp
+++ b/libc/test/src/math/smoke/atanhf_test.cpp
@@ -6,12 +6,12 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/atanhf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/smoke/cosf_test.cpp b/libc/test/src/math/smoke/cosf_test.cpp
index 539c428eadf113..62132990ed5473 100644
--- a/libc/test/src/math/smoke/cosf_test.cpp
+++ b/libc/test/src/math/smoke/cosf_test.cpp
@@ -6,12 +6,12 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/cosf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/smoke/coshf_test.cpp b/libc/test/src/math/smoke/coshf_test.cpp
index e38802f9364743..9d7ef505ae7497 100644
--- a/libc/test/src/math/smoke/coshf_test.cpp
+++ b/libc/test/src/math/smoke/coshf_test.cpp
@@ -6,13 +6,13 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/CPP/array.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/coshf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/smoke/erff_test.cpp b/libc/test/src/math/smoke/erff_test.cpp
index 843cc7f4c8c04d..24778f8d653add 100644
--- a/libc/test/src/math/smoke/erff_test.cpp
+++ b/libc/test/src/math/smoke/erff_test.cpp
@@ -6,11 +6,11 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/math/erff.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/smoke/exp10_test.cpp b/libc/test/src/math/smoke/exp10_test.cpp
index daa7b5b48842bc..fffffeb4c78abf 100644
--- a/libc/test/src/math/smoke/exp10_test.cpp
+++ b/libc/test/src/math/smoke/exp10_test.cpp
@@ -6,12 +6,12 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/exp10.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/smoke/exp10f_test.cpp b/libc/test/src/math/smoke/exp10f_test.cpp
index f6533e983dacd8..c0dcc125033248 100644
--- a/libc/test/src/math/smoke/exp10f_test.cpp
+++ b/libc/test/src/math/smoke/exp10f_test.cpp
@@ -6,12 +6,12 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/exp10f.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
#include <stdint.h>
diff --git a/libc/test/src/math/smoke/exp2_test.cpp b/libc/test/src/math/smoke/exp2_test.cpp
index 7bcc2a3cb6c742..d362d32f678b25 100644
--- a/libc/test/src/math/smoke/exp2_test.cpp
+++ b/libc/test/src/math/smoke/exp2_test.cpp
@@ -6,12 +6,12 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/exp2.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/smoke/exp2f_test.cpp b/libc/test/src/math/smoke/exp2f_test.cpp
index 7baab630a4cbc4..e2989a6ec4d8af 100644
--- a/libc/test/src/math/smoke/exp2f_test.cpp
+++ b/libc/test/src/math/smoke/exp2f_test.cpp
@@ -6,13 +6,13 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA
#include "src/errno/libc_errno.h"
#include "src/math/exp2f.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
#include <stdint.h>
diff --git a/libc/test/src/math/smoke/exp_test.cpp b/libc/test/src/math/smoke/exp_test.cpp
index 455cb2ea135328..a2becc74f526f9 100644
--- a/libc/test/src/math/smoke/exp_test.cpp
+++ b/libc/test/src/math/smoke/exp_test.cpp
@@ -6,12 +6,12 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/exp.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/smoke/expf_test.cpp b/libc/test/src/math/smoke/expf_test.cpp
index 2968704f83e355..42710c5fa404e9 100644
--- a/libc/test/src/math/smoke/expf_test.cpp
+++ b/libc/test/src/math/smoke/expf_test.cpp
@@ -6,12 +6,12 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/expf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
#include <stdint.h>
diff --git a/libc/test/src/math/smoke/expm1_test.cpp b/libc/test/src/math/smoke/expm1_test.cpp
index 4581060075e32c..07963ec2d34c8d 100644
--- a/libc/test/src/math/smoke/expm1_test.cpp
+++ b/libc/test/src/math/smoke/expm1_test.cpp
@@ -6,12 +6,12 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/expm1.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/smoke/expm1f_test.cpp b/libc/test/src/math/smoke/expm1f_test.cpp
index 4ef8d50ba551a7..82e0b154635044 100644
--- a/libc/test/src/math/smoke/expm1f_test.cpp
+++ b/libc/test/src/math/smoke/expm1f_test.cpp
@@ -6,12 +6,12 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/expm1f.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
#include <stdint.h>
diff --git a/libc/test/src/math/smoke/log10_test.cpp b/libc/test/src/math/smoke/log10_test.cpp
index c1658a3d5c9653..36d75341976482 100644
--- a/libc/test/src/math/smoke/log10_test.cpp
+++ b/libc/test/src/math/smoke/log10_test.cpp
@@ -6,12 +6,12 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/log10.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/smoke/log10f_test.cpp b/libc/test/src/math/smoke/log10f_test.cpp
index 53950233cabf5b..53e699417fb7c0 100644
--- a/libc/test/src/math/smoke/log10f_test.cpp
+++ b/libc/test/src/math/smoke/log10f_test.cpp
@@ -6,11 +6,11 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/math/log10f.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/smoke/log1p_test.cpp b/libc/test/src/math/smoke/log1p_test.cpp
index e1966c28397c08..5fe9c60f90abff 100644
--- a/libc/test/src/math/smoke/log1p_test.cpp
+++ b/libc/test/src/math/smoke/log1p_test.cpp
@@ -6,12 +6,12 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/log1p.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/smoke/log1pf_test.cpp b/libc/test/src/math/smoke/log1pf_test.cpp
index 377a46adef9c79..e2fb2f057d2eb7 100644
--- a/libc/test/src/math/smoke/log1pf_test.cpp
+++ b/libc/test/src/math/smoke/log1pf_test.cpp
@@ -6,12 +6,12 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/log1pf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/smoke/log2_test.cpp b/libc/test/src/math/smoke/log2_test.cpp
index 826c51eb8c1b09..fbeba9527bcb7b 100644
--- a/libc/test/src/math/smoke/log2_test.cpp
+++ b/libc/test/src/math/smoke/log2_test.cpp
@@ -6,12 +6,12 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/log2.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/smoke/log2f_test.cpp b/libc/test/src/math/smoke/log2f_test.cpp
index 2387ff59d70d9e..46906e78dcaf71 100644
--- a/libc/test/src/math/smoke/log2f_test.cpp
+++ b/libc/test/src/math/smoke/log2f_test.cpp
@@ -6,12 +6,12 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/log2f.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
#include <stdint.h>
diff --git a/libc/test/src/math/smoke/log_test.cpp b/libc/test/src/math/smoke/log_test.cpp
index 423b9d8bb818a7..b1e39059948001 100644
--- a/libc/test/src/math/smoke/log_test.cpp
+++ b/libc/test/src/math/smoke/log_test.cpp
@@ -6,12 +6,12 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/log.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/smoke/logf_test.cpp b/libc/test/src/math/smoke/logf_test.cpp
index 21b39ee6896dd2..97b6bdde307b3d 100644
--- a/libc/test/src/math/smoke/logf_test.cpp
+++ b/libc/test/src/math/smoke/logf_test.cpp
@@ -6,11 +6,11 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/math/logf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
#include <stdint.h>
diff --git a/libc/test/src/math/smoke/powf_test.cpp b/libc/test/src/math/smoke/powf_test.cpp
index 1867dde0ac3bea..e9de1554ec6148 100644
--- a/libc/test/src/math/smoke/powf_test.cpp
+++ b/libc/test/src/math/smoke/powf_test.cpp
@@ -6,11 +6,11 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/math/powf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/smoke/sincosf_test.cpp b/libc/test/src/math/smoke/sincosf_test.cpp
index a1447ad57e1162..5952b20fc5bff3 100644
--- a/libc/test/src/math/smoke/sincosf_test.cpp
+++ b/libc/test/src/math/smoke/sincosf_test.cpp
@@ -6,12 +6,12 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/sincosf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/smoke/sinf_test.cpp b/libc/test/src/math/smoke/sinf_test.cpp
index e51726646bc686..94508950418742 100644
--- a/libc/test/src/math/smoke/sinf_test.cpp
+++ b/libc/test/src/math/smoke/sinf_test.cpp
@@ -6,12 +6,12 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/sinf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/smoke/sinhf_test.cpp b/libc/test/src/math/smoke/sinhf_test.cpp
index 23334293b73fe4..0f005f752e6982 100644
--- a/libc/test/src/math/smoke/sinhf_test.cpp
+++ b/libc/test/src/math/smoke/sinhf_test.cpp
@@ -6,13 +6,13 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/CPP/array.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/sinhf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/smoke/tanf_test.cpp b/libc/test/src/math/smoke/tanf_test.cpp
index 53a153254b3111..68bf493f7e8227 100644
--- a/libc/test/src/math/smoke/tanf_test.cpp
+++ b/libc/test/src/math/smoke/tanf_test.cpp
@@ -6,12 +6,12 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/tanf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/smoke/tanhf_test.cpp b/libc/test/src/math/smoke/tanhf_test.cpp
index 7cb80dca7919eb..f1ce8b40d43ac2 100644
--- a/libc/test/src/math/smoke/tanhf_test.cpp
+++ b/libc/test/src/math/smoke/tanhf_test.cpp
@@ -6,12 +6,12 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/tanhf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/tan_test.cpp b/libc/test/src/math/tan_test.cpp
index 9cdc7c4abd32cc..85174db9364e36 100644
--- a/libc/test/src/math/tan_test.cpp
+++ b/libc/test/src/math/tan_test.cpp
@@ -11,7 +11,7 @@
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
+#include "include/llvm-libc-macros/math-macros.h"
using LlvmLibcTanTest = LIBC_NAMESPACE::testing::FPTest<double>;
diff --git a/libc/test/src/math/tanf_test.cpp b/libc/test/src/math/tanf_test.cpp
index c8d9d52e3f6954..d40bc44d6442f9 100644
--- a/libc/test/src/math/tanf_test.cpp
+++ b/libc/test/src/math/tanf_test.cpp
@@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/tanf.h"
@@ -13,7 +14,6 @@
#include "test/UnitTest/Test.h"
#include "test/src/math/sdcomp26094.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/src/math/tanhf_test.cpp b/libc/test/src/math/tanhf_test.cpp
index 28da7ffbeddd18..ef272b17d68cad 100644
--- a/libc/test/src/math/tanhf_test.cpp
+++ b/libc/test/src/math/tanhf_test.cpp
@@ -6,13 +6,13 @@
//
//===----------------------------------------------------------------------===//
+#include "include/llvm-libc-macros/math-macros.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/errno/libc_errno.h"
#include "src/math/tanhf.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
#include "utils/MPFRWrapper/MPFRUtils.h"
-#include <math.h>
#include <errno.h>
#include <stdint.h>
diff --git a/libc/test/utils/FPUtil/x86_long_double_test.cpp b/libc/test/utils/FPUtil/x86_long_double_test.cpp
index bafbbe2a410759..3b140c6c026670 100644
--- a/libc/test/utils/FPUtil/x86_long_double_test.cpp
+++ b/libc/test/utils/FPUtil/x86_long_double_test.cpp
@@ -9,7 +9,7 @@
#include "src/__support/FPUtil/FPBits.h"
#include "test/UnitTest/Test.h"
-#include <math.h>
+#include "include/llvm-libc-macros/math-macros.h"
using FPBits = LIBC_NAMESPACE::fputil::FPBits<long double>;
diff --git a/libc/utils/MPFRWrapper/MPFRUtils.cpp b/libc/utils/MPFRWrapper/MPFRUtils.cpp
index 7cc18cfb624389..2e1c44e6fd5da9 100644
--- a/libc/utils/MPFRWrapper/MPFRUtils.cpp
+++ b/libc/utils/MPFRWrapper/MPFRUtils.cpp
@@ -14,7 +14,7 @@
#include "src/__support/FPUtil/fpbits_str.h"
#include "test/UnitTest/FPMatcher.h"
-#include <cmath>
+#include "include/llvm-libc-macros/math-macros.h"
#include <fenv.h>
#include <memory>
#include <stdint.h>
More information about the llvm-commits
mailing list