[clang] 3b39fa3 - [AIX] Define __HOS_AIX__ macro only for AIX target
Jake Egan via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 10 10:03:31 PDT 2021
Author: Jake Egan
Date: 2021-08-10T13:03:17-04:00
New Revision: 3b39fa3e2815538187ed8928549a9f27c6a71ef6
URL: https://github.com/llvm/llvm-project/commit/3b39fa3e2815538187ed8928549a9f27c6a71ef6
DIFF: https://github.com/llvm/llvm-project/commit/3b39fa3e2815538187ed8928549a9f27c6a71ef6.diff
LOG: [AIX] Define __HOS_AIX__ macro only for AIX target
%%%
This patch defines the macro __HOS_AIX__ when the target is AIX and without any dependency on the host. The macro indicates that the host is AIX. Defining the macro will help minimize porting pain for existing code compiled with xlc/xlC. xlC never shipped cross-compiling support, so the difference is not observable anyway.
%%%
This is a follow up to the discussion in https://reviews.llvm.org/D107242.
Reviewed By: cebowleratibm, joerg
Differential Revision: https://reviews.llvm.org/D107825
Added:
Modified:
clang/lib/Basic/Targets/OSTargets.h
clang/lib/Basic/Targets/PPC.cpp
clang/test/Preprocessor/init-ppc.c
Removed:
clang/test/Preprocessor/host-aix.c
clang/test/Preprocessor/not-host-aix.c
################################################################################
diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h
index 28d4c77d47ca..440ec63f9cef 100644
--- a/clang/lib/Basic/Targets/OSTargets.h
+++ b/clang/lib/Basic/Targets/OSTargets.h
@@ -677,6 +677,7 @@ class AIXTargetInfo : public OSTargetInfo<Target> {
Builder.defineMacro("_AIX");
Builder.defineMacro("__TOS_AIX__");
+ Builder.defineMacro("__HOS_AIX__");
if (Opts.C11) {
Builder.defineMacro("__STDC_NO_ATOMICS__");
diff --git a/clang/lib/Basic/Targets/PPC.cpp b/clang/lib/Basic/Targets/PPC.cpp
index 711ba2837a9b..33f266f02b69 100644
--- a/clang/lib/Basic/Targets/PPC.cpp
+++ b/clang/lib/Basic/Targets/PPC.cpp
@@ -14,7 +14,6 @@
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/MacroBuilder.h"
#include "clang/Basic/TargetBuiltins.h"
-#include "llvm/Support/Host.h"
using namespace clang;
using namespace clang::targets;
@@ -308,11 +307,6 @@ void PPCTargetInfo::getTargetDefines(const LangOptions &Opts,
Builder.defineMacro("__LONGDOUBLE64");
}
- if (llvm::Triple(llvm::sys::getProcessTriple()).isOSAIX() &&
- getTriple().isOSAIX()) {
- Builder.defineMacro("__HOS_AIX__");
- }
-
// Define this for elfv2 (64-bit only) or 64-bit darwin.
if (ABI == "elfv2" ||
(getTriple().getOS() == llvm::Triple::Darwin && PointerWidth == 64))
diff --git a/clang/test/Preprocessor/host-aix.c b/clang/test/Preprocessor/host-aix.c
deleted file mode 100644
index 81d594ba5803..000000000000
--- a/clang/test/Preprocessor/host-aix.c
+++ /dev/null
@@ -1,3 +0,0 @@
-// REQUIRES: system-aix
-// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-ibm-aix7.1.0.0 -fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix PPC-AIX %s
-// PPC-AIX:#define __HOS_AIX__ 1
diff --git a/clang/test/Preprocessor/init-ppc.c b/clang/test/Preprocessor/init-ppc.c
index fedc1b6c9140..ca61143e8dc9 100644
--- a/clang/test/Preprocessor/init-ppc.c
+++ b/clang/test/Preprocessor/init-ppc.c
@@ -432,6 +432,7 @@
// PPC-AIX:#define __FLT_MIN_EXP__ (-125)
// PPC-AIX:#define __FLT_MIN__ 1.17549435e-38F
// PPC-AIX:#define __FLT_RADIX__ 2
+// PPC-AIX:#define __HOS_AIX__ 1
// PPC-AIX:#define __INT16_C_SUFFIX__
// PPC-AIX:#define __INT16_FMTd__ "hd"
// PPC-AIX:#define __INT16_FMTi__ "hi"
diff --git a/clang/test/Preprocessor/not-host-aix.c b/clang/test/Preprocessor/not-host-aix.c
deleted file mode 100644
index d6a2d22a7d25..000000000000
--- a/clang/test/Preprocessor/not-host-aix.c
+++ /dev/null
@@ -1,3 +0,0 @@
-// UNSUPPORTED: system-aix
-// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-ibm-aix7.1.0.0 -fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix PPC-AIX %s
-// PPC-AIX-NOT:#define __HOS_AIX__ 1
More information about the cfe-commits
mailing list