New modules 'unistr/u8-mbtouc-safe', 'unistr/u16-mbtouc-safe', 'unistr/u32-mbtouc...
[gnulib.git] / lib / stdint_.h
index adab4d7..a4f9a4c 100644 (file)
 
 /* <sys/types.h> defines some of the stdint.h types as well, on glibc,
    IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>).
+   AIX 5.2 <sys/types.h> isn't needed and causes troubles.
    MacOS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but
    relies on the system <stdint.h> definitions, so include
    <sys/types.h> after @ABSOLUTE_STDINT_H@.  */
-#if @HAVE_SYS_TYPES_H@
+#if @HAVE_SYS_TYPES_H@ && ! defined _AIX
 # include <sys/types.h>
 #endif
 
@@ -62,7 +63,9 @@
   /* In OpenBSD 3.8, <inttypes.h> includes <machine/types.h>, which defines
      int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__.
      <inttypes.h> also defines intptr_t and uintptr_t.  */
+# define _GL_JUST_INCLUDE_ABSOLUTE_INTTYPES_H
 # include <inttypes.h>
+# undef _GL_JUST_INCLUDE_ABSOLUTE_INTTYPES_H
 #elif @HAVE_SYS_INTTYPES_H@
   /* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and
      the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX.  */
 #define uint32_t unsigned int
 
 #undef int64_t
-#undef uint64_t
 #if LONG_MAX >> 31 >> 31 == 1
 # define int64_t long int
-# define uint64_t unsigned long int
 #elif defined _MSC_VER
 # define int64_t __int64
-# define uint64_t unsigned __int64
 #elif @HAVE_LONG_LONG_INT@
 # define int64_t long long int
+#endif
+
+#undef uint64_t
+#if ULONG_MAX >> 31 >> 31 >> 1 == 1
+# define uint64_t unsigned long int
+#elif defined _MSC_VER
+# define uint64_t unsigned __int64
+#elif @HAVE_UNSIGNED_LONG_LONG_INT@
 # define uint64_t unsigned long long int
 #endif
 
 #define uint_least32_t uint32_t
 #ifdef int64_t
 # define int_least64_t int64_t
+#endif
+#ifdef uint64_t
 # define uint_least64_t uint64_t
 #endif
 
 #define uint_fast32_t unsigned int_fast32_t
 #ifdef int64_t
 # define int_fast64_t int64_t
+#endif
+#ifdef uint64_t
 # define uint_fast64_t uint64_t
 #endif
 
    public header files. */
 
 #undef intmax_t
-#undef uintmax_t
 #if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
 # define intmax_t long long int
-# define uintmax_t unsigned long long int
 #elif defined int64_t
 # define intmax_t int64_t
-# define uintmax_t uint64_t
 #else
 # define intmax_t long int
+#endif
+
+#undef uintmax_t
+#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
+# define uintmax_t unsigned long long int
+#elif defined uint64_t
+# define uintmax_t uint64_t
+#else
 # define uintmax_t unsigned long int
 #endif
 
 
 #undef INT64_MIN
 #undef INT64_MAX
-#undef UINT64_MAX
 #ifdef int64_t
 # define INT64_MIN  (~ INT64_MAX)
 # define INT64_MAX  INTMAX_C (9223372036854775807)
+#endif
+
+#undef UINT64_MAX
+#ifdef uint64_t
 # define UINT64_MAX  UINTMAX_C (18446744073709551615)
 #endif
 
 
 #undef INT_LEAST64_MIN
 #undef INT_LEAST64_MAX
-#undef UINT_LEAST64_MAX
 #ifdef int64_t
 # define INT_LEAST64_MIN  INT64_MIN
 # define INT_LEAST64_MAX  INT64_MAX
+#endif
+
+#undef UINT_LEAST64_MAX
+#ifdef uint64_t
 # define UINT_LEAST64_MAX  UINT64_MAX
 #endif
 
 
 #undef INT_FAST64_MIN
 #undef INT_FAST64_MAX
-#undef UINT_FAST64_MAX
 #ifdef int64_t
 # define INT_FAST64_MIN  INT64_MIN
 # define INT_FAST64_MAX  INT64_MAX
+#endif
+
+#undef UINT_FAST64_MAX
+#ifdef uint64_t
 # define UINT_FAST64_MAX  UINT64_MAX
 #endif
 
 
 #undef INTMAX_MIN
 #undef INTMAX_MAX
-#undef UINTMAX_MAX
 #define INTMAX_MIN  (~ INTMAX_MAX)
 #ifdef INT64_MAX
 # define INTMAX_MAX  INT64_MAX
-# define UINTMAX_MAX  UINT64_MAX
 #else
 # define INTMAX_MAX  INT32_MAX
+#endif
+
+#undef UINTMAX_MAX
+#ifdef UINT64_MAX
+# define UINTMAX_MAX  UINT64_MAX
+#else
 # define UINTMAX_MAX  UINT32_MAX
 #endif
 
 #define WINT_MAX  \
    _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
 
+#endif /* !defined __cplusplus || defined __STDC_LIMIT_MACROS */
+
 /* 7.18.4. Macros for integer constants */
 
+#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 UINT64_C
 #if LONG_MAX >> 31 >> 31 == 1
 # define INT64_C(x) x##L
-# define UINT64_C(x) x##UL
 #elif defined _MSC_VER
 # define INT64_C(x) x##i64
-# define UINT64_C(x) x##ui64
 #elif @HAVE_LONG_LONG_INT@
 # define INT64_C(x) x##LL
+#endif
+#if ULONG_MAX >> 31 >> 31 >> 1 == 1
+# define UINT64_C(x) x##UL
+#elif defined _MSC_VER
+# define UINT64_C(x) x##ui64
+#elif @HAVE_UNSIGNED_LONG_LONG_INT@
 # define UINT64_C(x) x##ULL
 #endif
 
 /* 7.18.4.2. Macros for greatest-width integer constants */
 
 #undef INTMAX_C
-#undef UINTMAX_C
 #if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
 # define INTMAX_C(x)   x##LL
-# define UINTMAX_C(x)  x##ULL
 #elif defined int64_t
 # define INTMAX_C(x)   INT64_C(x)
-# define UINTMAX_C(x)  UINT64_C(x)
 #else
 # define INTMAX_C(x)   x##L
+#endif
+
+#undef UINTMAX_C
+#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
+# define UINTMAX_C(x)  x##ULL
+#elif defined uint64_t
+# define UINTMAX_C(x)  UINT64_C(x)
+#else
 # define UINTMAX_C(x)  x##UL
 #endif