Reduce namespace pollution on glibc systems.
[gnulib.git] / lib / inttypes.in.h
index f9f3119..2fac7e5 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006-2007 Free Software Foundation, Inc.
+/* Copyright (C) 2006-2009 Free Software Foundation, Inc.
    Written by Paul Eggert, Bruno Haible, Derek Price.
    This file is part of gnulib.
 
    Written by Paul Eggert, Bruno Haible, Derek Price.
    This file is part of gnulib.
 
@@ -26,6 +26,9 @@
    The include_next requires a split double-inclusion guard.  */
 #if ! defined INTTYPES_H || defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
 # if @HAVE_INTTYPES_H@
    The include_next requires a split double-inclusion guard.  */
 #if ! defined INTTYPES_H || defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
 # if @HAVE_INTTYPES_H@
+#  if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#  endif
 #  @INCLUDE_NEXT@ @NEXT_INTTYPES_H@
 # endif
 #endif
 #  @INCLUDE_NEXT@ @NEXT_INTTYPES_H@
 # endif
 #endif
 #if ! defined INTTYPES_H && ! defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
 #define INTTYPES_H
 
 #if ! defined INTTYPES_H && ! defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
 #define INTTYPES_H
 
-/* Include <stdint.h> or the gnulib replacement.  */
-#include <stdint.h>
+/* Include <stdint.h> or the gnulib replacement.
+   But avoid namespace pollution on glibc systems.  */
+#ifndef __GLIBC__
+# include <stdint.h>
+#endif
 /* Get CHAR_BIT.  */
 #include <limits.h>
 
 /* Get CHAR_BIT.  */
 #include <limits.h>
 
@@ -44,6 +50,8 @@
 
 /* The definition of GL_LINK_WARNING is copied here.  */
 
 
 /* The definition of GL_LINK_WARNING is copied here.  */
 
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
 /* 7.8.1 Macros for format specifiers */
 
 #if ! defined __cplusplus || defined __STDC_FORMAT_MACROS
 /* 7.8.1 Macros for format specifiers */
 
 #if ! defined __cplusplus || defined __STDC_FORMAT_MACROS
 #  endif
 # endif
 # ifdef INT64_MAX
 #  endif
 # endif
 # ifdef INT64_MAX
-#  if INT64_MAX == LONG_MAX
+#  if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @INT64_MAX_EQ_LONG_MAX@)
 #   define _PRI64_PREFIX "l"
 #  elif defined _MSC_VER || defined __MINGW32__
 #   define _PRI64_PREFIX "I64"
 #   define _PRI64_PREFIX "l"
 #  elif defined _MSC_VER || defined __MINGW32__
 #   define _PRI64_PREFIX "I64"
 #  endif
 # endif
 # ifdef UINT64_MAX
 #  endif
 # endif
 # ifdef UINT64_MAX
-#  if UINT64_MAX == ULONG_MAX
+#  if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @UINT64_MAX_EQ_ULONG_MAX@)
 #   define _PRIu64_PREFIX "l"
 #  elif defined _MSC_VER || defined __MINGW32__
 #   define _PRIu64_PREFIX "I64"
 #   define _PRIu64_PREFIX "l"
 #  elif defined _MSC_VER || defined __MINGW32__
 #   define _PRIu64_PREFIX "I64"
 
 # if !defined PRIdMAX || @PRI_MACROS_BROKEN@
 #  undef PRIdMAX
 
 # if !defined PRIdMAX || @PRI_MACROS_BROKEN@
 #  undef PRIdMAX
-#  if INTMAX_MAX > INT32_MAX
+#  if @INT32_MAX_LT_INTMAX_MAX@
 #   define PRIdMAX PRId64
 #  else
 #   define PRIdMAX "ld"
 #   define PRIdMAX PRId64
 #  else
 #   define PRIdMAX "ld"
 # endif
 # if !defined PRIiMAX || @PRI_MACROS_BROKEN@
 #  undef PRIiMAX
 # endif
 # if !defined PRIiMAX || @PRI_MACROS_BROKEN@
 #  undef PRIiMAX
-#  if INTMAX_MAX > INT32_MAX
+#  if @INT32_MAX_LT_INTMAX_MAX@
 #   define PRIiMAX PRIi64
 #  else
 #   define PRIiMAX "li"
 #   define PRIiMAX PRIi64
 #  else
 #   define PRIiMAX "li"
 # endif
 # if !defined PRIoMAX || @PRI_MACROS_BROKEN@
 #  undef PRIoMAX
 # endif
 # if !defined PRIoMAX || @PRI_MACROS_BROKEN@
 #  undef PRIoMAX
-#  if UINTMAX_MAX > UINT32_MAX
+#  if @UINT32_MAX_LT_UINTMAX_MAX@
 #   define PRIoMAX PRIo64
 #  else
 #   define PRIoMAX "lo"
 #   define PRIoMAX PRIo64
 #  else
 #   define PRIoMAX "lo"
 # endif
 # if !defined PRIuMAX || @PRI_MACROS_BROKEN@
 #  undef PRIuMAX
 # endif
 # if !defined PRIuMAX || @PRI_MACROS_BROKEN@
 #  undef PRIuMAX
-#  if UINTMAX_MAX > UINT32_MAX
+#  if @UINT32_MAX_LT_UINTMAX_MAX@
 #   define PRIuMAX PRIu64
 #  else
 #   define PRIuMAX "lu"
 #   define PRIuMAX PRIu64
 #  else
 #   define PRIuMAX "lu"
 # endif
 # if !defined PRIxMAX || @PRI_MACROS_BROKEN@
 #  undef PRIxMAX
 # endif
 # if !defined PRIxMAX || @PRI_MACROS_BROKEN@
 #  undef PRIxMAX
-#  if UINTMAX_MAX > UINT32_MAX
+#  if @UINT32_MAX_LT_UINTMAX_MAX@
 #   define PRIxMAX PRIx64
 #  else
 #   define PRIxMAX "lx"
 #   define PRIxMAX PRIx64
 #  else
 #   define PRIxMAX "lx"
 # endif
 # if !defined PRIXMAX || @PRI_MACROS_BROKEN@
 #  undef PRIXMAX
 # endif
 # if !defined PRIXMAX || @PRI_MACROS_BROKEN@
 #  undef PRIXMAX
-#  if UINTMAX_MAX > UINT32_MAX
+#  if @UINT32_MAX_LT_UINTMAX_MAX@
 #   define PRIXMAX PRIX64
 #  else
 #   define PRIXMAX "lX"
 #   define PRIXMAX PRIX64
 #  else
 #   define PRIXMAX "lX"
 #  endif
 # endif
 # ifdef INT64_MAX
 #  endif
 # endif
 # ifdef INT64_MAX
-#  if INT64_MAX == LONG_MAX
+#  if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @INT64_MAX_EQ_LONG_MAX@)
 #   define _SCN64_PREFIX "l"
 #  elif defined _MSC_VER || defined __MINGW32__
 #   define _SCN64_PREFIX "I64"
 #   define _SCN64_PREFIX "l"
 #  elif defined _MSC_VER || defined __MINGW32__
 #   define _SCN64_PREFIX "I64"
 #  endif
 # endif
 # ifdef UINT64_MAX
 #  endif
 # endif
 # ifdef UINT64_MAX
-#  if UINT64_MAX == ULONG_MAX
+#  if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @UINT64_MAX_EQ_ULONG_MAX@)
 #   define _SCNu64_PREFIX "l"
 #  elif defined _MSC_VER || defined __MINGW32__
 #   define _SCNu64_PREFIX "I64"
 #   define _SCNu64_PREFIX "l"
 #  elif defined _MSC_VER || defined __MINGW32__
 #   define _SCNu64_PREFIX "I64"
 
 # if !defined SCNdMAX || @PRI_MACROS_BROKEN@
 #  undef SCNdMAX
 
 # if !defined SCNdMAX || @PRI_MACROS_BROKEN@
 #  undef SCNdMAX
