[cfe-commits] r89101 - in /cfe/trunk: lib/Headers/stdint.h test/Preprocessor/stdint.c

Ken Dyck ken.dyck at onsemi.com
Tue Nov 17 08:26:27 PST 2009


Author: kjdyck
Date: Tue Nov 17 10:26:27 2009
New Revision: 89101

URL: http://llvm.org/viewvc/llvm-project?rev=89101&view=rev
Log:
Use the INTn_C integer constant macros to generate limit constants with correct
suffixes. This corrects the suffixes for the limit constants of the 32-bit
types on MSP430 and PIC16, and the 64-bit types on PPC64, SystemZ, X86_64.


Modified:
    cfe/trunk/lib/Headers/stdint.h
    cfe/trunk/test/Preprocessor/stdint.c

Modified: cfe/trunk/lib/Headers/stdint.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/stdint.h?rev=89101&r1=89100&r2=89101&view=diff

==============================================================================
--- cfe/trunk/lib/Headers/stdint.h (original)
+++ cfe/trunk/lib/Headers/stdint.h Tue Nov 17 10:26:27 2009
@@ -420,9 +420,9 @@
  */
 
 #ifdef __INT64_TYPE__
-# define INT64_MAX     9223372036854775807LL
-# define INT64_MIN   (-9223372036854775807LL-1)
-# define UINT64_MAX   18446744073709551615ULL
+# define INT64_MAX           INT64_C( 9223372036854775807)
+# define INT64_MIN         (-INT64_C( 9223372036854775807)-1)
+# define UINT64_MAX         UINT64_C(18446744073709551615)
 # define __INT_LEAST64_MIN   INT64_MIN
 # define __INT_LEAST64_MAX   INT64_MAX
 # define __UINT_LEAST64_MAX UINT64_MAX
@@ -448,9 +448,9 @@
 
 
 #ifdef __INT56_TYPE__
-# define INT56_MAX   36028797018963967L
-# define INT56_MIN (-36028797018963967L-1)
-# define UINT56_MAX  72057594037927935UL
+# define INT56_MAX           INT56_C(36028797018963967)
+# define INT56_MIN         (-INT56_C(36028797018963967)-1)
+# define UINT56_MAX         UINT56_C(72057594037927935)
 # define INT_LEAST56_MIN     INT56_MIN
 # define INT_LEAST56_MAX     INT56_MAX
 # define UINT_LEAST56_MAX   UINT56_MAX
@@ -470,9 +470,9 @@
 
 
 #ifdef __INT48_TYPE__
-# define INT48_MAX     140737488355327L
-# define INT48_MIN   (-140737488355327L-1)
-# define UINT48_MAX    281474976710655UL
+# define INT48_MAX           INT48_C(140737488355327)
+# define INT48_MIN         (-INT48_C(140737488355327)-1)
+# define UINT48_MAX         UINT48_C(281474976710655)
 # define INT_LEAST48_MIN     INT48_MIN
 # define INT_LEAST48_MAX     INT48_MAX
 # define UINT_LEAST48_MAX   UINT48_MAX
@@ -492,9 +492,9 @@
 
 
 #ifdef __INT40_TYPE__
-# define INT40_MAX        549755813887L
-# define INT40_MIN      (-549755813887L-1)
-# define UINT40_MAX      1099511627775UL
+# define INT40_MAX           INT40_C(549755813887)
+# define INT40_MIN         (-INT40_C(549755813887)-1)
+# define UINT40_MAX         UINT40_C(1099511627775)
 # define INT_LEAST40_MIN     INT40_MIN
 # define INT_LEAST40_MAX     INT40_MAX
 # define UINT_LEAST40_MAX   UINT40_MAX
@@ -514,9 +514,9 @@
 
 
 #ifdef __INT32_TYPE__
