-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Meta: Pass compiler's builtin includes to jakt too #25573
base: master
Are you sure you want to change the base?
Conversation
0d3b912
to
d7b14c3
Compare
d7b14c3
to
9638b96
Compare
This is not an issue with clang, but when gcc is used as the c++ compiler, jakt can't know its builtin include paths; so come up with a nice and hacky cmake blob to fix the problem.
ae69281
to
fbc32fc
Compare
fbc32fc
to
5ab284f
Compare
Hello! One or more of the commit messages in this PR do not match the SerenityOS code submission policy, please check the |
|
||
# Get the builtin/system includes | ||
# Equivalent to $CXX -E test.cpp |& sed -e '/^# 1 /p;d' | sed -e 's/# 1 "//;s/"[^"]*$//' | ||
file(WRITE ${CMAKE_BINARY_DIR}/jakt_test.cpp "#include <new>") |
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 mean, this works. But would it be easier to understand if it was a python script instead?
I'm scared of regexes :)
Also why are there two commands? Surely This is good enough?
$ ./Toolchain/Local/aarch64/bin/aarch64-pc-serenity-gcc -xc++ -E -Wp,-v - < /dev/null
ignoring nonexistent directory "/Users/andrew/Source/serenity/Toolchain/../Build/aarch64/Root/usr/local/include"
#include "..." search starts here:
#include <...> search starts here:
/Users/andrew/Source/serenity/Toolchain/Local/aarch64/lib/gcc/aarch64-pc-serenity/13.2.0/../../../../aarch64-pc-serenity/include/c++/13.2.0
/Users/andrew/Source/serenity/Toolchain/Local/aarch64/lib/gcc/aarch64-pc-serenity/13.2.0/../../../../aarch64-pc-serenity/include/c++/13.2.0/aarch64-pc-serenity
/Users/andrew/Source/serenity/Toolchain/Local/aarch64/lib/gcc/aarch64-pc-serenity/13.2.0/../../../../aarch64-pc-serenity/include/c++/13.2.0/backward
/Users/andrew/Source/serenity/Toolchain/Local/aarch64/lib/gcc/aarch64-pc-serenity/13.2.0/include
/Users/andrew/Source/serenity/Toolchain/Local/aarch64/lib/gcc/aarch64-pc-serenity/13.2.0/include-fixed
/Users/andrew/Source/serenity/Toolchain/Local/aarch64/lib/gcc/aarch64-pc-serenity/13.2.0/../../../../aarch64-pc-serenity/include
/Users/andrew/Source/serenity/Toolchain/../Build/aarch64/Root/usr/include
End of search list.
# 0 "<stdin>"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "<stdin>"
got_dotdotdot = False
paths = []
for path.strip() in lines:
if not got_dotdotdot:
if path == "#include "..." search starts here:"
got_dotdotdot = True
continue
if path == "#include <...> search starts here:"
continue
if path == "End of search list."
break
paths.append(pathlib.Path(path.split(" ")[0]).resolve())
?
This is not an issue with clang, but when gcc is used as the c++ compiler, jakt can't know its builtin include paths; so come up with a nice and hacky cmake blob to fix the problem.
Warning: hacky!