From 39dadd0628cd1f28be39a3ab35969545b7401623 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Fri, 1 Oct 2021 21:43:21 +0200 Subject: [PATCH] Stop clang 13 from defining conflicting macros on PowerPC Merge commit c9539f957f57 from llvm git (by Nemanja Ivanovic): [PowerPC] Define XL-compatible macros only for AIX and Linux Since XLC only ever shipped on PowerPC AIX and Linux, it is not reasonable to provide the compatibility macros on any target other than those two. This patch restricts those macros to AIX/Linux. Differential revision: https://reviews.llvm.org/D110213 PR: 258209 --- contrib/llvm-project/clang/lib/Basic/Targets/PPC.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/contrib/llvm-project/clang/lib/Basic/Targets/PPC.cpp b/contrib/llvm-project/clang/lib/Basic/Targets/PPC.cpp index 59656888e25f..ecfbe284fb2e 100644 --- a/contrib/llvm-project/clang/lib/Basic/Targets/PPC.cpp +++ b/contrib/llvm-project/clang/lib/Basic/Targets/PPC.cpp @@ -243,7 +243,10 @@ static void defineXLCompatMacros(MacroBuilder &Builder) { void PPCTargetInfo::getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const { - defineXLCompatMacros(Builder); + // We define the XLC compatibility macros only on AIX and Linux since XLC + // was never available on any other platforms. + if (getTriple().isOSAIX() || getTriple().isOSLinux()) + defineXLCompatMacros(Builder); // Target identification. Builder.defineMacro("__ppc__");