]> granicus.if.org Git - clang/commitdiff
[ARM] Add ACLE enum/wchar size predefines
authorBradley Smith <bradley.smith@arm.com>
Mon, 20 Jan 2014 10:52:00 +0000 (10:52 +0000)
committerBradley Smith <bradley.smith@arm.com>
Mon, 20 Jan 2014 10:52:00 +0000 (10:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199642 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/Targets.cpp
test/Preprocessor/arm-target-features.c

index 65864cd1d0387abf84ea19fbf29edc0d0b294743..72f66416fbd17444405c8f258086a6a3481ff898 100644 (file)
@@ -4028,6 +4028,12 @@ public:
       Builder.defineMacro("__ARM_NEON__");
     }
 
+    Builder.defineMacro("__ARM_SIZEOF_WCHAR_T",
+                        Opts.ShortWChar ? "2" : "4");
+
+    Builder.defineMacro("__ARM_SIZEOF_MINIMAL_ENUM",
+                        Opts.ShortEnums ? "1" : "4");
+
     if (CRC)
       Builder.defineMacro("__ARM_FEATURE_CRC32");
 
index 4d40bcb3c670eaac2e246fa5dcbb66929b7e026a..c8aeb1ef70f94df95e3d923ef7b2d38806e67c45 100644 (file)
 // RUN: %clang -target armv8a-eabi -x c -E -dM %s -o - | FileCheck --check-prefix=THUMBV8A-EABI %s
 // THUMBV8A-EABI:#define __ARM_ARCH_EXT_IDIV__ 1
 
+// RUN: %clang -target arm-none-linux-gnu -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-DEFS %s
+// CHECK-DEFS:#define __ARM_SIZEOF_MINIMAL_ENUM 4
+// CHECK-DEFS:#define __ARM_SIZEOF_WCHAR_T 4
+
+// RUN: %clang -target arm-none-linux-gnu -fshort-wchar -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-SHORTWCHAR %s
+// CHECK-SHORTWCHAR:#define __ARM_SIZEOF_WCHAR_T 2
+
+// RUN: %clang -target arm-none-linux-gnu -fshort-enums -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-SHORTENUMS %s
+// CHECK-SHORTENUMS:#define __ARM_SIZEOF_MINIMAL_ENUM 1
 
 // Test that -mhwdiv has the right effect for a target CPU which has hwdiv enabled by default.
 // RUN: %clang -target armv7 -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTHWDIV-ARM %s