bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gnulib] Re: result type of INT16_C, UINT16_C


From: Bruno Haible
Subject: Re: [bug-gnulib] Re: result type of INT16_C, UINT16_C
Date: Fri, 23 Jun 2006 16:56:41 +0200
User-agent: KMail/1.9.1

Ben Pfaff wrote:
> I think you are overlooking the changes in Technical Corrigendum
> 1, which includes the following:

Thanks for the text; I don't have a copy of this Technical Corrigendum.

I have changed stdint_.h and the test module accordingly.

Bruno


diff -c -3 -r1.17 stdint_.h
*** lib/stdint_.h       17 Jun 2006 20:02:16 -0000      1.17
--- lib/stdint_.h       23 Jun 2006 14:54:37 -0000
***************
*** 924,944 ****
  #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
  
  /* 7.18.4.1. Macros for minimum-width integer constants */
  
  #undef INT8_C
  #undef UINT8_C
  #define INT8_C(x) x
! #define UINT8_C(x) x##U
  
  #undef INT16_C
  #undef UINT16_C
  #define INT16_C(x) x
! #define UINT16_C(x) x##U
  
  #undef INT32_C
  #undef UINT32_C
  #define INT32_C(x) x
! #define UINT32_C(x) x##U
  
  #undef INT64_C
  #undef UINT64_C
--- 924,969 ----
  #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
! #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
! #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
! #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
diff -c -3 -r1.1 test-stdint.c
*** tests/test-stdint.c 16 Jun 2006 13:29:04 -0000      1.1
--- tests/test-stdint.c 23 Jun 2006 14:54:37 -0000
***************
*** 322,362 ****
  /* 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 (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 (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 (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 (INT32_C (17) == 17);
! verify_same_types (INT32_C (17), (int_least32_t)0);
  verify (UINT32_C (17) == 17);
! verify_same_types (UINT32_C (17), (uint_least32_t)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);
  #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);
  #endif
  
  verify (INTMAX_C (17) == 17);
! verify_same_types (INTMAX_C (17), (intmax_t)0);
  verify (UINTMAX_C (17) == 17);
! verify_same_types (UINTMAX_C (17), (uintmax_t)0);
  
  
  int
--- 322,354 ----
  /* 7.18.4. Macros for integer constants */
  
  verify (INT8_C (17) == 17);
! verify_same_types (INT8_C (17), (int_least8_t)0 + 0);
  verify (UINT8_C (17) == 17);
! verify_same_types (UINT8_C (17), (uint_least8_t)0 + 0);
  
  verify (INT16_C (17) == 17);
! verify_same_types (INT16_C (17), (int_least16_t)0 + 0);
  verify (UINT16_C (17) == 17);
! 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 + 0);
  verify (UINT32_C (17) == 17);
! 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 + 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 + 0);
  #endif
  
  verify (INTMAX_C (17) == 17);
! verify_same_types (INTMAX_C (17), (intmax_t)0 + 0);
  verify (UINTMAX_C (17) == 17);
! verify_same_types (UINTMAX_C (17), (uintmax_t)0 + 0);
  
  
  int




reply via email to

[Prev in Thread] Current Thread [Next in Thread]