[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gnulib] stdint_.h update
From: |
Bruno Haible |
Subject: |
Re: [bug-gnulib] stdint_.h update |
Date: |
Mon, 23 May 2005 11:17:05 +0200 |
User-agent: |
KMail/1.5 |
Paul Eggert wrote:
> Shouldn't that typedef of int64_t be protected by "#ifdef
> NEED_SIGNED_INT_TYPES"?
NEED_SIGNED_INT_TYPES is only needed for Cygwin (so far). Let's correct this
when we stumble acess a system that has the same problem and uses the MSVC
compiler.
> (As an aside, NEED_SIGNED_INT_TYPES seems misnamed to me.
> It doesn't affect int_fast32_t, for example. Perhaps we should just
> call it CYGWIN32_BOTCH or something like that?)
It's not so unlikely that the same problem affects other systems as well:
AFAIK, the Cygwin headers are similar to those used in many embedded system
environments.
> I like Jim's suggestion for simplification.
But the C99 section 7.18.4, footnote 220, precludes this simplication.
> I have one more: define
> a symbol HAVE_64_BIT_INT and use it instead of the repeated
> "@HAVE_LONG_64BIT@ || @HAVE_LONG_LONG_64BIT@ || defined(_MSC_VER)".
> Something like this, perhaps?
Thanks, I'm committing this patch.
Bruno
* stdint_.h (_STDINT_H_HAVE_INT64): New macro. Use it in #ifdefs.
(INT64_MIN): Fix definition.
Suggested by Paul Eggert <address@hidden>.
*** stdint_.h.bak 2005-05-22 22:19:21.000000000 +0200
--- stdint_.h 2005-05-22 22:24:54.000000000 +0200
***************
*** 78,91 ****
--- 78,94 ----
typedef long int64_t;
#endif
typedef unsigned long uint64_t;
+ #define _STDINT_H_HAVE_INT64
#elif @HAVE_LONG_LONG_64BIT@
#ifdef _STDINT_H_NEED_SIGNED_INT_TYPES
typedef long long int64_t;
#endif
typedef unsigned long long uint64_t;
+ #define _STDINT_H_HAVE_INT64
#elif defined(_MSC_VER)
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
+ #define _STDINT_H_HAVE_INT64
#endif
#endif /* !FreeBSD */
***************
*** 98,104 ****
typedef uint16_t uint_least16_t;
typedef int32_t int_least32_t;
typedef uint32_t uint_least32_t;
! #if @HAVE_LONG_64BIT@ || @HAVE_LONG_LONG_64BIT@ || defined(_MSC_VER)
typedef int64_t int_least64_t;
typedef uint64_t uint_least64_t;
#endif
--- 101,107 ----
typedef uint16_t uint_least16_t;
typedef int32_t int_least32_t;
typedef uint32_t uint_least32_t;
! #ifdef _STDINT_H_HAVE_INT64
typedef int64_t int_least64_t;
typedef uint64_t uint_least64_t;
#endif
***************
*** 111,117 ****
typedef uint32_t uint_fast16_t;
typedef int32_t int_fast32_t;
typedef uint32_t uint_fast32_t;
! #if @HAVE_LONG_64BIT@ || @HAVE_LONG_LONG_64BIT@ || defined(_MSC_VER)
typedef int64_t int_fast64_t;
typedef uint64_t uint_fast64_t;
#endif
--- 114,120 ----
typedef uint32_t uint_fast16_t;
typedef int32_t int_fast32_t;
typedef uint32_t uint_fast32_t;
! #ifdef _STDINT_H_HAVE_INT64
typedef int64_t int_fast64_t;
typedef uint64_t uint_fast64_t;
#endif
***************
*** 129,135 ****
/* 7.18.1.5. Greatest-width integer types */
! #if @HAVE_LONG_64BIT@ || @HAVE_LONG_LONG_64BIT@ || defined(_MSC_VER)
typedef int64_t intmax_t;
typedef uint64_t uintmax_t;
#else
--- 132,138 ----
/* 7.18.1.5. Greatest-width integer types */
! #ifdef _STDINT_H_HAVE_INT64
typedef int64_t intmax_t;
typedef uint64_t uintmax_t;
#else
***************
*** 152,170 ****
#define INT32_MIN (~INT32_MAX)
#define INT32_MAX 2147483647
#define UINT32_MAX 4294967295U
#if @HAVE_LONG_64BIT@
- #define INT64_MIN (~INT64_MIN)
#define INT64_MAX 9223372036854775807L
#define UINT64_MAX 18446744073709551615UL
#elif @HAVE_LONG_LONG_64BIT@
- #define INT64_MIN (~INT64_MIN)
#define INT64_MAX 9223372036854775807LL
#define UINT64_MAX 18446744073709551615ULL
#elif defined(_MSC_VER)
- #define INT64_MIN (~INT64_MIN)
#define INT64_MAX 9223372036854775807i64
#define UINT64_MAX 18446744073709551615ui64
#endif
/* 7.18.2.2. Limits of minimum-width integer types */
--- 155,173 ----
#define INT32_MIN (~INT32_MAX)
#define INT32_MAX 2147483647
#define UINT32_MAX 4294967295U
+ #ifdef _STDINT_H_HAVE_INT64
+ #define INT64_MIN (~INT64_MAX)
#if @HAVE_LONG_64BIT@
#define INT64_MAX 9223372036854775807L
#define UINT64_MAX 18446744073709551615UL
#elif @HAVE_LONG_LONG_64BIT@
#define INT64_MAX 9223372036854775807LL
#define UINT64_MAX 18446744073709551615ULL
#elif defined(_MSC_VER)
#define INT64_MAX 9223372036854775807i64
#define UINT64_MAX 18446744073709551615ui64
#endif
+ #endif
/* 7.18.2.2. Limits of minimum-width integer types */
***************
*** 177,183 ****
#define INT_LEAST32_MIN INT32_MIN
#define INT_LEAST32_MAX INT32_MAX
#define UINT_LEAST32_MAX UINT32_MAX
! #if @HAVE_LONG_64BIT@ || @HAVE_LONG_LONG_64BIT@ || defined(_MSC_VER)
#define INT_LEAST64_MIN INT64_MIN
#define INT_LEAST64_MAX INT64_MAX
#define UINT_LEAST64_MAX UINT64_MAX
--- 180,186 ----
#define INT_LEAST32_MIN INT32_MIN
#define INT_LEAST32_MAX INT32_MAX
#define UINT_LEAST32_MAX UINT32_MAX
! #ifdef _STDINT_H_HAVE_INT64
#define INT_LEAST64_MIN INT64_MIN
#define INT_LEAST64_MAX INT64_MAX
#define UINT_LEAST64_MAX UINT64_MAX
***************
*** 194,200 ****
#define INT_FAST32_MIN INT32_MIN
#define INT_FAST32_MAX INT32_MAX
#define UINT_FAST32_MAX UINT32_MAX
! #if @HAVE_LONG_64BIT@ || @HAVE_LONG_LONG_64BIT@ || defined(_MSC_VER)
#define INT_FAST64_MIN INT64_MIN
#define INT_FAST64_MAX INT64_MAX
#define UINT_FAST64_MAX UINT64_MAX
--- 197,203 ----
#define INT_FAST32_MIN INT32_MIN
#define INT_FAST32_MAX INT32_MAX
#define UINT_FAST32_MAX UINT32_MAX
! #ifdef _STDINT_H_HAVE_INT64
#define INT_FAST64_MIN INT64_MIN
#define INT_FAST64_MAX INT64_MAX
#define UINT_FAST64_MAX UINT64_MAX
***************
*** 208,214 ****
/* 7.18.2.5. Limits of greatest-width integer types */
! #if @HAVE_LONG_64BIT@ || @HAVE_LONG_LONG_64BIT@ || defined(_MSC_VER)
#define INTMAX_MIN INT64_MIN
#define INTMAX_MAX INT64_MAX
#define UINTMAX_MAX UINT64_MAX
--- 211,217 ----
/* 7.18.2.5. Limits of greatest-width integer types */
! #ifdef _STDINT_H_HAVE_INT64
#define INTMAX_MIN INT64_MIN
#define INTMAX_MAX INT64_MAX
#define UINTMAX_MAX UINT64_MAX