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

Ken Dyck ken.dyck at onsemi.com
Tue Nov 17 10:29:12 PST 2009


Author: kjdyck
Date: Tue Nov 17 12:29:12 2009
New Revision: 89120

URL: http://llvm.org/viewvc/llvm-project?rev=89120&view=rev
Log:
Replace (-INT8_C(128)), which uses an illegally out-of-range argument for
INT8_C, with (-INT8_C(127)-1) in the definition of INT8_MIN. Apply similar
changes to the definitions of INT16_MIN and INT24_MIN.


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=89120&r1=89119&r2=89120&view=diff

==============================================================================
--- cfe/trunk/lib/Headers/stdint.h (original)
+++ cfe/trunk/lib/Headers/stdint.h Tue Nov 17 12:29:12 2009
@@ -540,8 +540,7 @@
 
 #ifdef __INT24_TYPE__
 # 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 INT24_MIN         (-INT24_C(8388607)-1)
 # define UINT24_MAX         UINT24_C(16777215)
 # define INT_LEAST24_MIN     INT24_MIN
 # define INT_LEAST24_MAX     INT24_MAX
@@ -560,8 +559,7 @@
 
 #ifdef __INT16_TYPE__
 #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 INT16_MIN          (-INT16_C(32767)-1)
 #define UINT16_MAX          UINT16_C(65535)
 # define __INT_LEAST16_MIN   INT16_MIN
 # define __INT_LEAST16_MAX   INT16_MAX
@@ -583,8 +581,7 @@
 
 #ifdef __INT8_TYPE__
 # 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 INT8_MIN          (-INT8_C(127)-1)
 # define UINT8_MAX          UINT8_C(255)
 # define __INT_LEAST8_MIN    INT8_MIN
 # define __INT_LEAST8_MAX    INT8_MAX

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

==============================================================================
--- cfe/trunk/test/Preprocessor/stdint.c (original)
+++ cfe/trunk/test/Preprocessor/stdint.c Tue Nov 17 12:29:12 2009
@@ -35,22 +35,22 @@
 // ARM:typedef long long unsigned int uintmax_t;
 //
 // ARM:INT8_MAX_ 127
-// ARM:INT8_MIN_ (-128)
+// ARM:INT8_MIN_ (-127 -1)
 // ARM:UINT8_MAX_ 255
-// ARM:INT_LEAST8_MIN_ (-128)
+// ARM:INT_LEAST8_MIN_ (-127 -1)
 // ARM:INT_LEAST8_MAX_ 127
 // ARM:UINT_LEAST8_MAX_ 255
-// ARM:INT_FAST8_MIN_ (-128)
+// ARM:INT_FAST8_MIN_ (-127 -1)
 // ARM:INT_FAST8_MAX_ 127
 // ARM:UINT_FAST8_MAX_ 255
 //
 // ARM:INT16_MAX_ 32767
-// ARM:INT16_MIN_ (-32768)
+// ARM:INT16_MIN_ (-32767 -1)
 // ARM:UINT16_MAX_ 65535
-// ARM:INT_LEAST16_MIN_ (-32768)
+// ARM:INT_LEAST16_MIN_ (-32767 -1)
 // ARM:INT_LEAST16_MAX_ 32767
 // ARM:UINT_LEAST16_MAX_ 65535
-// ARM:INT_FAST16_MIN_ (-32768)
+// ARM:INT_FAST16_MIN_ (-32767 -1)
 // ARM:INT_FAST16_MAX_ 32767
 // ARM:UINT_FAST16_MAX_ 65535
 //
@@ -143,22 +143,22 @@
 // BFIN:typedef long long unsigned int uintmax_t;
 //
 // BFIN:INT8_MAX_ 127
-// BFIN:INT8_MIN_ (-128)
+// BFIN:INT8_MIN_ (-127 -1)
 // BFIN:UINT8_MAX_ 255
-// BFIN:INT_LEAST8_MIN_ (-128)
+// BFIN:INT_LEAST8_MIN_ (-127 -1)
 // BFIN:INT_LEAST8_MAX_ 127
 // BFIN:UINT_LEAST8_MAX_ 255
-// BFIN:INT_FAST8_MIN_ (-128)
+// BFIN:INT_FAST8_MIN_ (-127 -1)
 // BFIN:INT_FAST8_MAX_ 127
 // BFIN:UINT_FAST8_MAX_ 255
 //
 // BFIN:INT16_MAX_ 32767
-// BFIN:INT16_MIN_ (-32768)
+// BFIN:INT16_MIN_ (-32767 -1)
 // BFIN:UINT16_MAX_ 65535
-// BFIN:INT_LEAST16_MIN_ (-32768)
+// BFIN:INT_LEAST16_MIN_ (-32767 -1)
 // BFIN:INT_LEAST16_MAX_ 32767
 // BFIN:UINT_LEAST16_MAX_ 65535
-// BFIN:INT_FAST16_MIN_ (-32768)
+// BFIN:INT_FAST16_MIN_ (-32767 -1)
 // BFIN:INT_FAST16_MAX_ 32767
 // BFIN:UINT_FAST16_MAX_ 65535
 //
@@ -251,22 +251,22 @@
 // I386:typedef long long unsigned int uintmax_t;
 //
 // I386:INT8_MAX_ 127
-// I386:INT8_MIN_ (-128)
+// I386:INT8_MIN_ (-127 -1)
 // I386:UINT8_MAX_ 255
-// I386:INT_LEAST8_MIN_ (-128)
+// I386:INT_LEAST8_MIN_ (-127 -1)
 // I386:INT_LEAST8_MAX_ 127
 // I386:UINT_LEAST8_MAX_ 255
-// I386:INT_FAST8_MIN_ (-128)
+// I386:INT_FAST8_MIN_ (-127 -1)
 // I386:INT_FAST8_MAX_ 127
 // I386:UINT_FAST8_MAX_ 255
 //
 // I386:INT16_MAX_ 32767
-// I386:INT16_MIN_ (-32768)
+// I386:INT16_MIN_ (-32767 -1)
 // I386:UINT16_MAX_ 65535
-// I386:INT_LEAST16_MIN_ (-32768)
+// I386:INT_LEAST16_MIN_ (-32767 -1)
 // I386:INT_LEAST16_MAX_ 32767
 // I386:UINT_LEAST16_MAX_ 65535
-// I386:INT_FAST16_MIN_ (-32768)
+// I386:INT_FAST16_MIN_ (-32767 -1)
 // I386:INT_FAST16_MAX_ 32767
 // I386:UINT_FAST16_MAX_ 65535
 //
@@ -351,22 +351,22 @@
 // MSP430:typedef long unsigned int uintmax_t;
 //
 // MSP430:INT8_MAX_ 127
-// MSP430:INT8_MIN_ (-128)
+// MSP430:INT8_MIN_ (-127 -1)
 // MSP430:UINT8_MAX_ 255
-// MSP430:INT_LEAST8_MIN_ (-128)
+// MSP430:INT_LEAST8_MIN_ (-127 -1)
 // MSP430:INT_LEAST8_MAX_ 127
 // MSP430:UINT_LEAST8_MAX_ 255
-// MSP430:INT_FAST8_MIN_ (-128)
+// MSP430:INT_FAST8_MIN_ (-127 -1)
 // MSP430:INT_FAST8_MAX_ 127
 // MSP430:UINT_FAST8_MAX_ 255
 //
 // MSP430:INT16_MAX_ 32767
-// MSP430:INT16_MIN_ (-32768)
+// MSP430:INT16_MIN_ (-32767 -1)
 // MSP430:UINT16_MAX_ 65535
-// MSP430:INT_LEAST16_MIN_ (-32768)
+// MSP430:INT_LEAST16_MIN_ (-32767 -1)
 // MSP430:INT_LEAST16_MAX_ 32767
 // MSP430:UINT_LEAST16_MAX_ 65535
-// MSP430:INT_FAST16_MIN_ (-32768)
+// MSP430:INT_FAST16_MIN_ (-32767 -1)
 // MSP430:INT_FAST16_MAX_ 32767
 // MSP430:UINT_FAST16_MAX_ 65535
 //
@@ -390,10 +390,10 @@
 // MSP430:INT_FAST64_MAX_ INT_FAST64_MAX
 // MSP430:UINT_FAST64_MAX_ UINT_FAST64_MAX
 //
-// MSP430:INTPTR_MIN_ (-32768)
+// MSP430:INTPTR_MIN_ (-32767 -1)
 // MSP430:INTPTR_MAX_ 32767
 // MSP430:UINTPTR_MAX_ 65535
-// MSP430:PTRDIFF_MIN_ (-32768)
+// MSP430:PTRDIFF_MIN_ (-32767 -1)
 // MSP430:PTRDIFF_MAX_ 32767
 // MSP430:SIZE_MAX_ 65535
 //
@@ -451,22 +451,22 @@
 // PIC16:typedef long unsigned int uintmax_t;
 //
 // PIC16:INT8_MAX_ 127
-// PIC16:INT8_MIN_ (-128)
+// PIC16:INT8_MIN_ (-127 -1)
 // PIC16:UINT8_MAX_ 255
-// PIC16:INT_LEAST8_MIN_ (-128)
+// PIC16:INT_LEAST8_MIN_ (-127 -1)
 // PIC16:INT_LEAST8_MAX_ 127
 // PIC16:UINT_LEAST8_MAX_ 255
-// PIC16:INT_FAST8_MIN_ (-128)
+// PIC16:INT_FAST8_MIN_ (-127 -1)
 // PIC16:INT_FAST8_MAX_ 127
 // PIC16:UINT_FAST8_MAX_ 255
 //
 // PIC16:INT16_MAX_ 32767
-// PIC16:INT16_MIN_ (-32768)
+// PIC16:INT16_MIN_ (-32767 -1)
 // PIC16:UINT16_MAX_ 65535
-// PIC16:INT_LEAST16_MIN_ (-32768)
+// PIC16:INT_LEAST16_MIN_ (-32767 -1)
 // PIC16:INT_LEAST16_MAX_ 32767
 // PIC16:UINT_LEAST16_MAX_ 65535
-// PIC16:INT_FAST16_MIN_ (-32768)
+// PIC16:INT_FAST16_MIN_ (-32767 -1)
 // PIC16:INT_FAST16_MAX_ 32767
 // PIC16:UINT_FAST16_MAX_ 65535
 //
@@ -490,10 +490,10 @@
 // PIC16:INT_FAST64_MAX_ INT_FAST64_MAX
 // PIC16:UINT_FAST64_MAX_ UINT_FAST64_MAX
 //
-// PIC16:INTPTR_MIN_ (-32768)
+// PIC16:INTPTR_MIN_ (-32767 -1)
 // PIC16:INTPTR_MAX_ 32767
 // PIC16:UINTPTR_MAX_ 65535
-// PIC16:PTRDIFF_MIN_ (-32768)
+// PIC16:PTRDIFF_MIN_ (-32767 -1)
 // PIC16:PTRDIFF_MAX_ 32767
 // PIC16:SIZE_MAX_ 65535
 //
@@ -558,22 +558,22 @@
 // PPC64:typedef long unsigned int uintmax_t;
 //
 // PPC64:INT8_MAX_ 127
-// PPC64:INT8_MIN_ (-128)
+// PPC64:INT8_MIN_ (-127 -1)
 // PPC64:UINT8_MAX_ 255
-// PPC64:INT_LEAST8_MIN_ (-128)
+// PPC64:INT_LEAST8_MIN_ (-127 -1)
 // PPC64:INT_LEAST8_MAX_ 127
 // PPC64:UINT_LEAST8_MAX_ 255
-// PPC64:INT_FAST8_MIN_ (-128)
+// PPC64:INT_FAST8_MIN_ (-127 -1)
 // PPC64:INT_FAST8_MAX_ 127
 // PPC64:UINT_FAST8_MAX_ 255
 //
 // PPC64:INT16_MAX_ 32767
-// PPC64:INT16_MIN_ (-32768)
+// PPC64:INT16_MIN_ (-32767 -1)
 // PPC64:UINT16_MAX_ 65535
-// PPC64:INT_LEAST16_MIN_ (-32768)
+// PPC64:INT_LEAST16_MIN_ (-32767 -1)
 // PPC64:INT_LEAST16_MAX_ 32767
 // PPC64:UINT_LEAST16_MAX_ 65535
-// PPC64:INT_FAST16_MIN_ (-32768)
+// PPC64:INT_FAST16_MIN_ (-32767 -1)
 // PPC64:INT_FAST16_MAX_ 32767
 // PPC64:UINT_FAST16_MAX_ 65535
 //
@@ -666,22 +666,22 @@
 // PPC:typedef long long unsigned int uintmax_t;
 //
 // PPC:INT8_MAX_ 127
-// PPC:INT8_MIN_ (-128)
+// PPC:INT8_MIN_ (-127 -1)
 // PPC:UINT8_MAX_ 255
-// PPC:INT_LEAST8_MIN_ (-128)
+// PPC:INT_LEAST8_MIN_ (-127 -1)
 // PPC:INT_LEAST8_MAX_ 127
 // PPC:UINT_LEAST8_MAX_ 255
-// PPC:INT_FAST8_MIN_ (-128)
+// PPC:INT_FAST8_MIN_ (-127 -1)
 // PPC:INT_FAST8_MAX_ 127
 // PPC:UINT_FAST8_MAX_ 255
 //
 // PPC:INT16_MAX_ 32767
-// PPC:INT16_MIN_ (-32768)
+// PPC:INT16_MIN_ (-32767 -1)
 // PPC:UINT16_MAX_ 65535
-// PPC:INT_LEAST16_MIN_ (-32768)
+// PPC:INT_LEAST16_MIN_ (-32767 -1)
 // PPC:INT_LEAST16_MAX_ 32767
 // PPC:UINT_LEAST16_MAX_ 65535
-// PPC:INT_FAST16_MIN_ (-32768)
+// PPC:INT_FAST16_MIN_ (-32767 -1)
 // PPC:INT_FAST16_MAX_ 32767
 // PPC:UINT_FAST16_MAX_ 65535
 //
@@ -773,22 +773,22 @@
 // S390X:typedef long long unsigned int uintmax_t;
 //
 // S390X:INT8_MAX_ 127
-// S390X:INT8_MIN_ (-128)
+// S390X:INT8_MIN_ (-127 -1)
 // S390X:UINT8_MAX_ 255
-// S390X:INT_LEAST8_MIN_ (-128)
+// S390X:INT_LEAST8_MIN_ (-127 -1)
 // S390X:INT_LEAST8_MAX_ 127
 // S390X:UINT_LEAST8_MAX_ 255
-// S390X:INT_FAST8_MIN_ (-128)
+// S390X:INT_FAST8_MIN_ (-127 -1)
 // S390X:INT_FAST8_MAX_ 127
 // S390X:UINT_FAST8_MAX_ 255
 //
 // S390X:INT16_MAX_ 32767
-// S390X:INT16_MIN_ (-32768)
+// S390X:INT16_MIN_ (-32767 -1)
 // S390X:UINT16_MAX_ 65535
-// S390X:INT_LEAST16_MIN_ (-32768)
+// S390X:INT_LEAST16_MIN_ (-32767 -1)
 // S390X:INT_LEAST16_MAX_ 32767
 // S390X:UINT_LEAST16_MAX_ 65535
-// S390X:INT_FAST16_MIN_ (-32768)
+// S390X:INT_FAST16_MIN_ (-32767 -1)
 // S390X:INT_FAST16_MAX_ 32767
 // S390X:UINT_FAST16_MAX_ 65535
 //
@@ -880,22 +880,22 @@
 // SPARC:typedef long long unsigned int uintmax_t;
 //
 // SPARC:INT8_MAX_ 127
-// SPARC:INT8_MIN_ (-128)
+// SPARC:INT8_MIN_ (-127 -1)
 // SPARC:UINT8_MAX_ 255
-// SPARC:INT_LEAST8_MIN_ (-128)
+// SPARC:INT_LEAST8_MIN_ (-127 -1)
 // SPARC:INT_LEAST8_MAX_ 127
 // SPARC:UINT_LEAST8_MAX_ 255
-// SPARC:INT_FAST8_MIN_ (-128)
+// SPARC:INT_FAST8_MIN_ (-127 -1)
 // SPARC:INT_FAST8_MAX_ 127
 // SPARC:UINT_FAST8_MAX_ 255
 //
 // SPARC:INT16_MAX_ 32767
-// SPARC:INT16_MIN_ (-32768)
+// SPARC:INT16_MIN_ (-32767 -1)
 // SPARC:UINT16_MAX_ 65535
-// SPARC:INT_LEAST16_MIN_ (-32768)
+// SPARC:INT_LEAST16_MIN_ (-32767 -1)
 // SPARC:INT_LEAST16_MAX_ 32767
 // SPARC:UINT_LEAST16_MAX_ 65535
-// SPARC:INT_FAST16_MIN_ (-32768)
+// SPARC:INT_FAST16_MIN_ (-32767 -1)
 // SPARC:INT_FAST16_MAX_ 32767
 // SPARC:UINT_FAST16_MAX_ 65535
 //
@@ -980,22 +980,22 @@
 // TCE:typedef long unsigned int uintmax_t;
 //
 // TCE:INT8_MAX_ 127
-// TCE:INT8_MIN_ (-128)
+// TCE:INT8_MIN_ (-127 -1)
 // TCE:UINT8_MAX_ 255
-// TCE:INT_LEAST8_MIN_ (-128)
+// TCE:INT_LEAST8_MIN_ (-127 -1)
 // TCE:INT_LEAST8_MAX_ 127
 // TCE:UINT_LEAST8_MAX_ 255
-// TCE:INT_FAST8_MIN_ (-128)
+// TCE:INT_FAST8_MIN_ (-127 -1)
 // TCE:INT_FAST8_MAX_ 127
 // TCE:UINT_FAST8_MAX_ 255
 //
 // TCE:INT16_MAX_ 32767
-// TCE:INT16_MIN_ (-32768)
+// TCE:INT16_MIN_ (-32767 -1)
 // TCE:UINT16_MAX_ 65535
-// TCE:INT_LEAST16_MIN_ (-32768)
+// TCE:INT_LEAST16_MIN_ (-32767 -1)
 // TCE:INT_LEAST16_MAX_ 32767
 // TCE:UINT_LEAST16_MAX_ 65535
-// TCE:INT_FAST16_MIN_ (-32768)
+// TCE:INT_FAST16_MIN_ (-32767 -1)
 // TCE:INT_FAST16_MAX_ 32767
 // TCE:UINT_FAST16_MAX_ 65535
 //
@@ -1088,22 +1088,22 @@
 // X86_64:typedef long unsigned int uintmax_t;
 //
 // X86_64:INT8_MAX_ 127
-// X86_64:INT8_MIN_ (-128)
+// X86_64:INT8_MIN_ (-127 -1)
 // X86_64:UINT8_MAX_ 255
-// X86_64:INT_LEAST8_MIN_ (-128)
+// X86_64:INT_LEAST8_MIN_ (-127 -1)
 // X86_64:INT_LEAST8_MAX_ 127
 // X86_64:UINT_LEAST8_MAX_ 255
-// X86_64:INT_FAST8_MIN_ (-128)
+// X86_64:INT_FAST8_MIN_ (-127 -1)
 // X86_64:INT_FAST8_MAX_ 127
 // X86_64:UINT_FAST8_MAX_ 255
 //
 // X86_64:INT16_MAX_ 32767
-// X86_64:INT16_MIN_ (-32768)
+// X86_64:INT16_MIN_ (-32767 -1)
 // X86_64:UINT16_MAX_ 65535
-// X86_64:INT_LEAST16_MIN_ (-32768)
+// X86_64:INT_LEAST16_MIN_ (-32767 -1)
 // X86_64:INT_LEAST16_MAX_ 32767
 // X86_64:UINT_LEAST16_MAX_ 65535
-// X86_64:INT_FAST16_MIN_ (-32768)
+// X86_64:INT_FAST16_MIN_ (-32767 -1)
 // X86_64:INT_FAST16_MAX_ 32767
 // X86_64:UINT_FAST16_MAX_ 65535
 //





More information about the cfe-commits mailing list