-# define INT32_MAX          2147483647
-# define INT32_MIN        (-2147483647-1)
-# define UINT32_MAX         4294967295U
+# define INT32_MAX           INT32_C(2147483647)
+# define INT32_MIN         (-INT32_C(2147483647)-1)
+# define UINT32_MAX         UINT32_C(4294967295)
 # define __INT_LEAST32_MIN   INT32_MIN
 # define __INT_LEAST32_MAX   INT32_MAX
 # define __UINT_LEAST32_MAX UINT32_MAX
@@ -539,9 +539,10 @@
 
 
 #ifdef __INT24_TYPE__
-# define INT24_MAX             8388607
-# define INT24_MIN           (-8388608)
-# define UINT24_MAX           16777215
+# define INT24_MAX           INT24_C(8388607)
+/* FIXME: argument of 8388608 for INT24_C is outside of legal range */
+# define INT24_MIN         (-INT24_C(8388608))
+# define UINT24_MAX         UINT24_C(16777215)
 # define INT_LEAST24_MIN     INT24_MIN
 # define INT_LEAST24_MAX     INT24_MAX
 # define UINT_LEAST24_MAX   UINT24_MAX
@@ -558,9 +559,10 @@
 
 
 #ifdef __INT16_TYPE__
-#define INT16_MAX                32767
-#define INT16_MIN              (-32768)
-#define UINT16_MAX               65535
+#define INT16_MAX            INT16_C(32767)
+/* FIXME: argument of 32768 for INT16_C is outside of legal range */
+#define INT16_MIN          (-INT16_C(32768))
+#define UINT16_MAX          UINT16_C(65535)
 # define __INT_LEAST16_MIN   INT16_MIN
 # define __INT_LEAST16_MAX   INT16_MAX
 # define __UINT_LEAST16_MAX UINT16_MAX
@@ -580,9 +582,10 @@
 
 
 #ifdef __INT8_TYPE__
-# define INT8_MAX                 127
-# define INT8_MIN               (-128)
-# define UINT8_MAX                255
+# define INT8_MAX            INT8_C(127)
+/* FIXME: argument of 128 for INT8_C is outside of legal range */
+# define INT8_MIN          (-INT8_C(128))
+# define UINT8_MAX          UINT8_C(255)
 # define __INT_LEAST8_MIN    INT8_MIN
 # define __INT_LEAST8_MAX    INT8_MAX
 # define __UINT_LEAST8_MAX  UINT8_MAX

Modified: cfe/trunk/test/Preprocessor/stdint.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/stdint.c?rev=89101&r1=89100&r2=89101&view=diff

==============================================================================
--- cfe/trunk/test/Preprocessor/stdint.c (original)
+++ cfe/trunk/test/Preprocessor/stdint.c Tue Nov 17 10:26:27 2009
@@ -370,15 +370,15 @@
 // MSP430:INT_FAST16_MAX_ 32767
 // MSP430:UINT_FAST16_MAX_ 65535
 //
-// MSP430:INT32_MAX_ 2147483647
-// MSP430:INT32_MIN_ (-2147483647 -1)
-// MSP430:UINT32_MAX_ 4294967295U
-// MSP430:INT_LEAST32_MIN_ (-2147483647 -1)
-// MSP430:INT_LEAST32_MAX_ 2147483647
-// MSP430:UINT_LEAST32_MAX_ 4294967295U
-// MSP430:INT_FAST32_MIN_ (-2147483647 -1)
-// MSP430:INT_FAST32_MAX_ 2147483647
-// MSP430:UINT_FAST32_MAX_ 4294967295U
+// MSP430:INT32_MAX_ 2147483647L
+// MSP430:INT32_MIN_ (-2147483647L -1)
+// MSP430:UINT32_MAX_ 4294967295UL
+// MSP430:INT_LEAST32_MIN_ (-2147483647L -1)
+// MSP430:INT_LEAST32_MAX_ 2147483647L
+// MSP430:UINT_LEAST32_MAX_ 4294967295UL
+// MSP430:INT_FAST32_MIN_ (-2147483647L -1)
+// MSP430:INT_FAST32_MAX_ 2147483647L
+// MSP430:UINT_FAST32_MAX_ 4294967295UL
 //
 // MSP430:INT64_MAX_ INT64_MAX
 // MSP430:INT64_MIN_ INT64_MIN
