Skip to content
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

Guard hardcoded defines with cpp. #43

Open
wants to merge 1 commit into
base: flang_release_50
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/Driver/ToolChains/Flang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,12 +572,20 @@ void FlangFrontend::ConstructJob(Compilation &C, const JobAction &JA,
// Add system include arguments.
getToolChain().AddFlangSystemIncludeArgs(Args, UpperCmdArgs);

#if defined(unix) || defined(__unix) || defined(__unix__)
UpperCmdArgs.push_back("-def"); UpperCmdArgs.push_back("unix");
UpperCmdArgs.push_back("-def"); UpperCmdArgs.push_back("__unix");
UpperCmdArgs.push_back("-def"); UpperCmdArgs.push_back("__unix__");
#endif
#if defined(linux) || defined(__linux) || defined(__linux__)
UpperCmdArgs.push_back("-def"); UpperCmdArgs.push_back("linux");
UpperCmdArgs.push_back("-def"); UpperCmdArgs.push_back("__linux");
UpperCmdArgs.push_back("-def"); UpperCmdArgs.push_back("__linux__");
#elif defined(__FreeBSD__)
UpperCmdArgs.push_back("-def"); UpperCmdArgs.push_back("__FreeBSD__");
#elif defined(__OpenBSD__)
UpperCmdArgs.push_back("-def"); UpperCmdArgs.push_back("__OpenBSD__");
#endif
UpperCmdArgs.push_back("-def"); UpperCmdArgs.push_back("__NO_MATH_INLINES");
UpperCmdArgs.push_back("-def"); UpperCmdArgs.push_back("__LP64__");
UpperCmdArgs.push_back("-def"); UpperCmdArgs.push_back("__x86_64");
Expand Down