]> sjero.net Git - wget/blobdiff - lib/stdint.in.h
Check for idna.h in /usr/include/idn.
[wget] / lib / stdint.in.h
index 121118cff7100dacf1ab7dff01d1fdaa7df56080..53aa34a870e4fe38b329d2a5fc578ea1d7dcb14b 100644 (file)
@@ -1,10 +1,10 @@
-/* Copyright (C) 2001-2002, 2004-2007 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2002, 2004-2009 Free Software Foundation, Inc.
    Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
    This file is part of gnulib.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
    This file is part of gnulib.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    This program is distributed in the hope that it will be useful,
    any later version.
 
    This program is distributed in the hope that it will be useful,
 
 #ifndef _GL_STDINT_H
 
 
 #ifndef _GL_STDINT_H
 
+/* When including a system file that in turn includes <inttypes.h>,
+   use the system <inttypes.h>, not our substitute.  This avoids
+   problems with (for example) VMS, whose <sys/bitypes.h> includes
+   <inttypes.h>.  */
+#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
+
 /* Get those types that are already defined in other system include
    files, so that we can "#define int8_t signed char" below without
    worrying about a later system include file containing a "typedef
 /* Get those types that are already defined in other system include
    files, so that we can "#define int8_t signed char" below without
    worrying about a later system include file containing a "typedef
@@ -43,6 +49,9 @@
      in <inttypes.h> would reinclude us, skipping our contents because
      _GL_STDINT_H is defined.
      The include_next requires a split double-inclusion guard.  */
      in <inttypes.h> would reinclude us, skipping our contents because
      _GL_STDINT_H is defined.
      The include_next requires a split double-inclusion guard.  */
+# if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+# endif
 # @INCLUDE_NEXT@ @NEXT_STDINT_H@
 #endif
 
 # @INCLUDE_NEXT@ @NEXT_STDINT_H@
 #endif
 
@@ -66,9 +75,7 @@
   /* 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.  */
   /* 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_SYSTEM_INTTYPES_H
 # include <inttypes.h>
 # include <inttypes.h>
-# undef _GL_JUST_INCLUDE_SYSTEM_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.  */
 #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.  */
 # include <sys/bitypes.h>
 #endif
 
 # include <sys/bitypes.h>
 #endif
 
