[libc-commits] [libc] [libc] Fix installed 'math.h' header paths (PR #83199)

via libc-commits libc-commits at lists.llvm.org
Tue Feb 27 14:33:14 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Joseph Huber (jhuber6)

<details>
<summary>Changes</summary>

Summary:
Recent changes added an include path in the float128 type that used the
internal `libc` path to find the macro. This doesn't work once it's
installed because we need to search from the root of the install dir.
Move the include to the top-level math.h so we can find it.


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


3 Files Affected:

- (modified) libc/include/CMakeLists.txt (+1) 
- (modified) libc/include/llvm-libc-types/float128.h (-2) 
- (modified) libc/include/math.h.def (+1-1) 


``````````diff
diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index 9090b3bca01e0d..fc16ce0c27cbbd 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -99,6 +99,7 @@ add_gen_header(
   DEPENDS
     .llvm_libc_common_h
     .llvm-libc-macros.math_macros
+    .llvm-libc-macros.float_macros
     .llvm-libc-types.double_t
     .llvm-libc-types.float_t
     .llvm-libc-types.float128
diff --git a/libc/include/llvm-libc-types/float128.h b/libc/include/llvm-libc-types/float128.h
index 61a094fdb96b12..dedb8076ecf03e 100644
--- a/libc/include/llvm-libc-types/float128.h
+++ b/libc/include/llvm-libc-types/float128.h
@@ -9,8 +9,6 @@
 #ifndef __LLVM_LIBC_TYPES_FLOAT128_H__
 #define __LLVM_LIBC_TYPES_FLOAT128_H__
 
-#include <include/llvm-libc-macros/float-macros.h> // LDBL_MANT_DIG
-
 // Currently, C23 `_Float128` type is only defined as a built-in type in GCC 7
 // or later, and only for C.  For C++, or for clang, `__float128` is defined
 // instead, and only on x86-64 targets.
diff --git a/libc/include/math.h.def b/libc/include/math.h.def
index 927e2d6697c67d..b2252cbb6170d0 100644
--- a/libc/include/math.h.def
+++ b/libc/include/math.h.def
@@ -11,9 +11,9 @@
 
 #include <__llvm-libc-common.h>
 #include <llvm-libc-macros/math-macros.h>
+#include <llvm-libc-macros/float-macros.h>
 #include <llvm-libc-types/float128.h>
 
-
 %%public_api()
 
 #endif // LLVM_LIBC_MATH_H

``````````

</details>


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


More information about the libc-commits mailing list