[libc-commits] [libc] [libc] Create a separate proxy header for math-function-macros.h (PR #98430)

via libc-commits libc-commits at lists.llvm.org
Wed Jul 10 22:01:05 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Nhat Nguyen  (changkhothuychung)

<details>
<summary>Changes</summary>

Fix #<!-- -->98393

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


3 Files Affected:

- (modified) libc/hdr/CMakeLists.txt (+7) 
- (added) libc/hdr/math_function_macros.h (+14) 
- (modified) libc/hdr/math_macros.h (-2) 


``````````diff
diff --git a/libc/hdr/CMakeLists.txt b/libc/hdr/CMakeLists.txt
index 7549342514304..4c47f38a1ffe8 100644
--- a/libc/hdr/CMakeLists.txt
+++ b/libc/hdr/CMakeLists.txt
@@ -29,6 +29,13 @@ add_proxy_header_library(
     math_macros.h
   FULL_BUILD_DEPENDS
     libc.include.llvm-libc-macros.math_macros
+)
+
+add_proxy_header_library(
+  math_function_macros
+  HDRS
+    math_function_macros.h
+  FULL_BUILD_DEPENDS
     libc.include.math
 )
 
diff --git a/libc/hdr/math_function_macros.h b/libc/hdr/math_function_macros.h
new file mode 100644
index 0000000000000..c2de468af61b0
--- /dev/null
+++ b/libc/hdr/math_function_macros.h
@@ -0,0 +1,14 @@
+//===-- Definition of macros from math.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_MATH_FUNCTION_MACROS_H
+#define LLVM_LIBC_HDR_MATH_FUNCTION_MACROS_H
+
+#include <math.h>
+
+#endif // LLVM_LIBC_HDR_MATH_MACROS_H
diff --git a/libc/hdr/math_macros.h b/libc/hdr/math_macros.h
index d13c5ff7647ad..135ffd498b9a0 100644
--- a/libc/hdr/math_macros.h
+++ b/libc/hdr/math_macros.h
@@ -15,8 +15,6 @@
 
 #else // Overlay mode
 
-#include <math.h>
-
 // Some older math.h header does not have FP_INT_* constants yet.
 #ifndef FP_INT_UPWARD
 #define FP_INT_UPWARD 0

``````````

</details>


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


More information about the libc-commits mailing list