-#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
-
-/* Get WCHAR_MIN, WCHAR_MAX.  */
-# if ! (defined WCHAR_MIN && defined WCHAR_MAX)
-#  include <wchar.h>
-# endif
-
-#endif
+#undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
 
 /* Minimum and maximum values for a integer type under the usual assumption.
    Return an unspecified value if BITS == 0, adding a check to pacify
 
 /* Minimum and maximum values for a integer type under the usual assumption.
    Return an unspecified value if BITS == 0, adding a check to pacify
 #define _STDINT_MAX(signed, bits, zero) \
   ((signed) \
    ? ~ _STDINT_MIN (signed, bits, zero) \
 #define _STDINT_MAX(signed, bits, zero) \
   ((signed) \
    ? ~ _STDINT_MIN (signed, bits, zero) \
-   : ((((zero) + 1) << ((bits) ? (bits) - 1 : 0)) - 1) * 2 + 1)
+   : /* The expression for the unsigned case.  The subtraction of (signed) \
+       is a nop in the unsigned case and avoids "signed integer overflow" \
+       warnings in the signed case.  */ \
+     ((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1)
 
 /* 7.18.1.1. Exact-width integer types */
 
 
 /* 7.18.1.1. Exact-width integer types */
 
 
 #undef int8_t
 #undef uint8_t
 
 #undef int8_t
 #undef uint8_t
-#define int8_t signed char
-#define uint8_t unsigned char
+typedef signed char gl_int8_t;
+typedef unsigned char gl_uint8_t;
+#define int8_t gl_int8_t
+#define uint8_t gl_uint8_t
 
 #undef int16_t
 #undef uint16_t
 
 #undef int16_t
 #undef uint16_t
-#define int16_t short int
-#define uint16_t unsigned short int
+typedef short int gl_int16_t;
+typedef unsigned short int gl_uint16_t;
+#define int16_t gl_int16_t
+#define uint16_t gl_uint16_t
 
 #undef int32_t
 #undef uint32_t
 
 #undef int32_t
 #undef uint32_t
-#define int32_t int
-#define uint32_t unsigned int
+typedef int gl_int32_t;
+typedef unsigned int gl_uint32_t;
+#define int32_t gl_int32_t
+#define uint32_t gl_uint32_t
 
 /* 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
 
 /* 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
-# define int64_t long int
+typedef long int gl_int64_t;
+# define int64_t gl_int64_t
 # define GL_INT64_T
 #elif defined _MSC_VER
 # undef int64_t
 # define GL_INT64_T
 #elif defined _MSC_VER
 # undef int64_t
-# define int64_t __int64
+typedef __int64 gl_int64_t;
+# define int64_t gl_int64_t
 # define GL_INT64_T
 #elif @HAVE_LONG_LONG_INT@
 # undef int64_t
 # define GL_INT64_T
 #elif @HAVE_LONG_LONG_INT@
 # undef int64_t
-# define int64_t long long int
+typedef long long int gl_int64_t;
+# define int64_t gl_int64_t
 # define GL_INT64_T
 #endif
 
 #if ULONG_MAX >> 31 >> 31 >> 1 == 1
 # undef uint64_t
 # define GL_INT64_T
 #endif
 
 #if ULONG_MAX >> 31 >> 31 >> 1 == 1
 # undef uint64_t
-# define uint64_t unsigned long int
+typedef unsigned long int gl_uint64_t;
+# define uint64_t gl_uint64_t
 # define GL_UINT64_T
 #elif defined _MSC_VER
 # undef uint64_t
 # define GL_UINT64_T
 #elif defined _MSC_VER
 # undef uint64_t
-# define uint64_t unsigned __int64
+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 GL_UINT64_T
 #elif @HAVE_UNSIGNED_LONG_LONG_INT@
 # undef uint64_t
-# define uint64_t unsigned long long int
+typedef unsigned long long int gl_uint64_t;
+# define uint64_t gl_uint64_t
 # define GL_UINT64_T
 #endif
 
 # define GL_UINT64_T
 #endif
 
 #undef uint_fast32_t
 #undef int_fast64_t
 #undef uint_fast64_t
 #undef uint_fast32_t
 #undef int_fast64_t
 #undef uint_fast64_t
-#define int_fast8_t long int
-#define uint_fast8_t unsigned int_fast8_t
-#define int_fast16_t long int
-#define uint_fast16_t unsigned int_fast16_t
-#define int_fast32_t long int
-#define uint_fast32_t unsigned int_fast32_t
+typedef long int gl_int_fast8_t;
+typedef unsigned long int gl_uint_fast8_t;
+typedef long int gl_int_fast16_t;
+typedef unsigned long int gl_uint_fast16_t;
+typedef long int gl_int_fast32_t;
+typedef unsigned long int gl_uint_fast32_t;
+#define int_fast8_t gl_int_fast8_t
+#define uint_fast8_t gl_uint_fast8_t
+#define int_fast16_t gl_int_fast16_t
+#define uint_fast16_t gl_uint_fast16_t
+#define int_fast32_t gl_int_fast32_t
+#define uint_fast32_t gl_uint_fast32_t
 #ifdef GL_INT64_T
 # define int_fast64_t int64_t
 #endif
 #ifdef GL_INT64_T
 # define int_fast64_t int64_t
 #endif
 
 #undef intptr_t
 #undef uintptr_t
 
 #undef intptr_t
 #undef uintptr_t
-#define intptr_t long int
-#define uintptr_t unsigned long int
+typedef long int gl_intptr_t;
+typedef unsigned long int gl_uintptr_t;
+#define intptr_t gl_intptr_t
+#define uintptr_t gl_uintptr_t
 
 /* 7.18.1.5. Greatest-width integer types */
 
 
 /* 7.18.1.5. Greatest-width integer types */
 
 
 #undef intmax_t
 #if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
 
 #undef intmax_t
 #if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
-# define intmax_t long long int
+typedef long long int gl_intmax_t;
+# define intmax_t gl_intmax_t
 #elif defined GL_INT64_T
 # define intmax_t int64_t
 #else
 #elif defined GL_INT64_T
 # define intmax_t int64_t
 #else
-# define intmax_t long int
+typedef long int gl_intmax_t;
+# define intmax_t gl_intmax_t
 #endif
 
 #undef uintmax_t
 #if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
 #endif
 
 #undef uintmax_t
 #if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
-# define uintmax_t unsigned long long int
+typedef unsigned long long int gl_uintmax_t;
+# define uintmax_t gl_uintmax_t
 #elif defined GL_UINT64_T
 # define uintmax_t uint64_t
 #else
 #elif defined GL_UINT64_T
 # define uintmax_t uint64_t
 #else
-# define uintmax_t unsigned long int
+typedef unsigned long int gl_uintmax_t;
+# define uintmax_t gl_uintmax_t
 #endif
 
 #endif
 
+/* Verify that intmax_t and uintmax_t have the same size.  Too much code
+   breaks if this is not the case.  If this check fails, the reason is likely
+   to be found in the autoconf macros.  */
+typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) - 1];
+
 /* 7.18.2. Limits of specified-width integer types */
 
 #if ! defined __cplusplus || defined __STDC_LIMIT_MACROS
 /* 7.18.2. Limits of specified-width integer types */
 
 #if ! defined __cplusplus || defined __STDC_LIMIT_MACROS
 /* ptrdiff_t limits */
 #undef PTRDIFF_MIN
 #undef PTRDIFF_MAX
 /* ptrdiff_t limits */
 #undef PTRDIFF_MIN
 #undef PTRDIFF_MAX
