X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fstdint.in.h;h=5aedeee6f78552358fbfefcefdf85356e76647ae;hb=a39d56cfe7d904b61aba940b20de06b94b6a60f8;hp=e660cfb1073eb3a1707aba600b1f46916ee15740;hpb=fea1830d840868b6d5d66ee30bb56f322f109254;p=gnulib.git diff --git a/lib/stdint.in.h b/lib/stdint.in.h index e660cfb10..5aedeee6f 100644 --- a/lib/stdint.in.h +++ b/lib/stdint.in.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2002, 2004-2010 Free Software Foundation, Inc. +/* Copyright (C) 2001-2002, 2004-2011 Free Software Foundation, Inc. Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood. This file is part of gnulib. @@ -93,7 +93,7 @@ #undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H -/* Minimum and maximum values for a integer type under the usual assumption. +/* Minimum and maximum values for an integer type under the usual assumption. Return an unspecified value if BITS == 0, adding a check to pacify picky compilers. */ @@ -108,6 +108,8 @@ warnings in the signed case. */ \ ((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1) +#if !GNULIB_defined_stdint_types + /* 7.18.1.1. Exact-width integer types */ /* Here we assume a standard architecture where the hardware integer @@ -134,40 +136,54 @@ typedef unsigned int gl_uint32_t; #define int32_t gl_int32_t #define uint32_t gl_uint32_t +/* If the system defines INT64_MAX, assume int64_t works. That way, + if the underlying platform defines int64_t to be a 64-bit long long + int, the code below won't mistakenly define it to be a 64-bit long + int, which would mess up C++ name mangling. We must use #ifdef + rather than #if, to avoid an error with HP-UX 10.20 cc. */ + +#ifdef INT64_MAX +# define GL_INT64_T +#else /* Do not undefine int64_t if gnulib is not being used with 64-bit types, since otherwise it breaks platforms like Tandem/NSK. */ -#if LONG_MAX >> 31 >> 31 == 1 -# undef int64_t +# if LONG_MAX >> 31 >> 31 == 1 +# undef int64_t typedef long int gl_int64_t; -# define int64_t gl_int64_t -# define GL_INT64_T -#elif defined _MSC_VER -# undef int64_t +# define int64_t gl_int64_t +# define GL_INT64_T +# elif defined _MSC_VER +# undef int64_t typedef __int64 gl_int64_t; -# define int64_t gl_int64_t -# define GL_INT64_T -#elif @HAVE_LONG_LONG_INT@ -# undef int64_t +# define int64_t gl_int64_t +# define GL_INT64_T +# elif @HAVE_LONG_LONG_INT@ +# undef int64_t typedef long long int gl_int64_t; -# define int64_t gl_int64_t -# define GL_INT64_T +# define int64_t gl_int64_t +# define GL_INT64_T +# endif #endif -#if ULONG_MAX >> 31 >> 31 >> 1 == 1 -# undef uint64_t -typedef unsigned long int gl_uint64_t; -# define uint64_t gl_uint64_t +#ifdef UINT64_MAX # define GL_UINT64_T -#elif defined _MSC_VER -# undef uint64_t +#else +# if ULONG_MAX >> 31 >> 31 >> 1 == 1 +# undef uint64_t +typedef unsigned long int gl_uint64_t; +# define uint64_t gl_uint64_t +# define GL_UINT64_T +# elif defined _MSC_VER +# undef uint64_t typedef unsigned __int64 gl_uint64_t; -# define uint64_t gl_uint64_t -# define GL_UINT64_T -#elif @HAVE_UNSIGNED_LONG_LONG_INT@ -# undef uint64_t +# define uint64_t gl_uint64_t +# define GL_UINT64_T +# elif @HAVE_UNSIGNED_LONG_LONG_INT@ +# undef uint64_t typedef unsigned long long int gl_uint64_t; -# define uint64_t gl_uint64_t -# define GL_UINT64_T +# define uint64_t gl_uint64_t +# define GL_UINT64_T +# endif #endif /* Avoid collision with Solaris 2.5.1 etc. */ @@ -282,6 +298,9 @@ typedef unsigned long int gl_uintmax_t; typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) ? 1 : -1]; +#define GNULIB_defined_stdint_types 1 +#endif /* !GNULIB_defined_stdint_types */ + /* 7.18.2. Limits of specified-width integer types */ #if ! defined __cplusplus || defined __STDC_LIMIT_MACROS @@ -312,17 +331,14 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) #define INT32_MAX 2147483647 #define UINT32_MAX 4294967295U -#undef INT64_MIN -#undef INT64_MAX -#ifdef GL_INT64_T +#if defined GL_INT64_T && ! defined INT64_MAX /* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0 evaluates the latter incorrectly in preprocessor expressions. */ # define INT64_MIN (- INTMAX_C (1) << 63) # define INT64_MAX INTMAX_C (9223372036854775807) #endif -#undef UINT64_MAX -#ifdef GL_UINT64_T +#if defined GL_UINT64_T && ! defined UINT64_MAX # define UINT64_MAX UINTMAX_C (18446744073709551615) #endif @@ -481,7 +497,12 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) sequence of nested includes -> -> -> , and the latter includes and assumes its types are already defined. */ -#if ! (defined WCHAR_MIN && defined WCHAR_MAX) +#if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX) + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ +# include +# include +# include # define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H # include # undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H