git: 39dadd0628cd - main - Stop clang 13 from defining conflicting macros on PowerPC

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Sat, 13 Nov 2021 20:57:10 UTC
The branch main has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=39dadd0628cd1f28be39a3ab35969545b7401623

commit 39dadd0628cd1f28be39a3ab35969545b7401623
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2021-10-01 19:43:21 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2021-11-13 20:52:23 +0000

    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__");