-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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 "include/" to the LLVM include directories #83199
Conversation
@llvm/pr-subscribers-libc Author: Joseph Huber (jhuber6) ChangesSummary: Full diff: https://github.com/llvm/llvm-project/pull/83199.diff 3 Files Affected:
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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we plan (and currently we do) to directly include many of those headers in llvm-libc-macros
and llvm-libc-types
directly in our internal implementations inside src
folder, we should add libc/include
in the include paths so that internal inclusions will match with installed headers as #include <llvm-libc-macros/*>
. WDYT? @nickdesaulniers @michaelrj-google @gchatelet
We'd end up with |
4a1fce7
to
7f4e1bd
Compare
@@ -9,7 +9,7 @@ | |||
#ifndef __LLVM_LIBC_TYPES_FLOAT128_H__ | |||
#define __LLVM_LIBC_TYPES_FLOAT128_H__ | |||
|
|||
#include <include/llvm-libc-macros/float-macros.h> // LDBL_MANT_DIG | |||
#include <llvm-libc-macros/float-macros.h> // LDBL_MANT_DIG |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should never have been <>
. While you're here, please change this to ""
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other headers seem to use <>
in stuff like math.h.def
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check my grep command. libc/include/llvm-libc-types/float128.h
is the ONLY place where <>
is used to include float-macros.h. Every other include uses ""
. Consistency is good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all the #include
s in /include/
for things in llvm-libc-types
or llvm-libc-macros
currently use <>
. It may be worthwhile to change this, but that should probably be one cleanup patch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filed: #83210
7f4e1bd
to
7e2d08d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming the result builds (please wait for presubmit results), this looks like a nice cleanup! Thanks! 👏 🤹
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.
7e2d08d
to
8c44a78
Compare
I added it in a few more locations, hopefully it fixes the CI. |
With some header fix forward for GPU builds.
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'sinstalled because we need to search from the root of the install dir.
This patch adds "include/" to the include path so that our inclusion
of installed headers always match the internal use.