Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libc] Add proxy header for fenv.h macro constants. #87863 #87896

Merged
merged 24 commits into from
Apr 9, 2024

Conversation

ghost
Copy link

@ghost ghost commented Apr 6, 2024

Hello, this addresses #87863.

@ghost ghost requested a review from rupprecht as a code owner April 6, 2024 21:48
@llvmbot llvmbot added libc bazel "Peripheral" support tier build system: utils/bazel labels Apr 6, 2024
@llvmbot
Copy link
Member

llvmbot commented Apr 6, 2024

@llvm/pr-subscribers-libc

Author: Job Henandez Lara (Jobhdez)

Changes

Hello, this addresses #87863.

Note: I havent run the tests because my computer is really slow right now and I am afraid that it will die and malfunction and I dont want to lose my work. But Ill make sure it builds asap. thanks


Patch is 25.44 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/87896.diff

51 Files Affected:

  • (modified) libc/AOR_v20.02/math/test/mathtest.c (+1-1)
  • (modified) libc/AOR_v20.02/math/test/ulp.c (+1-1)
  • (modified) libc/config/baremetal/arm/headers.txt (+1-1)
  • (modified) libc/config/baremetal/riscv/headers.txt (+1-1)
  • (modified) libc/config/darwin/arm/headers.txt (+1-1)
  • (modified) libc/config/darwin/x86_64/headers.txt (+1-1)
  • (modified) libc/config/gpu/headers.txt (+1-1)
  • (modified) libc/config/linux/aarch64/headers.txt (+1-1)
  • (modified) libc/config/linux/arm/headers.txt (+1-1)
  • (modified) libc/config/linux/riscv/headers.txt (+1-1)
  • (modified) libc/config/linux/x86_64/headers.txt (+1-1)
  • (modified) libc/hdr/CMakeLists.txt (+9)
  • (added) libc/hdr/fenv_macros.h (+22)
  • (modified) libc/src/__support/FPUtil/CMakeLists.txt (+2-2)
  • (modified) libc/src/__support/FPUtil/FEnvImpl.h (+1-1)
  • (modified) libc/src/__support/FPUtil/aarch64/FEnvImpl.h (+1-1)
  • (modified) libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h (+1-1)
  • (modified) libc/src/__support/FPUtil/arm/FEnvImpl.h (+1-1)
  • (modified) libc/src/__support/FPUtil/generic/CMakeLists.txt (+1-1)
  • (modified) libc/src/__support/FPUtil/riscv/FEnvImpl.h (+1-1)
  • (modified) libc/src/__support/FPUtil/rounding_mode.h (+1-1)
  • (modified) libc/src/__support/FPUtil/x86_64/FEnvImpl.h (+1-1)
  • (modified) libc/src/fenv/CMakeLists.txt (+15-15)
  • (modified) libc/src/fenv/fegetenv.h (+1-1)
  • (modified) libc/src/fenv/fegetexceptflag.cpp (+1-1)
  • (modified) libc/src/fenv/fegetexceptflag.h (+1-1)
  • (modified) libc/src/fenv/feholdexcept.cpp (+1-1)
  • (modified) libc/src/fenv/feholdexcept.h (+1-1)
  • (modified) libc/src/fenv/fesetenv.h (+1-1)
  • (modified) libc/src/fenv/fesetexceptflag.cpp (+1-1)
  • (modified) libc/src/fenv/fesetexceptflag.h (+1-1)
  • (modified) libc/src/fenv/feupdateenv.cpp (+1-1)
  • (modified) libc/src/fenv/feupdateenv.h (+1-1)
  • (modified) libc/test/UnitTest/FPExceptMatcher.cpp (+1-1)
  • (modified) libc/test/UnitTest/RoundingModeUtils.cpp (+1-1)
  • (modified) libc/test/src/__support/FPUtil/rounding_mode_test.cpp (+1-1)
  • (modified) libc/test/src/fenv/CMakeLists.txt (+1-1)
  • (modified) libc/test/src/fenv/enabled_exceptions_test.cpp (+1-1)
  • (modified) libc/test/src/fenv/exception_flags_test.cpp (+1-1)
  • (modified) libc/test/src/fenv/exception_status_test.cpp (+1-1)
  • (modified) libc/test/src/fenv/feclearexcept_test.cpp (+1-1)
  • (modified) libc/test/src/fenv/feenableexcept_test.cpp (+1-1)
  • (modified) libc/test/src/fenv/feholdexcept_test.cpp (+1-1)
  • (modified) libc/test/src/fenv/feupdateenv_test.cpp (+1-1)
  • (modified) libc/test/src/fenv/getenv_and_setenv_test.cpp (+1-1)
  • (modified) libc/test/src/fenv/rounding_mode_test.cpp (+1-1)
  • (modified) libc/test/src/math/RIntTest.h (+1-1)
  • (modified) libc/test/src/math/smoke/NextTowardTest.h (+1-1)
  • (modified) libc/test/src/math/smoke/RIntTest.h (+1-1)
  • (modified) libc/utils/MPFRWrapper/MPFRUtils.cpp (+1-1)
  • (modified) utils/bazel/llvm-project-overlay/libc/BUILD.bazel (+6)
