Skip to content

Commit 7672977

Browse files
committed
[Fix] Disable fdefine-target-os-macros for now (llvm#74886)
llvm#74676 landed the work to implement `-fdefine-target-os-macros` and enabled the extension for the Darwin driver. However it is breaking some test builds. Leave the extension disabled for now until we can fix/workaround the build failures. (cherry picked from commit c9b4bb9)
1 parent 52d6d4d commit 7672977

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

clang/lib/Driver/ToolChains/Darwin.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3131,10 +3131,6 @@ void Darwin::addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
31313131
// to fix the same problem with C++ headers, and is generally fragile.
31323132
if (!sdkSupportsBuiltinModules(TargetPlatform, SDKInfo))
31333133
CC1Args.push_back("-fbuiltin-headers-in-system-modules");
3134-
3135-
if (!DriverArgs.hasArgNoClaim(options::OPT_fdefine_target_os_macros,
3136-
options::OPT_fno_define_target_os_macros))
3137-
CC1Args.push_back("-fdefine-target-os-macros");
31383134
}
31393135

31403136
void Darwin::addClangCC1ASTargetOptions(

clang/test/Driver/fdefine-target-os-macros.c

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
// RUN: %clang -### --target=arm64-apple-darwin %s 2>&1 | FileCheck %s --check-prefix=DARWIN-DEFAULT
2-
// DARWIN-DEFAULT: "-fdefine-target-os-macros"
2+
// DARWIN-DEFAULT-NOT: "-fdefine-target-os-macros"
33

44
// RUN: %clang -### --target=arm-none-linux-gnu %s 2>&1 | FileCheck %s --check-prefix=NON-DARWIN-DEFAULT
55
// RUN: %clang -### --target=x86_64-pc-win32 %s 2>&1 | FileCheck %s --check-prefix=NON-DARWIN-DEFAULT
66
// NON-DARWIN-DEFAULT-NOT: "-fdefine-target-os-macros"
77

8-
// RUN: %clang -dM -E --target=arm64-apple-macos %s 2>&1 \
8+
// RUN: %clang -dM -E --target=arm64-apple-macos \
9+
// RUN: -fdefine-target-os-macros %s 2>&1 \
910
// RUN: | FileCheck %s -DMAC=1 \
1011
// RUN: -DOSX=1 \
1112
// RUN: -DIPHONE=0 \
@@ -21,7 +22,8 @@
2122
// RUN: -DLINUX=0 \
2223
// RUN: -DUNIX=0
2324

24-
// RUN: %clang -dM -E --target=arm64-apple-ios %s 2>&1 \
25+
// RUN: %clang -dM -E --target=arm64-apple-ios \
26+
// RUN: -fdefine-target-os-macros %s 2>&1 \
2527
// RUN: | FileCheck %s -DMAC=1 \
2628
// RUN: -DOSX=0 \
2729
// RUN: -DIPHONE=1 \
@@ -37,7 +39,8 @@
3739
// RUN: -DLINUX=0 \
3840
// RUN: -DUNIX=0
3941

40-
// RUN: %clang -dM -E --target=arm64-apple-ios-macabi %s 2>&1 \
42+
// RUN: %clang -dM -E --target=arm64-apple-ios-macabi \
43+
// RUN: -fdefine-target-os-macros %s 2>&1 \
4144
// RUN: | FileCheck %s -DMAC=1 \
4245
// RUN: -DOSX=0 \
4346
// RUN: -DIPHONE=1 \
@@ -53,7 +56,8 @@
5356
// RUN: -DLINUX=0 \
5457
// RUN: -DUNIX=0
5558

56-
// RUN: %clang -dM -E --target=arm64-apple-ios-simulator %s 2>&1 \
59+
// RUN: %clang -dM -E --target=arm64-apple-ios-simulator \
60+
// RUN: -fdefine-target-os-macros %s 2>&1 \
5761
// RUN: | FileCheck %s -DMAC=1 \
5862
// RUN: -DOSX=0 \
5963
// RUN: -DIPHONE=1 \
@@ -69,7 +73,8 @@
6973
// RUN: -DLINUX=0 \
7074
// RUN: -DUNIX=0
7175

72-
// RUN: %clang -dM -E --target=arm64-apple-tvos %s 2>&1 \
76+
// RUN: %clang -dM -E --target=arm64-apple-tvos \
77+
// RUN: -fdefine-target-os-macros %s 2>&1 \
7378
// RUN: | FileCheck %s -DMAC=1 \
7479
// RUN: -DOSX=0 \
7580
// RUN: -DIPHONE=1 \
@@ -85,7 +90,8 @@
8590
// RUN: -DLINUX=0 \
8691
// RUN: -DUNIX=0
8792

88-
// RUN: %clang -dM -E --target=arm64-apple-tvos-simulator %s 2>&1 \
93+
// RUN: %clang -dM -E --target=arm64-apple-tvos-simulator \
94+
// RUN: -fdefine-target-os-macros %s 2>&1 \
8995
// RUN: | FileCheck %s -DMAC=1 \
9096
// RUN: -DOSX=0 \
9197
// RUN: -DIPHONE=1 \
@@ -101,7 +107,8 @@
101107
// RUN: -DLINUX=0 \
102108
// RUN: -DUNIX=0
103109

104-
// RUN: %clang -dM -E --target=arm64-apple-watchos %s 2>&1 \
110+
// RUN: %clang -dM -E --target=arm64-apple-watchos \
111+
// RUN: -fdefine-target-os-macros %s 2>&1 \
105112
// RUN: | FileCheck %s -DMAC=1 \
106113
// RUN: -DOSX=0 \
107114
// RUN: -DIPHONE=1 \
@@ -117,7 +124,8 @@
117124
// RUN: -DLINUX=0 \
118125
// RUN: -DUNIX=0
119126

120-
// RUN: %clang -dM -E --target=arm64-apple-watchos-simulator %s 2>&1 \
127+
// RUN: %clang -dM -E --target=arm64-apple-watchos-simulator \
128+
// RUN: -fdefine-target-os-macros %s 2>&1 \
121129
// RUN: | FileCheck %s -DMAC=1 \
122130
// RUN: -DOSX=0 \
123131
// RUN: -DIPHONE=1 \
@@ -165,7 +173,8 @@
165173
// RUN: -DLINUX=0 \
166174
// RUN: -DUNIX=0
167175

168-
// RUN: %clang -dM -E --target=arm64-apple-driverkit %s 2>&1 \
176+
// RUN: %clang -dM -E --target=arm64-apple-driverkit \
177+
// RUN: -fdefine-target-os-macros %s 2>&1 \
169178
// RUN: | FileCheck %s -DMAC=1 \
170179
// RUN: -DOSX=0 \
171180
// RUN: -DIPHONE=0 \

0 commit comments

Comments
 (0)