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 eca0b9591b1cac2afde72219fc0aca0474a3b2b5..2b06e7d6f2c0de072292e3f90ec1fc3a6206066a 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 8ea50832eb31b260797b34c1c02e1baf6f2c1def..2c4cf824922b546b656bc5df73cf497f9136c6f6 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 d7f74312531b92d0d9351f3b36bec0fda4a98b0c..96385e1f40c22ee186ea7740268450934ef93671 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 a2f8f8e0ba481e6575c310ce638adebe1a422359..cff7f54a545c2442c6f64a19177bfc84706a736c 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