diff --git a/libc/AOR_v20.02/math/test/mathtest.c b/libc/AOR_v20.02/math/test/mathtest.c
index efe0a8a744bc5c..9ac5e191d2d396 100644
--- a/libc/AOR_v20.02/math/test/mathtest.c
+++ b/libc/AOR_v20.02/math/test/mathtest.c
@@ -15,7 +15,7 @@
 #include <math.h>
 #include <errno.h>
 #include <limits.h>
-#include <fenv.h>
+#include "hdr/fenv_macros.h"
 #include "mathlib.h"
 
 #ifndef math_errhandling
diff --git a/libc/AOR_v20.02/math/test/ulp.c b/libc/AOR_v20.02/math/test/ulp.c
index 3821986f7cb485..7a17228698bcf0 100644
--- a/libc/AOR_v20.02/math/test/ulp.c
+++ b/libc/AOR_v20.02/math/test/ulp.c
@@ -7,7 +7,7 @@
  */
 
 #include <ctype.h>
-#include <fenv.h>
+#include "hdr/fenv_macros.h"
 #include <float.h>
 #include <math.h>
 #include <stdint.h>
diff --git a/libc/config/baremetal/arm/headers.txt b/libc/config/baremetal/arm/headers.txt
index 3608364e45bdeb..42f3274bc72962 100644
--- a/libc/config/baremetal/arm/headers.txt
+++ b/libc/config/baremetal/arm/headers.txt
@@ -1,7 +1,7 @@
 set(TARGET_PUBLIC_HEADERS
     libc.include.assert
     libc.include.ctype
-    libc.include.fenv
+    libc.hdr.fenv_macros
     libc.include.errno
     libc.include.float
     libc.include.stdint
diff --git a/libc/config/baremetal/riscv/headers.txt b/libc/config/baremetal/riscv/headers.txt
index 3608364e45bdeb..42f3274bc72962 100644
--- a/libc/config/baremetal/riscv/headers.txt
+++ b/libc/config/baremetal/riscv/headers.txt
@@ -1,7 +1,7 @@
 set(TARGET_PUBLIC_HEADERS
     libc.include.assert
     libc.include.ctype
-    libc.include.fenv
+    libc.hdr.fenv_macros
     libc.include.errno
     libc.include.float
     libc.include.stdint
diff --git a/libc/config/darwin/arm/headers.txt b/libc/config/darwin/arm/headers.txt
index 86e7145972324a..29b397edd594d6 100644
--- a/libc/config/darwin/arm/headers.txt
+++ b/libc/config/darwin/arm/headers.txt
@@ -1,7 +1,7 @@
 set(TARGET_PUBLIC_HEADERS
     libc.include.ctype
     libc.include.errno
-    libc.include.fenv
+    libc.hdr.fenv_macros
     libc.include.float
     libc.include.stdint
     libc.include.inttypes
diff --git a/libc/config/darwin/x86_64/headers.txt b/libc/config/darwin/x86_64/headers.txt
index acd24026498774..69f7e88d550448 100644
--- a/libc/config/darwin/x86_64/headers.txt
+++ b/libc/config/darwin/x86_64/headers.txt
@@ -2,7 +2,7 @@ set(TARGET_PUBLIC_HEADERS
     libc.include.ctype
     libc.include.errno
     # Fenv is currently disabled.
-    #libc.include.fenv
+    #libc.hdr.fenv_macros
     libc.include.float
     libc.include.stdint
     libc.include.inttypes
diff --git a/libc/config/gpu/headers.txt b/libc/config/gpu/headers.txt
index dd16938da8a447..bf0b5cfb7b0348 100644
--- a/libc/config/gpu/headers.txt
+++ b/libc/config/gpu/headers.txt
@@ -7,7 +7,7 @@ set(TARGET_PUBLIC_HEADERS
     libc.include.inttypes
     libc.include.limits
     libc.include.math
-    libc.include.fenv
+    libc.hdr.fenv_macros
     libc.include.time
     libc.include.errno
     libc.include.stdlib
diff --git a/libc/config/linux/aarch64/headers.txt b/libc/config/linux/aarch64/headers.txt
index 47db4434b09b33..fd72001965eef9 100644
--- a/libc/config/linux/aarch64/headers.txt
+++ b/libc/config/linux/aarch64/headers.txt
@@ -3,7 +3,7 @@ set(TARGET_PUBLIC_HEADERS
     libc.include.ctype
     libc.include.errno
     libc.include.features
-    libc.include.fenv
+    libc.hdr.fenv_macros
     libc.include.float
     libc.include.stdint
     libc.include.inttypes
diff --git a/libc/config/linux/arm/headers.txt b/libc/config/linux/arm/headers.txt
index 307bb6b146a4cc..f1adb96052ca97 100644
--- a/libc/config/linux/arm/headers.txt
+++ b/libc/config/linux/arm/headers.txt
@@ -1,6 +1,6 @@
 set(TARGET_PUBLIC_HEADERS
     libc.include.ctype
-    libc.include.fenv
+    libc.hdr.fenv_macros
     libc.include.errno
     libc.include.float
     libc.include.stdint
diff --git a/libc/config/linux/riscv/headers.txt b/libc/config/linux/riscv/headers.txt
index c858bcc978d9da..a4fc31bb368c27 100644
--- a/libc/config/linux/riscv/headers.txt
+++ b/libc/config/linux/riscv/headers.txt
@@ -5,7 +5,7 @@ set(TARGET_PUBLIC_HEADERS
     libc.include.errno
     libc.include.fcntl
     libc.include.features
-    libc.include.fenv
+    libc.hdr.fenv_macros
     libc.include.float
     libc.include.stdint
     libc.include.inttypes
diff --git a/libc/config/linux/x86_64/headers.txt b/libc/config/linux/x86_64/headers.txt
index e51c7931942706..74878111621ea5 100644
--- a/libc/config/linux/x86_64/headers.txt
+++ b/libc/config/linux/x86_64/headers.txt
@@ -5,7 +5,7 @@ set(TARGET_PUBLIC_HEADERS
     libc.include.errno
     libc.include.fcntl
     libc.include.features
-    libc.include.fenv
+    libc.hdr.fenv_macros
     libc.include.float
     libc.include.stdint
     libc.include.inttypes
diff --git a/libc/hdr/CMakeLists.txt b/libc/hdr/CMakeLists.txt
index 1d3eb9d5240ab9..ff95a49e29b2f7 100644
--- a/libc/hdr/CMakeLists.txt
+++ b/libc/hdr/CMakeLists.txt
@@ -31,3 +31,12 @@ add_proxy_header_library(
     libc.include.llvm-libc-macros.math_macros
     libc.include.math
 )
+
+add_proxy_header_library(
+  fenv_macros
+  HDRS
+    fenv_macros.h
+  FULL_BUILD_DEPENDS
+    libc.include.llvm-libc-macros.fenv_macros
+    libc.hdr.fenv_macros
+)
diff --git a/libc/hdr/fenv_macros.h b/libc/hdr/fenv_macros.h
new file mode 100644
index 00000000000000..23b1ebed3c2871
--- /dev/null
+++ b/libc/hdr/fenv_macros.h
@@ -0,0 +1,22 @@
+//===-- Definition of macros from fenv.h ----------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_HDR_FENV_MACROS_H
+#define LLVM_LIBC_HDR_FENV_MACROS_H
+
+#ifdef LIBC_FULL_BUILD
+
+#include "libc/include/llvm-libc-macros/fenv-macros.h"
+
+#else // Overlay mode
+
+#include <fenv.h>
+
+#endif // LLVM_LIBC_FULL_BUILD
+
+#endif // LLVM_LIBC_HDR_FENV_MACROS_H
diff --git a/libc/src/__support/FPUtil/CMakeLists.txt b/libc/src/__support/FPUtil/CMakeLists.txt
index 1af236ed9d6bc1..4c0885ff756ecd 100644
--- a/libc/src/__support/FPUtil/CMakeLists.txt
+++ b/libc/src/__support/FPUtil/CMakeLists.txt
@@ -3,7 +3,7 @@ add_header_library(
   HDRS
     FEnvImpl.h
   DEPENDS
-    libc.include.fenv
+    libc.hdr.fenv_macros
     libc.hdr.math_macros
     libc.src.__support.macros.attributes
     libc.src.errno.errno
@@ -14,7 +14,7 @@ add_header_library(
   HDRS
     rounding_mode.h
   DEPENDS
-    libc.include.fenv
+    libc.hdr.fenv_macros
     libc.src.__support.macros.attributes
     libc.src.__support.macros.properties.architectures
     libc.src.__support.macros.sanitizer
diff --git a/libc/src/__support/FPUtil/FEnvImpl.h b/libc/src/__support/FPUtil/FEnvImpl.h
index 4be1a57f0f4b38..04ab015a9ae6bc 100644
--- a/libc/src/__support/FPUtil/FEnvImpl.h
+++ b/libc/src/__support/FPUtil/FEnvImpl.h
@@ -13,7 +13,7 @@
 #include "src/__support/macros/attributes.h" // LIBC_INLINE
 #include "src/__support/macros/properties/architectures.h"
 #include "src/errno/libc_errno.h"
-#include <fenv.h>
+#include "hdr/fenv_macros.h"
 
 #if defined(LIBC_TARGET_ARCH_IS_AARCH64)
 #if defined(__APPLE__)
diff --git a/libc/src/__support/FPUtil/aarch64/FEnvImpl.h b/libc/src/__support/FPUtil/aarch64/FEnvImpl.h
index e0eec17e038c63..05df87a6208e6e 100644
--- a/libc/src/__support/FPUtil/aarch64/FEnvImpl.h
+++ b/libc/src/__support/FPUtil/aarch64/FEnvImpl.h
@@ -17,7 +17,7 @@
 #endif
 
 #include <arm_acle.h>
-#include <fenv.h>
+#include "hdr/fenv_macros.h"
 #include <stdint.h>
 
 #include "src/__support/FPUtil/FPBits.h"
diff --git a/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h b/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h
index fd915373020ec9..9e11390c9b60da 100644
--- a/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h
+++ b/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h
@@ -17,7 +17,7 @@
 #endif
 
 #include <arm_acle.h>
-#include <fenv.h>
+#include "hdr/fenv_macros.h"
 #include <stdint.h>
 
 #include "src/__support/FPUtil/FPBits.h"
diff --git a/libc/src/__support/FPUtil/arm/FEnvImpl.h b/libc/src/__support/FPUtil/arm/FEnvImpl.h
index ac4673cf20f632..458f4abf278fc3 100644
--- a/libc/src/__support/FPUtil/arm/FEnvImpl.h
+++ b/libc/src/__support/FPUtil/arm/FEnvImpl.h
@@ -12,7 +12,7 @@
 #include "src/__support/FPUtil/FPBits.h"
 #include "src/__support/macros/attributes.h" // For LIBC_INLINE
 
-#include <fenv.h>
+#include "hdr/fenv_macros.h"
 #include <stdint.h>
 
 namespace LIBC_NAMESPACE {
diff --git a/libc/src/__support/FPUtil/generic/CMakeLists.txt b/libc/src/__support/FPUtil/generic/CMakeLists.txt
index 0ae62f40dc6163..5c941a6f7e7076 100644
--- a/libc/src/__support/FPUtil/generic/CMakeLists.txt
+++ b/libc/src/__support/FPUtil/generic/CMakeLists.txt
@@ -4,7 +4,7 @@ add_header_library(
     sqrt.h
     sqrt_80_bit_long_double.h
   DEPENDS
-    libc.include.fenv
+    libc.hdr.fenv_macros
     libc.src.__support.common
     libc.src.__support.CPP.bit
     libc.src.__support.CPP.type_traits
diff --git a/libc/src/__support/FPUtil/riscv/FEnvImpl.h b/libc/src/__support/FPUtil/riscv/FEnvImpl.h
index b73c4798b0539a..2a2a18b7e98e45 100644
--- a/libc/src/__support/FPUtil/riscv/FEnvImpl.h
+++ b/libc/src/__support/FPUtil/riscv/FEnvImpl.h
@@ -13,7 +13,7 @@
 #include "src/__support/macros/attributes.h" // For LIBC_INLINE_ASM
 #include "src/__support/macros/config.h"     // For LIBC_INLINE
 
-#include <fenv.h>
+#include "hdr/fenv_macros.h"
 #include <stdint.h>
 
 namespace LIBC_NAMESPACE {
diff --git a/libc/src/__support/FPUtil/rounding_mode.h b/libc/src/__support/FPUtil/rounding_mode.h
index 91a5b9c50e7c2b..41f2803e0e8fb5 100644
--- a/libc/src/__support/FPUtil/rounding_mode.h
+++ b/libc/src/__support/FPUtil/rounding_mode.h
@@ -11,7 +11,7 @@
 
 #include "src/__support/macros/attributes.h" // LIBC_INLINE
 
-#include <fenv.h>
+#include "hdr/fenv_macros.h"
 
 namespace LIBC_NAMESPACE::fputil {
 
diff --git a/libc/src/__support/FPUtil/x86_64/FEnvImpl.h b/libc/src/__support/FPUtil/x86_64/FEnvImpl.h
index b73b70e907790f..5833d9c8deb50e 100644
--- a/libc/src/__support/FPUtil/x86_64/FEnvImpl.h
+++ b/libc/src/__support/FPUtil/x86_64/FEnvImpl.h
@@ -16,7 +16,7 @@
 #error "Invalid include"
 #endif
 
-#include <fenv.h>
+#include "hdr/fenv_macros.h"
 #include <stdint.h>
 
 #include "src/__support/macros/sanitizer.h"
diff --git a/libc/src/fenv/CMakeLists.txt b/libc/src/fenv/CMakeLists.txt
index d2f90d3d007a1b..965a783055add5 100644
--- a/libc/src/fenv/CMakeLists.txt
+++ b/libc/src/fenv/CMakeLists.txt
@@ -5,7 +5,7 @@ add_entrypoint_object(
   HDRS
     fegetround.h
   DEPENDS
-    libc.include.fenv
+    libc.hdr.fenv_macros
     libc.src.__support.FPUtil.fenv_impl
   COMPILE_OPTIONS
     -O2
@@ -18,7 +18,7 @@ add_entrypoint_object(
   HDRS
     fesetround.h
   DEPENDS
-    libc.include.fenv
+    libc.hdr.fenv_macros
     libc.src.__support.FPUtil.fenv_impl
   COMPILE_OPTIONS
     -O2
@@ -31,7 +31,7 @@ add_entrypoint_object(
   HDRS
     feclearexcept.h
   DEPENDS
-    libc.include.fenv
+    libc.hdr.fenv_macros
     libc.src.__support.FPUtil.fenv_impl
   COMPILE_OPTIONS
     -O2
@@ -44,7 +44,7 @@ add_entrypoint_object(
   HDRS
     feraiseexcept.h
   DEPENDS
-    libc.include.fenv
+    libc.hdr.fenv_macros
     libc.src.__support.FPUtil.fenv_impl
   COMPILE_OPTIONS
     -O2
@@ -57,7 +57,7 @@ add_entrypoint_object(
   HDRS
     fetestexcept.h
   DEPENDS
-    libc.include.fenv
+    libc.hdr.fenv_macros
     libc.src.__support.FPUtil.fenv_impl
   COMPILE_OPTIONS
     -O2
@@ -70,7 +70,7 @@ add_entrypoint_object(
   HDRS
     fegetenv.h
   DEPENDS
-    libc.include.fenv
+    libc.hdr.fenv_macros
     libc.src.__support.FPUtil.fenv_impl
   COMPILE_OPTIONS
     -O2
@@ -83,7 +83,7 @@ add_entrypoint_object(
   HDRS
     fesetenv.h
   DEPENDS
-    libc.include.fenv
+    libc.hdr.fenv_macros
     libc.src.__support.FPUtil.fenv_impl
   COMPILE_OPTIONS
     -O2
@@ -96,7 +96,7 @@ add_entrypoint_object(
   HDRS
     fegetexceptflag.h
   DEPENDS
-    libc.include.fenv
+    libc.hdr.fenv_macros
     libc.src.__support.FPUtil.fenv_impl
   COMPILE_OPTIONS
     -O2
@@ -109,7 +109,7 @@ add_entrypoint_object(
   HDRS
     fesetexcept.h
   DEPENDS
-    libc.include.fenv
+    libc.hdr.fenv_macros
     libc.src.__support.FPUtil.fenv_impl
   COMPILE_OPTIONS
     -O2
@@ -122,7 +122,7 @@ add_entrypoint_object(
   HDRS
     fesetexceptflag.h
   DEPENDS
-    libc.include.fenv
+    libc.hdr.fenv_macros
     libc.src.__support.FPUtil.fenv_impl
   COMPILE_OPTIONS
     -O2
@@ -135,7 +135,7 @@ add_entrypoint_object(
   HDRS
     feholdexcept.h
   DEPENDS
-    libc.include.fenv
+    libc.hdr.fenv_macros
     libc.src.__support.FPUtil.fenv_impl
   COMPILE_OPTIONS
     -O2
@@ -148,7 +148,7 @@ add_entrypoint_object(
   HDRS
     feupdateenv.h
   DEPENDS
-    libc.include.fenv
+    libc.hdr.fenv_macros
     libc.src.__support.FPUtil.fenv_impl
   COMPILE_OPTIONS
     -O2
@@ -161,7 +161,7 @@ add_entrypoint_object(
   HDRS
     feenableexcept.h
   DEPENDS
-    libc.include.fenv
+    libc.hdr.fenv_macros
     libc.src.__support.FPUtil.fenv_impl
   COMPILE_OPTIONS
     -O2
@@ -174,7 +174,7 @@ add_entrypoint_object(
   HDRS
     fedisableexcept.h
   DEPENDS
-    libc.include.fenv
+    libc.hdr.fenv_macros
     libc.src.__support.FPUtil.fenv_impl
   COMPILE_OPTIONS
     -O2
@@ -187,7 +187,7 @@ add_entrypoint_object(
   HDRS
     fegetexcept.h
   DEPENDS
-    libc.include.fenv
+    libc.hdr.fenv_macros
     libc.src.__support.FPUtil.fenv_impl
   COMPILE_OPTIONS
     -O2
diff --git a/libc/src/fenv/fegetenv.h b/libc/src/fenv/fegetenv.h
index 658316482984e1..479b87d554fac6 100644
--- a/libc/src/fenv/fegetenv.h
+++ b/libc/src/fenv/fegetenv.h
@@ -9,7 +9,7 @@
 #ifndef LLVM_LIBC_SRC_FENV_FEGETENV_H
 #define LLVM_LIBC_SRC_FENV_FEGETENV_H
 
-#include <fenv.h>
+#include "hdr/fenv_macros.h"
 
 namespace LIBC_NAMESPACE {
 
diff --git a/libc/src/fenv/fegetexceptflag.cpp b/libc/src/fenv/fegetexceptflag.cpp
index c6160da7afbde2..035303b079ab22 100644
--- a/libc/src/fenv/fegetexceptflag.cpp
+++ b/libc/src/fenv/fegetexceptflag.cpp
@@ -10,7 +10,7 @@
 #include "src/__support/FPUtil/FEnvImpl.h"
 #include "src/__support/common.h"
 
-#include <fenv.h>
+#include "hdr/fenv_macros.h"
 
 namespace LIBC_NAMESPACE {
 
diff --git a/libc/src/fenv/fegetexceptflag.h b/libc/src/fenv/fegetexceptflag.h
index ad72161e536f83..41c77ed7c98a72 100644
--- a/libc/src/fenv/fegetexceptflag.h
+++ b/libc/src/fenv/fegetexceptflag.h
@@ -9,7 +9,7 @@
 #ifndef LLVM_LIBC_SRC_FENV_FEGETEXCEPTFLAG_H
 #define LLVM_LIBC_SRC_FENV_FEGETEXCEPTFLAG_H
 
-#include <fenv.h>
+#include "hdr/fenv_macros.h"
 
 namespace LIBC_NAMESPACE {
 
diff --git a/libc/src/fenv/feholdexcept.cpp b/libc/src/fenv/feholdexcept.cpp
index 3c73b1f4217798..5e8b78b295672a 100644
--- a/libc/src/fenv/feholdexcept.cpp
+++ b/libc/src/fenv/feholdexcept.cpp
@@ -10,7 +10,7 @@
 #include "src/__support/FPUtil/FEnvImpl.h"
 #include "src/__support/common.h"
 
-#include <fenv.h>
+#include "hdr/fenv_macros.h"
 
 namespace LIBC_NAMESPACE {
 
diff --git a/libc/src/fenv/feholdexcept.h b/libc/src/fenv/feholdexcept.h
index bbefc4ecbd41b2..ef7d145f26e3f5 100644
--- a/libc/src/fenv/feholdexcept.h
+++ b/libc/src/fenv/feholdexcept.h
@@ -9,7 +9,7 @@
 #ifndef LLVM_LIBC_SRC_FENV_FEHOLDEXCEPT_H
 #define LLVM_LIBC_SRC_FENV_FEHOLDEXCEPT_H
 
-#include <fenv.h>
+#include "hdr/fenv_macros.h"
 
 namespace LIBC_NAMESPACE {
 
diff --git a/libc/src/fenv/fesetenv.h b/libc/src/fenv/fesetenv.h
index 8b56bebc2e36d4..8591e65d86e15f 100644
--- a/libc/src/fenv/fesetenv.h
+++ b/libc/src/fenv/fesetenv.h
@@ -9,7 +9,7 @@
 #ifndef LLVM_LIBC_SRC_FENV_FESETENV_H
 #define LLVM_LIBC_SRC_FENV_FESETENV_H
 
-#include <fenv.h>
+#include "hdr/fenv_macros.h"
 
 namespace LIBC_NAMESPACE {
 
diff --git a/libc/src/fenv/fesetexceptflag.cpp b/libc/src/fenv/fesetexceptflag.cpp
index 2fe7cb571a8ddd..58c10ba97a141b 100644
--- a/libc/src/fenv/fesetexceptflag.cpp
+++ b/libc/src/fenv/fesetexceptflag.cpp
@@ -10,7 +10,7 @@
 #include "src/__support/FPUtil/FEnvImpl.h"
 #include "src/__support/common.h"
 
-#include <fenv.h>
+#include "hdr/fenv_macros.h"
 
 namespace LIBC_NAMESPACE {
 
diff --git a/libc/src/fenv/fesetexceptflag.h b/libc/src/fenv/fesetexceptflag.h
index 15e62eda1b840c..a91abe0d6aa7c5 100644
--- a/libc/src/fenv/fesetexceptflag.h
+++ b/libc/src/fenv/fesetexceptflag.h
@@ -9,7 +9,7 @@
 #ifndef LLVM_LIBC_SRC_FENV_FESETEXCEPTFLAG_H
 #define LLVM_LIBC_SRC_FENV_FESETEXCEPTFLAG_H
 
-#include <fenv.h>
+#include "hdr/fenv_macros.h"
 
 namespace LIBC_NAMESPACE {
 
diff --git a/libc/src/fenv/feupdateenv.cpp b/libc/src/fenv/feupdateenv.cpp
index 7e81b9476da91b..72bc14bd50a74a 100644
--- a/libc/src/fenv/feupdateenv.cpp
+++ b/libc/src/fenv/feupdateenv.cpp
@@ -10,7 +10,7 @@
 #include "src/__support/FPUtil/FEnvImpl.h"
 #include "src/__support/common.h"
 
-#include <fenv.h>
+#include "hdr/fenv_macros.h"
 
 namespace LIBC_NAMESPACE {
 
diff --git a/libc/src/fenv/feupdateenv.h b/libc/src/fenv/feupdateenv.h
index 294c041ddeae79..a925d862f984bb 100644
--- a/libc/src/fenv/feupdateenv.h
+++ b/libc/src/fenv/feupdateenv.h
@@ -9,7 +9,7 @@
 #ifndef LLVM_LIBC_SRC_FENV_FEUPDATEENV_H
 #define LLVM_LIBC_SRC_FENV_FEUPDATEENV_H
 
-#include <fenv.h>
+#include "hdr/fenv_macros.h"
 
 namespace LIBC_NAMESPACE {
 
diff --git a/libc/test/UnitTest/FPExceptMatcher.cpp b/libc/test/UnitTest/FPExceptMatcher.cpp
index 1601b7e53f2be1..965059faf7eba0 100644
--- a/libc/test/UnitTest/FPExceptMatcher.cpp
+++ b/libc/test/UnitTest/FPExceptMatcher.cpp
@@ -8,7 +8,7 @@
 
 #include "FPExceptMatcher.h"
 
-#include <fenv.h>
+#include "hdr/fenv_macros.h"
 #include <memory>
 #include <setjmp.h>
 #include <signal.h>
diff --git a/libc/test/UnitTest/RoundingModeUtils.cpp b/libc/test/UnitTest/RoundingModeUtils.cpp
index c8f32f81e7134a..cb34c5eab421e2 100644
--- a/libc/test/UnitTest/RoundingModeUtils.cpp
+++ b/libc/test/UnitTest/RoundingModeUtils.cpp
@@ -10,7 +10,7 @@
 #include "src/__support/FPUtil/FEnvImpl.h"
 #include "src/__support/FPUtil/rounding_mode.h"
 
-#include <fenv.h>
+#include "hdr/fenv_macros.h"
 
 namespace LIBC_NAMESPACE {
 namespace fputil {
diff --git a/libc/test/src/__support/FPUtil/rounding_mode_test.cpp b/libc/test/src/__support/FPUtil/rounding_mode_test.cpp
index 8077a5aab7afde..5d62bc8c9ae931 100644
--- a/libc/test/src/__support/FPUtil/rounding_mode_test.cpp
+++ b/libc/test/src/__support/FPUtil/rounding_mode_test.cpp
@@ -10,7 +10,7 @@
 #include "test/UnitTest/Test.h"
 #include "utils/MPFRWrapper/MPFRUtils.h"
 
-#include <fenv.h>
+#include "hdr/fenv_macros.h"
 
 using LIBC_NAMESPACE::testing::mpfr::ForceRoundingMode;
 using LIBC_NAMESPACE::testing::mpfr::RoundingMode;
diff --git a/libc/test/src/fenv/CMakeLists.txt b/libc/test/src/fenv/CMakeLists.txt
index 7e456b9a922fb9..577735599dc010 100644
--- a/libc/test/src/fenv/CMakeLists.txt
+++ b/libc/test/src/fenv/CMakeLists.txt
@@ -118,7 +118,7 @@ if (NOT (LLVM_USE_SANITIZER OR (${LIBC_TARGET_OS} STREQUAL "windows")
     SRCS
       feholdexcept_test.cpp
     DEPENDS
-      libc.include.fenv
+      libc.hdr.fenv_macros
       libc.src.fenv.feholdexcept
       libc.src.__support.FPUtil.fenv_impl
     LINK_LIBRARIES
diff --git a/libc/test/src/fenv/enabled_exceptions_test.cpp b/libc/test/src/fenv/enabled_exceptions_test.cpp
index 8bc2454faf9ea8..53440b704ca761 100644
--- a/libc/test/src/fenv/enabled_exceptions_test.cpp
+++ b/libc/test/src/fenv/enabled_exceptions_test.cpp
@@ -15,7 +15,7 @@
 #include "test/UnitTest/FPExceptMatcher.h"
 #include "test/UnitTest/Test.h"
 
-#include <fenv.h>
+#include "hdr/fenv_macros.h"
 #include <signal.h>
 
 // This test enables an exception and verifies that raising that exception
diff --git a/libc/test/src/fenv/exception_flags_test.cpp b/libc/test/src/fenv/exception_flags_test.cpp
index 434adc06b1a36a..d62aaa00c26b03 100644
--- a/libc/test/src/fenv/exception_flags_test.cpp
+++ b/libc/test/src/fenv/exception_flags_test.cpp
@@ -12,7 +12,7 @@
 #include "src/__support/FPUtil/FEnvImpl.h"
 #include "test/UnitTest/Test.h"
 
-#include <fenv.h>
+#include "hdr/fenv_macros.h"
 
 TEST(LlvmLibcFenvTest, GetExceptFlagAndSetExceptFlag) {
   // We will disable all exceptions to prevent invocation of the exception
diff --git a/libc/test/src/fenv/exception_status_test.cpp b/libc/test/src/fenv/exception_status_test.cpp
index cf0fd1fe1af397..a7000020b1a3c8 100644
--- a/libc/test/src/fenv/exception_status_test.cpp
+++ b/libc/test/src/fenv/exception_status_test.cpp
@@ -15,7 +15,7...
[truncated]

Copy link

github-actions bot commented Apr 6, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@lntue lntue self-requested a review April 6, 2024 21:54
libc/src/fenv/fegetenv.h Outdated Show resolved Hide resolved
utils/bazel/MODULE.bazel Outdated Show resolved Hide resolved
utils/bazel/MODULE.bazel.lock Outdated Show resolved Hide resolved
@lntue
Copy link
Contributor

lntue commented Apr 8, 2024

LGTM overall for me. Let see if others have any further comments.

Copy link
Member

@nickdesaulniers nickdesaulniers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the patch!

@lntue lntue merged commit 4956118 into llvm:main Apr 9, 2024
4 checks passed
@ghost
Copy link
Author

ghost commented Apr 10, 2024

thanks for the patch!

no problem!

fenv_macros.h
FULL_BUILD_DEPENDS
libc.include.llvm-libc-macros.fenv_macros
libc.incude.fenv
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: s/incude/include/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in 8cfa72a

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

nickdesaulniers added a commit that referenced this pull request Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bazel "Peripheral" support tier build system: utils/bazel libc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants