[clang] e7b6c0f - [clang][XCore] Define __xcore__ for XCore target.
Nigel Perks via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 26 07:07:02 PDT 2021
Author: Nigel Perks
Date: 2021-04-26T15:06:04+01:00
New Revision: e7b6c0f398ee5975bf9f39e629713ae446e8fe01
URL: https://github.com/llvm/llvm-project/commit/e7b6c0f398ee5975bf9f39e629713ae446e8fe01
DIFF: https://github.com/llvm/llvm-project/commit/e7b6c0f398ee5975bf9f39e629713ae446e8fe01.diff
LOG: [clang][XCore] Define __xcore__ for XCore target.
The headers shipped with the XMOS XCore compiler expect __xcore__ to be defined.
The __XS1B__ macro, already defined, is for the default subtarget.
No other targets affected.
Added:
Modified:
clang/lib/Basic/Targets/XCore.cpp
clang/test/Preprocessor/init.c
Removed:
################################################################################
diff --git a/clang/lib/Basic/Targets/XCore.cpp b/clang/lib/Basic/Targets/XCore.cpp
index da614f10e338f..ba64f15f3394a 100644
--- a/clang/lib/Basic/Targets/XCore.cpp
+++ b/clang/lib/Basic/Targets/XCore.cpp
@@ -28,6 +28,7 @@ const Builtin::Info XCoreTargetInfo::BuiltinInfo[] = {
void XCoreTargetInfo::getTargetDefines(const LangOptions &Opts,
MacroBuilder &Builder) const {
+ Builder.defineMacro("__xcore__");
Builder.defineMacro("__XS1B__");
}
diff --git a/clang/test/Preprocessor/init.c b/clang/test/Preprocessor/init.c
index 0329453c4136b..be60eb6d9cf61 100644
--- a/clang/test/Preprocessor/init.c
+++ b/clang/test/Preprocessor/init.c
@@ -1468,6 +1468,7 @@
// XCORE:#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
// XCORE:#define __LITTLE_ENDIAN__ 1
// XCORE:#define __XS1B__ 1
+// XCORE:#define __xcore__ 1
//
// RUN: %clang_cc1 -E -dM -ffreestanding -fgnuc-version=4.2.1 -triple=wasm32-unknown-unknown \
// RUN: < /dev/null \
More information about the cfe-commits
mailing list