[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
This commit is contained in:
Jake Egan 2021-08-10 11:38:48 -04:00
parent 1123100a16
commit 3b39fa3e28
5 changed files with 2 additions and 12 deletions

View file

@ -677,6 +677,7 @@ protected:
Builder.defineMacro("_AIX");
Builder.defineMacro("__TOS_AIX__");
Builder.defineMacro("__HOS_AIX__");
if (Opts.C11) {
Builder.defineMacro("__STDC_NO_ATOMICS__");

View file

@ -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))

View file

@ -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

View file

@ -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"

View file

@ -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