-#  if INTMAX_MAX > INT32_MAX
+#  if @INT32_MAX_LT_INTMAX_MAX@
 #   define SCNdMAX SCNd64
 #  else
 #   define SCNdMAX "ld"
 #   define SCNdMAX SCNd64
 #  else
 #   define SCNdMAX "ld"
 # endif
 # if !defined SCNiMAX || @PRI_MACROS_BROKEN@
 #  undef SCNiMAX
 # endif
 # if !defined SCNiMAX || @PRI_MACROS_BROKEN@
 #  undef SCNiMAX
-#  if INTMAX_MAX > INT32_MAX
+#  if @INT32_MAX_LT_INTMAX_MAX@
 #   define SCNiMAX SCNi64
 #  else
 #   define SCNiMAX "li"
 #   define SCNiMAX SCNi64
 #  else
 #   define SCNiMAX "li"
 # endif
 # if !defined SCNoMAX || @PRI_MACROS_BROKEN@
 #  undef SCNoMAX
 # endif
 # if !defined SCNoMAX || @PRI_MACROS_BROKEN@
 #  undef SCNoMAX
-#  if UINTMAX_MAX > UINT32_MAX
+#  if @UINT32_MAX_LT_UINTMAX_MAX@
 #   define SCNoMAX SCNo64
 #  else
 #   define SCNoMAX "lo"
 #   define SCNoMAX SCNo64
 #  else
 #   define SCNoMAX "lo"
 # endif
 # if !defined SCNuMAX || @PRI_MACROS_BROKEN@
 #  undef SCNuMAX
 # endif
 # if !defined SCNuMAX || @PRI_MACROS_BROKEN@
 #  undef SCNuMAX
-#  if UINTMAX_MAX > UINT32_MAX
+#  if @UINT32_MAX_LT_UINTMAX_MAX@
 #   define SCNuMAX SCNu64
 #  else
 #   define SCNuMAX "lu"
 #   define SCNuMAX SCNu64
 #  else
 #   define SCNuMAX "lu"
 # endif
 # if !defined SCNxMAX || @PRI_MACROS_BROKEN@
 #  undef SCNxMAX
 # endif
 # if !defined SCNxMAX || @PRI_MACROS_BROKEN@
 #  undef SCNxMAX
-#  if UINTMAX_MAX > UINT32_MAX
+#  if @UINT32_MAX_LT_UINTMAX_MAX@
 #   define SCNxMAX SCNx64
 #  else
 #   define SCNxMAX "lx"
 #   define SCNxMAX SCNx64
 #  else
 #   define SCNxMAX "lx"
@@ -1063,7 +1071,7 @@ extern imaxdiv_t imaxdiv (intmax_t, intmax_t);
 
 #if @GNULIB_STRTOIMAX@
 # if !@HAVE_DECL_STRTOIMAX@
 
 #if @GNULIB_STRTOIMAX@
 # if !@HAVE_DECL_STRTOIMAX@
-extern intmax_t strtoimax (const char *, char **, int);
+extern intmax_t strtoimax (const char *, char **, int) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtoimax
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtoimax
@@ -1075,7 +1083,7 @@ extern intmax_t strtoimax (const char *, char **, int);
 
 #if @GNULIB_STRTOUMAX@
 # if !@HAVE_DECL_STRTOUMAX@
 
 #if @GNULIB_STRTOUMAX@
 # if !@HAVE_DECL_STRTOUMAX@
-extern uintmax_t strtoumax (const char *, char **, int);
+extern uintmax_t strtoumax (const char *, char **, int) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtoumax
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtoumax