Take into account ISO C 99 TC1.
authorBruno Haible <bruno@clisp.org>
Fri, 23 Jun 2006 14:58:59 +0000 (14:58 +0000)
committerBruno Haible <bruno@clisp.org>
Fri, 23 Jun 2006 14:58:59 +0000 (14:58 +0000)
ChangeLog
lib/ChangeLog
lib/stdint_.h
tests/test-stdint.c

index eca0b95..2b06e7d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-06-23  Bruno Haible  <bruno@clisp.org>
+
+       * tests/test-stdint.c: Update to match ISO C 99 Technical
+       Corrigendum 1.
+
 2006-06-21  Simon Josefsson  <jas@extundo.com>
 
        * tests/test-getaddrinfo.c: New file.
index 8ea5083..2c4cf82 100644 (file)
@@ -1,3 +1,8 @@
+2006-06-23  Bruno Haible  <bruno@clisp.org>
+
+       * stdlib_.h (UINT8_C, UINT16_C, UINT32_C): Define according to
+       ISO C 99 Technical Corrigendum 1.
+
 2006-06-22  Paul Eggert  <eggert@cs.ucla.edu>
 
        * glob.c (collated_compare): Remove 'const' uses that weren't needed.
index d7f7431..96385e1 100644 (file)
@@ -924,21 +924,46 @@ typedef uint32_t uintmax_t;
 #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
 
 /* 7.18.4.1. Macros for minimum-width integer constants */
+/* According to ISO C 99 Technical Corrigendum 1 */
 
 #undef INT8_C
 #undef UINT8_C
 #define INT8_C(x) x
-#define UINT8_C(x) x##U
+#if @HAVE_UINT8_T@
+# if @BITSIZEOF_UINT8_T@ < @BITSIZEOF_UNSIGNED_INT@
+#  define UINT8_C(x) x
+# else
+#  define UINT8_C(x) x##U
+# endif
+#else
+# define UINT8_C(x) x
+#endif
 
 #undef INT16_C
 #undef UINT16_C
 #define INT16_C(x) x
-#define UINT16_C(x) x##U
+#if @HAVE_UINT16_T@
+# if @BITSIZEOF_UINT16_T@ < @BITSIZEOF_UNSIGNED_INT@
+#  define UINT16_C(x) x
+# else
+#  define UINT16_C(x) x##U
+# endif
+#else
+# define UINT16_C(x) x
+#endif
 
 #undef INT32_C
 #undef UINT32_C
 #define INT32_C(x) x
-#define UINT32_C(x) x##U
+#if @HAVE_UINT32_T@
+# if @BITSIZEOF_UINT32_T@ < @BITSIZEOF_UNSIGNED_INT@
+#  define UINT32_C(x) x
+# else
+#  define UINT32_C(x) x##U
+# endif
+#else
+# define UINT32_C(x) x
+#endif
 
 #undef INT64_C
 #undef UINT64_C
index a2f8f8e..cff7f54 100644 (file)
@@ -322,41 +322,33 @@ err or;
 /* 7.18.4. Macros for integer constants */
 
 verify (INT8_C (17) == 17);
-#if 0 /* The language in ISO C 99 7.18.4 is too strong. */
-verify_same_types (INT8_C (17), (int_least8_t)0);
-#endif
+verify_same_types (INT8_C (17), (int_least8_t)0 + 0);
 verify (UINT8_C (17) == 17);
-#if 0 /* The language in ISO C 99 7.18.4 is too strong. */
-verify_same_types (UINT8_C (17), (uint_least8_t)0);
-#endif
+verify_same_types (UINT8_C (17), (uint_least8_t)0 + 0);
 
 verify (INT16_C (17) == 17);
-#if 0 /* The language in ISO C 99 7.18.4 is too strong. */
-verify_same_types (INT16_C (17), (int_least16_t)0);
-#endif
+verify_same_types (INT16_C (17), (int_least16_t)0 + 0);
 verify (UINT16_C (17) == 17);
-#if 0 /* The language in ISO C 99 7.18.4 is too strong. */
-verify_same_types (UINT16_C (17), (uint_least16_t)0);
-#endif
+verify_same_types (UINT16_C (17), (uint_least16_t)0 + 0);
 
 verify (INT32_C (17) == 17);
-verify_same_types (INT32_C (17), (int_least32_t)0);
+verify_same_types (INT32_C (17), (int_least32_t)0 + 0);
 verify (UINT32_C (17) == 17);
-verify_same_types (UINT32_C (17), (uint_least32_t)0);
+verify_same_types (UINT32_C (17), (uint_least32_t)0 + 0);
 
 #if HAVE_INT_LEAST64_T_IN_STDINT_H || _STDINT_H_HAVE_INT64
 verify (INT64_C (17) == 17);
-verify_same_types (INT64_C (17), (int_least64_t)0);
+verify_same_types (INT64_C (17), (int_least64_t)0 + 0);
 #endif
 #if HAVE_UINT_LEAST64_T_IN_STDINT_H || _STDINT_H_HAVE_UINT64
 verify (UINT64_C (17) == 17);
-verify_same_types (UINT64_C (17), (uint_least64_t)0);
+verify_same_types (UINT64_C (17), (uint_least64_t)0 + 0);
 #endif
 
 verify (INTMAX_C (17) == 17);
-verify_same_types (INTMAX_C (17), (intmax_t)0);
+verify_same_types (INTMAX_C (17), (intmax_t)0 + 0);
 verify (UINTMAX_C (17) == 17);
-verify_same_types (UINTMAX_C (17), (uintmax_t)0);
+verify_same_types (UINTMAX_C (17), (uintmax_t)0 + 0);
 
 
 int