@@ -401,10 +401,10 @@
 // MSP430:INTMAX_MAX_ 2147483647L
 // MSP430:UINTMAX_MAX_ (2147483647L*2ULL +1ULL)
 //
-// MSP430:SIG_ATOMIC_MIN_ (-2147483647 -1)
-// MSP430:SIG_ATOMIC_MAX_ 2147483647
-// MSP430:WINT_MIN_ (-2147483647 -1)
-// MSP430:WINT_MAX_ 2147483647
+// MSP430:SIG_ATOMIC_MIN_ (-2147483647L -1)
+// MSP430:SIG_ATOMIC_MAX_ 2147483647L
+// MSP430:WINT_MIN_ (-2147483647L -1)
+// MSP430:WINT_MAX_ 2147483647L
 //
 // MSP430:WCHAR_MAX_ 32767
 // MSP430:WCHAR_MIN_ (-32767 -1)
@@ -470,15 +470,15 @@
 // PIC16:INT_FAST16_MAX_ 32767
 // PIC16:UINT_FAST16_MAX_ 65535
 //
-// PIC16:INT32_MAX_ 2147483647
-// PIC16:INT32_MIN_ (-2147483647 -1)
-// PIC16:UINT32_MAX_ 4294967295U
-// PIC16:INT_LEAST32_MIN_ (-2147483647 -1)
-// PIC16:INT_LEAST32_MAX_ 2147483647
-// PIC16:UINT_LEAST32_MAX_ 4294967295U
-// PIC16:INT_FAST32_MIN_ (-2147483647 -1)
-// PIC16:INT_FAST32_MAX_ 2147483647
-// PIC16:UINT_FAST32_MAX_ 4294967295U
+// PIC16:INT32_MAX_ 2147483647L
+// PIC16:INT32_MIN_ (-2147483647L -1)
+// PIC16:UINT32_MAX_ 4294967295UL
+// PIC16:INT_LEAST32_MIN_ (-2147483647L -1)
+// PIC16:INT_LEAST32_MAX_ 2147483647L
+// PIC16:UINT_LEAST32_MAX_ 4294967295UL
+// PIC16:INT_FAST32_MIN_ (-2147483647L -1)
+// PIC16:INT_FAST32_MAX_ 2147483647L
+// PIC16:UINT_FAST32_MAX_ 4294967295UL
 //
 // PIC16:INT64_MAX_ INT64_MAX
 // PIC16:INT64_MIN_ INT64_MIN
@@ -501,10 +501,10 @@
 // PIC16:INTMAX_MAX_ 2147483647L
 // PIC16:UINTMAX_MAX_ (2147483647L*2ULL +1ULL)
 //
-// PIC16:SIG_ATOMIC_MIN_ (-2147483647 -1)
-// PIC16:SIG_ATOMIC_MAX_ 2147483647
-// PIC16:WINT_MIN_ (-2147483647 -1)
-// PIC16:WINT_MAX_ 2147483647
+// PIC16:SIG_ATOMIC_MIN_ (-2147483647L -1)
+// PIC16:SIG_ATOMIC_MAX_ 2147483647L
+// PIC16:WINT_MIN_ (-2147483647L -1)
+// PIC16:WINT_MAX_ 2147483647L
 //
 // PIC16:WCHAR_MAX_ 32767
 // PIC16:WCHAR_MIN_ (-32767 -1)
@@ -587,22 +587,22 @@
 // PPC64:INT_FAST32_MAX_ 2147483647
 // PPC64:UINT_FAST32_MAX_ 4294967295U
 //
