Jake-Egan updated this revision to Diff 364685. Jake-Egan added a comment. Only define if AIX is the target and host.
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D107242/new/ https://reviews.llvm.org/D107242 Files: clang/lib/Basic/Targets/PPC.cpp clang/test/Preprocessor/host-aix.c clang/test/Preprocessor/not-host-aix.c Index: clang/test/Preprocessor/not-host-aix.c =================================================================== --- /dev/null +++ clang/test/Preprocessor/not-host-aix.c @@ -0,0 +1,3 @@ +// UNSUPPORTED: system-aix +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-unknown-linux-gnu -fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix PPC-LINUX %s +// PPC-LINUX-NOT:#define __HOS_AIX__ 1 Index: clang/test/Preprocessor/host-aix.c =================================================================== --- /dev/null +++ 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 Index: clang/lib/Basic/Targets/PPC.cpp =================================================================== --- clang/lib/Basic/Targets/PPC.cpp +++ 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; @@ -301,6 +302,11 @@ Builder.defineMacro("__LONGDOUBLE64"); } + llvm::Triple HostTriple(llvm::sys::getProcessTriple()); + if (HostTriple.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))
Index: clang/test/Preprocessor/not-host-aix.c =================================================================== --- /dev/null +++ clang/test/Preprocessor/not-host-aix.c @@ -0,0 +1,3 @@ +// UNSUPPORTED: system-aix +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-unknown-linux-gnu -fno-signed-char < /dev/null | FileCheck -match-full-lines -check-prefix PPC-LINUX %s +// PPC-LINUX-NOT:#define __HOS_AIX__ 1 Index: clang/test/Preprocessor/host-aix.c =================================================================== --- /dev/null +++ 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 Index: clang/lib/Basic/Targets/PPC.cpp =================================================================== --- clang/lib/Basic/Targets/PPC.cpp +++ 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; @@ -301,6 +302,11 @@ Builder.defineMacro("__LONGDOUBLE64"); } + llvm::Triple HostTriple(llvm::sys::getProcessTriple()); + if (HostTriple.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))
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits