Skip to content

Commit

Permalink
Enable fdefine-target-os-macros in Darwin driver
Browse files Browse the repository at this point in the history
Enable the `-fdefine-target-os-macros` extension in the Darwin driver.
  • Loading branch information
zixu-w committed Oct 15, 2024
1 parent cbeae4d commit 70cfd01
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions clang/lib/Driver/ToolChains/Darwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3316,6 +3316,10 @@ void Darwin::addClangTargetOptions(
if (!RequiresSubdirectorySearch)
CC1Args.push_back("-fno-modulemap-allow-subdirectory-search");
}

if (!DriverArgs.hasArgNoClaim(options::OPT_fdefine_target_os_macros,
options::OPT_fno_define_target_os_macros))
CC1Args.push_back("-fdefine-target-os-macros");
}

void Darwin::addClangCC1ASTargetOptions(
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Driver/fdefine-target-os-macros.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: %clang -### --target=arm64-apple-darwin %s 2>&1 | FileCheck %s --check-prefix=DARWIN-DEFAULT
// DARWIN-DEFAULT-NOT: "-fdefine-target-os-macros"
// DARWIN-DEFAULT: "-fdefine-target-os-macros"

// RUN: %clang -### --target=arm-none-linux-gnu %s 2>&1 | FileCheck %s --check-prefix=NON-DARWIN-DEFAULT
// RUN: %clang -### --target=x86_64-pc-win32 %s 2>&1 | FileCheck %s --check-prefix=NON-DARWIN-DEFAULT
Expand Down

0 comments on commit 70cfd01

Please sign in to comment.