-// PPC64:INT64_MAX_ 9223372036854775807LL
-// PPC64:INT64_MIN_ (-9223372036854775807LL -1)
-// PPC64:UINT64_MAX_ 18446744073709551615ULL
-// PPC64:INT_LEAST64_MIN_ (-9223372036854775807LL -1)
-// PPC64:INT_LEAST64_MAX_ 9223372036854775807LL
-// PPC64:UINT_LEAST64_MAX_ 18446744073709551615ULL
-// PPC64:INT_FAST64_MIN_ (-9223372036854775807LL -1)
-// PPC64:INT_FAST64_MAX_ 9223372036854775807LL
-// PPC64:UINT_FAST64_MAX_ 18446744073709551615ULL
-//
-// PPC64:INTPTR_MIN_ (-9223372036854775807LL -1)
-// PPC64:INTPTR_MAX_ 9223372036854775807LL
-// PPC64:UINTPTR_MAX_ 18446744073709551615ULL
-// PPC64:PTRDIFF_MIN_ (-9223372036854775807LL -1)
-// PPC64:PTRDIFF_MAX_ 9223372036854775807LL
-// PPC64:SIZE_MAX_ 18446744073709551615ULL
+// PPC64:INT64_MAX_ 9223372036854775807L
+// PPC64:INT64_MIN_ (-9223372036854775807L -1)
+// PPC64:UINT64_MAX_ 18446744073709551615UL
+// PPC64:INT_LEAST64_MIN_ (-9223372036854775807L -1)
+// PPC64:INT_LEAST64_MAX_ 9223372036854775807L
+// PPC64:UINT_LEAST64_MAX_ 18446744073709551615UL
+// PPC64:INT_FAST64_MIN_ (-9223372036854775807L -1)
+// PPC64:INT_FAST64_MAX_ 9223372036854775807L
+// PPC64:UINT_FAST64_MAX_ 18446744073709551615UL
+//
+// PPC64:INTPTR_MIN_ (-9223372036854775807L -1)
+// PPC64:INTPTR_MAX_ 9223372036854775807L
+// PPC64:UINTPTR_MAX_ 18446744073709551615UL
+// PPC64:PTRDIFF_MIN_ (-9223372036854775807L -1)
+// PPC64:PTRDIFF_MAX_ 9223372036854775807L
+// PPC64:SIZE_MAX_ 18446744073709551615UL
 //
 // PPC64:INTMAX_MIN_ (-9223372036854775807L -1)
 // PPC64:INTMAX_MAX_ 9223372036854775807L
@@ -802,22 +802,22 @@
 // S390X:INT_FAST32_MAX_ 2147483647
 // S390X:UINT_FAST32_MAX_ 4294967295U
 //
-// S390X:INT64_MAX_ 9223372036854775807LL
-// S390X:INT64_MIN_ (-9223372036854775807LL -1)
-// S390X:UINT64_MAX_ 18446744073709551615ULL
-// S390X:INT_LEAST64_MIN_ (-9223372036854775807LL -1)
-// S390X:INT_LEAST64_MAX_ 9223372036854775807LL
-// S390X:UINT_LEAST64_MAX_ 18446744073709551615ULL
-// S390X:INT_FAST64_MIN_ (-9223372036854775807LL -1)
-// S390X:INT_FAST64_MAX_ 9223372036854775807LL
-// S390X:UINT_FAST64_MAX_ 18446744073709551615ULL
-//
-// S390X:INTPTR_MIN_ (-9223372036854775807LL -1)
-// S390X:INTPTR_MAX_ 9223372036854775807LL
-// S390X:UINTPTR_MAX_ 18446744073709551615ULL
-// S390X:PTRDIFF_MIN_ (-9223372036854775807LL -1)
-// S390X:PTRDIFF_MAX_ 9223372036854775807LL
-// S390X:SIZE_MAX_ 18446744073709551615ULL
+// S390X:INT64_MAX_ 9223372036854775807L
+// S390X:INT64_MIN_ (-9223372036854775807L -1)
+// S390X:UINT64_MAX_ 18446744073709551615UL
+// S390X:INT_LEAST64_MIN_ (-9223372036854775807L -1)
+// S390X:INT_LEAST64_MAX_ 9223372036854775807L
+// S390X:UINT_LEAST64_MAX_ 18446744073709551615UL
+// S390X:INT_FAST64_MIN_ (-9223372036854775807L -1)
+// S390X:INT_FAST64_MAX_ 9223372036854775807L
+// S390X:UINT_FAST64_MAX_ 18446744073709551615UL
+//
+// S390X:INTPTR_MIN_ (-9223372036854775807L -1)
+// S390X:INTPTR_MAX_ 9223372036854775807L
+// S390X:UINTPTR_MAX_ 18446744073709551615UL
+// S390X:PTRDIFF_MIN_ (-9223372036854775807L -1)
+// S390X:PTRDIFF_MAX_ 9223372036854775807L
+// S390X:SIZE_MAX_ 18446744073709551615UL
 //
 // S390X:INTMAX_MIN_ (-9223372036854775807LL -1)
 // S390X:INTMAX_MAX_ 9223372036854775807LL
