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

Ken Dyck ken.dyck at onsemi.com
Fri Nov 20 08:44:38 PST 2009


Author: kjdyck
Date: Fri Nov 20 10:44:38 2009
New Revision: 89460

URL: http://llvm.org/viewvc/llvm-project?rev=89460&view=rev
Log:
Avoid unwanted expansion in macros that paste together INT<n>_MIN, INT<n>_MAX,
and UINT<n>_MAX defintions.


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=89460&r1=89459&r2=89460&view=diff

==============================================================================
--- cfe/trunk/lib/Headers/stdint.h (original)
+++ cfe/trunk/lib/Headers/stdint.h Fri Nov 20 10:44:38 2009
@@ -605,33 +605,36 @@
 
 /* C99 7.18.2.4 Limits of integer types capable of holding object pointers. */
 /* C99 7.18.3 Limits of other integer types. */
-
-#define  INTPTR_MIN __stdint_exjoin3( INT, __INTPTR_WIDTH__, _MIN)
-#define  INTPTR_MAX __stdint_exjoin3( INT, __INTPTR_WIDTH__, _MAX)
-#define UINTPTR_MAX __stdint_exjoin3(UINT, __INTPTR_WIDTH__, _MAX)
-#define PTRDIFF_MIN __stdint_exjoin3( INT, __PTRDIFF_WIDTH__, _MIN)
-#define PTRDIFF_MAX __stdint_exjoin3( INT, __PTRDIFF_WIDTH__, _MAX)
-#define    SIZE_MAX __stdint_exjoin3(UINT, __SIZE_WIDTH__, _MAX)
+#define  __INTN_MIN(n) __stdint_join3( INT, n, _MIN)
+#define  __INTN_MAX(n) __stdint_join3( INT, n, _MAX)
+#define __UINTN_MAX(n) __stdint_join3(UINT, n, _MAX)
+
+#define  INTPTR_MIN  __INTN_MIN(__INTPTR_WIDTH__)
+#define  INTPTR_MAX  __INTN_MAX(__INTPTR_WIDTH__)
+#define UINTPTR_MAX __UINTN_MAX(__INTPTR_WIDTH__)
+#define PTRDIFF_MIN  __INTN_MIN(__PTRDIFF_WIDTH__)
+#define PTRDIFF_MAX  __INTN_MAX(__PTRDIFF_WIDTH__)
+#define    SIZE_MAX __UINTN_MAX(__SIZE_WIDTH__)
 
 /* C99 7.18.2.5 Limits of greatest-width integer types. */
-#define INTMAX_MIN  __stdint_exjoin3( INT, __INTMAX_WIDTH__, _MIN)
-#define INTMAX_MAX  __stdint_exjoin3( INT, __INTMAX_WIDTH__, _MAX)
-#define UINTMAX_MAX __stdint_exjoin3(UINT, __INTMAX_WIDTH__, _MAX)
+#define INTMAX_MIN   __INTN_MIN(__INTMAX_WIDTH__)
+#define INTMAX_MAX   __INTN_MAX(__INTMAX_WIDTH__)
+#define UINTMAX_MAX __UINTN_MAX(__INTMAX_WIDTH__)
 
 /* C99 7.18.3 Limits of other integer types. */
 #define SIG_ATOMIC_MIN INT32_MIN
 #define SIG_ATOMIC_MAX INT32_MAX
-#define WINT_MIN       __stdint_exjoin3(INT, __WINT_WIDTH__, _MIN)
-#define WINT_MAX       __stdint_exjoin3(INT, __WINT_WIDTH__, _MAX)
+#define WINT_MIN       __INTN_MIN(__WINT_WIDTH__)
+#define WINT_MAX       __INTN_MAX(__WINT_WIDTH__)
 
 /* FIXME: if we ever support a target with unsigned wchar_t, this should be
  * 0 .. Max.
  */
 #ifndef WCHAR_MAX
-#define WCHAR_MAX __stdint_exjoin3(INT, __WCHAR_WIDTH__, _MAX)
+#define WCHAR_MAX __INTN_MAX(__WCHAR_WIDTH__)
 #endif
 #ifndef WCHAR_MIN
-#define WCHAR_MIN __stdint_exjoin3(INT, __WCHAR_WIDTH__, _MIN)
+#define WCHAR_MIN __INTN_MIN(__WCHAR_WIDTH__)
 #endif
 
 /* 7.18.4.2 Macros for greatest-width integer constants. */

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

==============================================================================
--- cfe/trunk/test/Preprocessor/stdint.c (original)
+++ cfe/trunk/test/Preprocessor/stdint.c Fri Nov 20 10:44:38 2009
@@ -1170,21 +1170,21 @@
 // JOIN:typedef uint32_t uintptr_t;
 // JOIN:typedef int64_t intmax_t;
 // JOIN:typedef uint64_t uintmax_t;
-// TODO:INTPTR_MIN_ (-2147483647 -1)
-// TODO:INTPTR_MAX_ 2147483647
-// TODO:UINTPTR_MAX_ 4294967295U
-// TODO:PTRDIFF_MIN_ (-2147483647 -1)
-// TODO:PTRDIFF_MAX_ 2147483647
-// TODO:SIZE_MAX_ 4294967295U
-// TODO:INTMAX_MIN_ (-9223372036854775807LL -1)
-// TODO:INTMAX_MAX_ 9223372036854775807LL
-// TODO:UINTMAX_MAX_ 18446744073709551615ULL
-// TODO:SIG_ATOMIC_MIN_ (-2147483647 -1)
-// TODO:SIG_ATOMIC_MAX_ 2147483647
-// TODO:WINT_MIN_ (-2147483647 -1)
-// TODO:WINT_MAX_ 2147483647
-// TODO:WCHAR_MAX_ 2147483647
-// TODO:WCHAR_MIN_ (-2147483647 -1)
+// JOIN:INTPTR_MIN_ (-2147483647 -1)
+// JOIN:INTPTR_MAX_ 2147483647
+// JOIN:UINTPTR_MAX_ 4294967295U
+// JOIN:PTRDIFF_MIN_ (-2147483647 -1)
+// JOIN:PTRDIFF_MAX_ 2147483647
+// JOIN:SIZE_MAX_ 4294967295U
+// JOIN:INTMAX_MIN_ (-9223372036854775807LL -1)
+// JOIN:INTMAX_MAX_ 9223372036854775807LL
+// JOIN:UINTMAX_MAX_ 18446744073709551615ULL
+// JOIN:SIG_ATOMIC_MIN_ (-2147483647 -1)
+// JOIN:SIG_ATOMIC_MAX_ 2147483647
+// JOIN:WINT_MIN_ (-2147483647 -1)
+// JOIN:WINT_MAX_ 2147483647
+// JOIN:WCHAR_MAX_ 2147483647
+// JOIN:WCHAR_MIN_ (-2147483647 -1)
 // TODO:INTMAX_C_(0) 0LL
 // TODO:UINTMAX_C_(0) 0ULL
 





More information about the cfe-commits mailing list