Author: Jake Egan Date: 2021-08-06T10:40:13-04:00 New Revision: 869d07ee88a4355f5954ef9e2b2e79ceff225ddb
URL: https://github.com/llvm/llvm-project/commit/869d07ee88a4355f5954ef9e2b2e79ceff225ddb DIFF: https://github.com/llvm/llvm-project/commit/869d07ee88a4355f5954ef9e2b2e79ceff225ddb.diff LOG: [AIX] Define __HOS_AIX__ macro %%% This patch defines __HOS_AIX__ macro for AIX in case of a cross compiler implementation. %%% Tested with SPEC. Reviewed By: cebowleratibm Differential Revision: https://reviews.llvm.org/D107242 Added: clang/test/Preprocessor/host-aix.c clang/test/Preprocessor/not-host-aix.c Modified: clang/lib/Basic/Targets/PPC.cpp Removed: ################################################################################ diff --git a/clang/lib/Basic/Targets/PPC.cpp b/clang/lib/Basic/Targets/PPC.cpp index a888e22697de..4ee7282c06ce 100644 --- a/clang/lib/Basic/Targets/PPC.cpp +++ b/clang/lib/Basic/Targets/PPC.cpp @@ -14,6 +14,7 @@ #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; @@ -304,6 +305,11 @@ 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 new file mode 100644 index 000000000000..81d594ba5803 --- /dev/null +++ b/clang/test/Preprocessor/host-aix.c @@ -0,0 +1,3 @@ +// 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/not-host-aix.c b/clang/test/Preprocessor/not-host-aix.c new file mode 100644 index 000000000000..d6a2d22a7d25 --- /dev/null +++ b/clang/test/Preprocessor/not-host-aix.c @@ -0,0 +1,3 @@ +// 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 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits