[PATCH] D103587: Add AIX predefined macros

Jake Egan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 2 20:48:37 PDT 2021


Jake-Egan created this revision.
Herald added subscribers: jfb, kbarton, nemanjai.
Jake-Egan requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D103587

Files:
  clang/lib/Basic/Targets/OSTargets.h
  clang/lib/Basic/Targets/PPC.cpp
  clang/test/Preprocessor/init-aix.c


Index: clang/test/Preprocessor/init-aix.c
===================================================================
--- /dev/null
+++ clang/test/Preprocessor/init-aix.c
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix AIX %s
+// AIX:#define __THW_PPC__ 1
+// AIX:#define __TOS_AIX__ 1
+// AIX-NOT:#define __STDC_NO_ATOMICS__ 1
+// AIX-NOT:#define __STDC_NO_THREADS__ 1
+//
+// RUN: %clang_cc1 -x c -std=c11 -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix AIX-STDC %s
+// RUN: %clang_cc1 -x c -std=c1x -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix AIX-STDC %s
+// RUN: %clang_cc1 -x c -std=iso9899:2011 -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix AIX-STDC %s
+// RUN: %clang_cc1 -x c -std=gnu11 -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix AIX-STDC %s
+// AIX-STDC:#define __STDC_NO_ATOMICS__ 1
+// AIX-STDC:#define __STDC_NO_THREADS__ 1
Index: clang/lib/Basic/Targets/PPC.cpp
===================================================================
--- clang/lib/Basic/Targets/PPC.cpp
+++ clang/lib/Basic/Targets/PPC.cpp
@@ -92,6 +92,7 @@
   Builder.defineMacro("__ppc__");
   Builder.defineMacro("__PPC__");
   Builder.defineMacro("_ARCH_PPC");
+  Builder.defineMacro("__THW_PPC__");
   Builder.defineMacro("__powerpc__");
   Builder.defineMacro("__POWERPC__");
   if (PointerWidth == 64) {
Index: clang/lib/Basic/Targets/OSTargets.h
===================================================================
--- clang/lib/Basic/Targets/OSTargets.h
+++ clang/lib/Basic/Targets/OSTargets.h
@@ -674,8 +674,15 @@
     Builder.defineMacro("_IBMR2");
     Builder.defineMacro("_POWER");
 
+    Builder.defineMacro("__TOS_AIX__");
     Builder.defineMacro("_AIX");
 
+    if (Opts.LangStd == LangStandard::lang_c11 ||
+        Opts.LangStd == LangStandard::lang_gnu11){
+      Builder.defineMacro("__STDC_NO_ATOMICS__");
+      Builder.defineMacro("__STDC_NO_THREADS__");
+    }
+
     if (Opts.EnableAIXExtendedAltivecABI)
       Builder.defineMacro("__EXTABI__");
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103587.349445.patch
Type: text/x-patch
Size: 2065 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210603/126eaa6d/attachment.bin>


More information about the cfe-commits mailing list