[cfe-commits] r145102 - in /cfe/trunk: lib/Basic/Targets.cpp test/Preprocessor/init.c test/Preprocessor/stdint.c

James Molloy james.molloy at arm.com
Wed Nov 23 05:35:08 PST 2011


Author: jamesm
Date: Wed Nov 23 07:35:08 2011
New Revision: 145102

URL: http://llvm.org/viewvc/llvm-project?rev=145102&view=rev
Log:
AAPCS compliance - 32-bit wchar_t should be unsigned for both aapcs and aapcs-linux.

Original behaviour of defining wchar_t as signed int has been kept for apcs-gnu as I don't have any spec for this to validate against.


Modified:
    cfe/trunk/lib/Basic/Targets.cpp
    cfe/trunk/test/Preprocessor/init.c
    cfe/trunk/test/Preprocessor/stdint.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=145102&r1=145101&r2=145102&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Wed Nov 23 07:35:08 2011
@@ -2404,6 +2404,8 @@
   {
     SizeType = UnsignedInt;
     PtrDiffType = SignedInt;
+    // AAPCS 7.1.1, ARM-Linux ABI 2.4: type of wchar_t is unsigned int.
+    WCharType = UnsignedInt;
 
     // {} in inline assembly are neon specifiers, not assembly variant
     // specifiers.
@@ -2442,6 +2444,9 @@
       DoubleAlign = LongLongAlign = LongDoubleAlign = 32;
       SizeType = UnsignedLong;
 
+      // Revert to using SignedInt on apcs-gnu to comply with existing behaviour.
+      WCharType = SignedInt;
+
       // Do not respect the alignment of bit-field types when laying out
       // structures. This corresponds to PCC_BITFIELD_TYPE_MATTERS in gcc.
       UseBitFieldTypeAlignment = false;

Modified: cfe/trunk/test/Preprocessor/init.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=145102&r1=145101&r2=145102&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/init.c (original)
+++ cfe/trunk/test/Preprocessor/init.c Wed Nov 23 07:35:08 2011
@@ -212,8 +212,8 @@
 // ARM:#define __THUMB_INTERWORK__ 1
 // ARM:#define __UINTMAX_TYPE__ long long unsigned int
 // ARM:#define __USER_LABEL_PREFIX__ _
-// ARM:#define __WCHAR_MAX__ 2147483647
-// ARM:#define __WCHAR_TYPE__ int
+// ARM:#define __WCHAR_MAX__ 4294967295U
+// ARM:#define __WCHAR_TYPE__ unsigned int
 // ARM:#define __WCHAR_WIDTH__ 32
 // ARM:#define __WINT_TYPE__ int
 // ARM:#define __WINT_WIDTH__ 32

Modified: cfe/trunk/test/Preprocessor/stdint.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/stdint.c?rev=145102&r1=145101&r2=145102&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/stdint.c (original)
+++ cfe/trunk/test/Preprocessor/stdint.c Wed Nov 23 07:35:08 2011
@@ -90,8 +90,8 @@
 // ARM:WINT_MIN_ (-2147483647 -1)
 // ARM:WINT_MAX_ 2147483647
 //
-// ARM:WCHAR_MAX_ 2147483647
-// ARM:WCHAR_MIN_ (-2147483647 -1)
+// ARM:WCHAR_MAX_ 4294967295U
+// ARM:WCHAR_MIN_ 0U
 //
 // ARM:INT8_C_(0) 0
 // ARM:UINT8_C_(0) 0U





More information about the cfe-commits mailing list