@@ -1117,22 +1117,22 @@
 // X86_64:INT_FAST32_MAX_ 2147483647
 // X86_64:UINT_FAST32_MAX_ 4294967295U
 //
-// X86_64:INT64_MAX_ 9223372036854775807LL
-// X86_64:INT64_MIN_ (-9223372036854775807LL -1)
-// X86_64:UINT64_MAX_ 18446744073709551615ULL
-// X86_64:INT_LEAST64_MIN_ (-9223372036854775807LL -1)
-// X86_64:INT_LEAST64_MAX_ 9223372036854775807LL
-// X86_64:UINT_LEAST64_MAX_ 18446744073709551615ULL
-// X86_64:INT_FAST64_MIN_ (-9223372036854775807LL -1)
-// X86_64:INT_FAST64_MAX_ 9223372036854775807LL
-// X86_64:UINT_FAST64_MAX_ 18446744073709551615ULL
-//
-// X86_64:INTPTR_MIN_ (-9223372036854775807LL -1)
-// X86_64:INTPTR_MAX_ 9223372036854775807LL
-// X86_64:UINTPTR_MAX_ 18446744073709551615ULL
-// X86_64:PTRDIFF_MIN_ (-9223372036854775807LL -1)
-// X86_64:PTRDIFF_MAX_ 9223372036854775807LL
-// X86_64:SIZE_MAX_ 18446744073709551615ULL
+// X86_64:INT64_MAX_ 9223372036854775807L
+// X86_64:INT64_MIN_ (-9223372036854775807L -1)
+// X86_64:UINT64_MAX_ 18446744073709551615UL
+// X86_64:INT_LEAST64_MIN_ (-9223372036854775807L -1)
+// X86_64:INT_LEAST64_MAX_ 9223372036854775807L
+// X86_64:UINT_LEAST64_MAX_ 18446744073709551615UL
+// X86_64:INT_FAST64_MIN_ (-9223372036854775807L -1)
+// X86_64:INT_FAST64_MAX_ 9223372036854775807L
+// X86_64:UINT_FAST64_MAX_ 18446744073709551615UL
+//
+// X86_64:INTPTR_MIN_ (-9223372036854775807L -1)
+// X86_64:INTPTR_MAX_ 9223372036854775807L
+// X86_64:UINTPTR_MAX_ 18446744073709551615UL
+// X86_64:PTRDIFF_MIN_ (-9223372036854775807L -1)
+// X86_64:PTRDIFF_MAX_ 9223372036854775807L
+// X86_64:SIZE_MAX_ 18446744073709551615UL
 //
 // X86_64:INTMAX_MIN_ (-9223372036854775807L -1)
 // X86_64:INTMAX_MAX_ 9223372036854775807L





More information about the cfe-commits mailing list