-#define PTRDIFF_MIN  \
-   _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
-#define PTRDIFF_MAX  \
-   _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
+#if @APPLE_UNIVERSAL_BUILD@
+# ifdef _LP64
+#  define PTRDIFF_MIN  _STDINT_MIN (1, 64, 0l)
+#  define PTRDIFF_MAX  _STDINT_MAX (1, 64, 0l)
+# else
+#  define PTRDIFF_MIN  _STDINT_MIN (1, 32, 0)
+#  define PTRDIFF_MAX  _STDINT_MAX (1, 32, 0)
+# endif
+#else
+# define PTRDIFF_MIN  \
+    _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
+# define PTRDIFF_MAX  \
+    _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
+#endif
 
 /* sig_atomic_t limits */
 #undef SIG_ATOMIC_MIN
 
 /* sig_atomic_t limits */
 #undef SIG_ATOMIC_MIN
 
 /* size_t limit */
 #undef SIZE_MAX
 
 /* size_t limit */
 #undef SIZE_MAX
-#define SIZE_MAX  _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@)
+#if @APPLE_UNIVERSAL_BUILD@
+# ifdef _LP64
+#  define SIZE_MAX  _STDINT_MAX (0, 64, 0ul)
+# else
+#  define SIZE_MAX  _STDINT_MAX (0, 32, 0ul)
+# endif
+#else
+# define SIZE_MAX  _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@)
+#endif
 
 /* wchar_t limits */
 
 /* wchar_t limits */
+/* Get WCHAR_MIN, WCHAR_MAX.
+   This include is not on the top, above, because on OSF/1 4.0 we have a sequence of nested
+   includes <wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter includes
+   <stdint.h> and assumes its types are already defined.  */
+#if ! (defined WCHAR_MIN && defined WCHAR_MAX)
+# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
+# include <wchar.h>
+# undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
+#endif
 #undef WCHAR_MIN
 #undef WCHAR_MAX
 #define WCHAR_MIN  \
 #undef WCHAR_MIN
 #undef WCHAR_MAX
 #define WCHAR_MIN  \