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

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Tue Feb 27 14:32:38 PST 2024


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

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.


>From 4a1fce78ab6d6ccacf68a18da55a01c0533ee90a Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Tue, 27 Feb 2024 16:31:07 -0600
Subject: [PATCH] [libc] Fix installed 'math.h' header paths

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.
---
 libc/include/CMakeLists.txt             | 1 +
 libc/include/llvm-libc-types/float128.h | 2 --
 libc/include/math.h.def                 | 2 +-
 3 files changed, 2 insertions(+), 3 deletions(-)

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



More information about the libc-commits mailing list