X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Finttypes_.h;h=be2bdabbac69a87201b073388c324615a8e73a64;hb=dd6ceef65e424d30db8706273f88c20b015012ce;hp=c6e40ddc06190d0ec5701203d48bb246f0d0231e;hpb=b1d6af1582daa8f87558fde634a441f88f02886c;p=gnulib.git diff --git a/lib/inttypes_.h b/lib/inttypes_.h index c6e40ddc0..be2bdabba 100644 --- a/lib/inttypes_.h +++ b/lib/inttypes_.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2006 Free Software Foundation, Inc. +/* Copyright (C) 2006-2007 Free Software Foundation, Inc. Written by Paul Eggert, Bruno Haible, Derek Price. This file is part of gnulib. @@ -16,7 +16,20 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef INTTYPES_H +/* Include the original if it exists, and if this file + has not been included yet or if this file includes gnulib stdint.h + which in turn includes this file. */ +#if ! defined INTTYPES_H || defined _GL_JUST_INCLUDE_ABSOLUTE_INTTYPES_H +# if @HAVE_INTTYPES_H@ +# if @HAVE_INCLUDE_NEXT@ +# include_next +# else +# include @ABSOLUTE_INTTYPES_H@ +# endif +# endif +#endif + +#if ! defined INTTYPES_H && ! defined _GL_JUST_INCLUDE_ABSOLUTE_INTTYPES_H #define INTTYPES_H /* @@ -24,10 +37,6 @@ * */ -/* Include the original if it exists. */ -#if @HAVE_INTTYPES_H@ -# include @ABSOLUTE_INTTYPES_H@ -#endif /* Include or the gnulib replacement. */ #include /* Get CHAR_BIT. */ @@ -37,10 +46,20 @@ # error "This file assumes that 'int' has exactly 32 bits. Please report your platform and compiler to ." #endif +/* The definition of GL_LINK_WARNING is copied here. */ + /* 7.8.1 Macros for format specifiers */ #if ! defined __cplusplus || defined __STDC_FORMAT_MACROS +# if defined _TNS_R_TARGET + /* Tandem NonStop R series and compatible platforms released before + July 2005 support %Ld but not %lld. */ +# define _LONG_LONG_FORMAT_PREFIX "L" +# else +# define _LONG_LONG_FORMAT_PREFIX "ll" +# endif + # if !defined PRId8 || @PRI_MACROS_BROKEN@ # undef PRId8 # ifdef INT8_MAX @@ -155,7 +174,7 @@ # elif defined _MSC_VER || defined __MINGW32__ # define _PRI64_PREFIX "I64" # elif @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 -# define _PRI64_PREFIX "ll" +# define _PRI64_PREFIX _LONG_LONG_FORMAT_PREFIX # endif # if !defined PRId64 || @PRI_MACROS_BROKEN@ # undef PRId64 @@ -167,12 +186,12 @@ # endif # endif # ifdef UINT64_MAX -# if INT64_MAX == LONG_MAX +# if UINT64_MAX == ULONG_MAX # define _PRIu64_PREFIX "l" # elif defined _MSC_VER || defined __MINGW32__ # define _PRIu64_PREFIX "I64" -# elif @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 -# define _PRIu64_PREFIX "ll" +# elif @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 +# define _PRIu64_PREFIX _LONG_LONG_FORMAT_PREFIX # endif # if !defined PRIo64 || @PRI_MACROS_BROKEN@ # undef PRIo64 @@ -582,12 +601,6 @@ # define SCNx8 "hhx" # endif # endif -# if !defined SCNX8 || @PRI_MACROS_BROKEN@ -# undef SCNX8 -# ifdef UINT8_MAX -# define SCNX8 "hhX" -# endif -# endif # if !defined SCNd16 || @PRI_MACROS_BROKEN@ # undef SCNd16 # ifdef INT16_MAX @@ -618,12 +631,6 @@ # define SCNx16 "hx" # endif # endif -# if !defined SCNX16 || @PRI_MACROS_BROKEN@ -# undef SCNX16 -# ifdef UINT16_MAX -# define SCNX16 "hX" -# endif -# endif # if !defined SCNd32 || @PRI_MACROS_BROKEN@ # undef SCNd32 # ifdef INT32_MAX @@ -654,19 +661,13 @@ # define SCNx32 "x" # endif # endif -# if !defined SCNX32 || @PRI_MACROS_BROKEN@ -# undef SCNX32 -# ifdef UINT32_MAX -# define SCNX32 "X" -# endif -# endif # ifdef INT64_MAX # if INT64_MAX == LONG_MAX # define _SCN64_PREFIX "l" # elif defined _MSC_VER || defined __MINGW32__ # define _SCN64_PREFIX "I64" # elif @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 -# define _SCN64_PREFIX "ll" +# define _SCN64_PREFIX _LONG_LONG_FORMAT_PREFIX # endif # if !defined SCNd64 || @PRI_MACROS_BROKEN@ # undef SCNd64 @@ -678,12 +679,12 @@ # endif # endif # ifdef UINT64_MAX -# if INT64_MAX == LONG_MAX +# if UINT64_MAX == ULONG_MAX # define _SCNu64_PREFIX "l" # elif defined _MSC_VER || defined __MINGW32__ # define _SCNu64_PREFIX "I64" -# elif @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 -# define _SCNu64_PREFIX "ll" +# elif @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 +# define _SCNu64_PREFIX _LONG_LONG_FORMAT_PREFIX # endif # if !defined SCNo64 || @PRI_MACROS_BROKEN@ # undef SCNo64 @@ -697,10 +698,6 @@ # undef SCNx64 # define SCNx64 _SCNu64_PREFIX "x" # endif -# if !defined SCNX64 || @PRI_MACROS_BROKEN@ -# undef SCNX64 -# define SCNX64 _SCNu64_PREFIX "X" -# endif # endif # if !defined SCNdLEAST8 || @PRI_MACROS_BROKEN@ @@ -723,10 +720,6 @@ # undef SCNxLEAST8 # define SCNxLEAST8 "hhx" # endif -# if !defined SCNXLEAST8 || @PRI_MACROS_BROKEN@ -# undef SCNXLEAST8 -# define SCNXLEAST8 "hhX" -# endif # if !defined SCNdLEAST16 || @PRI_MACROS_BROKEN@ # undef SCNdLEAST16 # define SCNdLEAST16 "hd" @@ -747,10 +740,6 @@ # undef SCNxLEAST16 # define SCNxLEAST16 "hx" # endif -# if !defined SCNXLEAST16 || @PRI_MACROS_BROKEN@ -# undef SCNXLEAST16 -# define SCNXLEAST16 "hX" -# endif # if !defined SCNdLEAST32 || @PRI_MACROS_BROKEN@ # undef SCNdLEAST32 # define SCNdLEAST32 "d" @@ -771,10 +760,6 @@ # undef SCNxLEAST32 # define SCNxLEAST32 "x" # endif -# if !defined SCNXLEAST32 || @PRI_MACROS_BROKEN@ -# undef SCNXLEAST32 -# define SCNXLEAST32 "X" -# endif # ifdef INT64_MAX # if !defined SCNdLEAST64 || @PRI_MACROS_BROKEN@ # undef SCNdLEAST64 @@ -798,10 +783,6 @@ # undef SCNxLEAST64 # define SCNxLEAST64 SCNx64 # endif -# if !defined SCNXLEAST64 || @PRI_MACROS_BROKEN@ -# undef SCNXLEAST64 -# define SCNXLEAST64 SCNX64 -# endif # endif # if !defined SCNdFAST8 || @PRI_MACROS_BROKEN@ @@ -864,18 +845,6 @@ # define SCNxFAST8 "x" # endif # endif -# if !defined SCNXFAST8 || @PRI_MACROS_BROKEN@ -# undef SCNXFAST8 -# if UINT_FAST8_MAX > UINT32_MAX -# define SCNXFAST8 SCNX64 -# elif UINT_FAST8_MAX == 0xffff -# define SCNXFAST8 "hX" -# elif UINT_FAST8_MAX == 0xff -# define SCNXFAST8 "hhX" -# else -# define SCNXFAST8 "X" -# endif -# endif # if !defined SCNdFAST16 || @PRI_MACROS_BROKEN@ # undef SCNdFAST16 # if INT_FAST16_MAX > INT32_MAX @@ -926,16 +895,6 @@ # define SCNxFAST16 "x" # endif # endif -# if !defined SCNXFAST16 || @PRI_MACROS_BROKEN@ -# undef SCNXFAST16 -# if UINT_FAST16_MAX > UINT32_MAX -# define SCNXFAST16 SCNX64 -# elif UINT_FAST16_MAX == 0xffff -# define SCNXFAST16 "hX" -# else -# define SCNXFAST16 "X" -# endif -# endif # if !defined SCNdFAST32 || @PRI_MACROS_BROKEN@ # undef SCNdFAST32 # if INT_FAST32_MAX > INT32_MAX @@ -976,14 +935,6 @@ # define SCNxFAST32 "x" # endif # endif -# if !defined SCNXFAST32 || @PRI_MACROS_BROKEN@ -# undef SCNXFAST32 -# if UINT_FAST32_MAX > UINT32_MAX -# define SCNXFAST32 SCNX64 -# else -# define SCNXFAST32 "X" -# endif -# endif # ifdef INT64_MAX # if !defined SCNdFAST64 || @PRI_MACROS_BROKEN@ # undef SCNdFAST64 @@ -1007,10 +958,6 @@ # undef SCNxFAST64 # define SCNxFAST64 SCNx64 # endif -# if !defined SCNXFAST64 || @PRI_MACROS_BROKEN@ -# undef SCNXFAST64 -# define SCNXFAST64 SCNX64 -# endif # endif # if !defined SCNdMAX || @PRI_MACROS_BROKEN@ @@ -1053,14 +1000,6 @@ # define SCNxMAX "lx" # endif # endif -# if !defined SCNXMAX || @PRI_MACROS_BROKEN@ -# undef SCNXMAX -# if UINTMAX_MAX > UINT32_MAX -# define SCNXMAX SCNX64 -# else -# define SCNXMAX "lX" -# endif -# endif # if !defined SCNdPTR || @PRI_MACROS_BROKEN@ # undef SCNdPTR @@ -1092,12 +1031,6 @@ # define SCNxPTR @PRIPTR_PREFIX@ "x" # endif # endif -# if !defined SCNXPTR || @PRI_MACROS_BROKEN@ -# undef SCNXPTR -# ifdef UINTPTR_MAX -# define SCNXPTR @PRIPTR_PREFIX@ "X" -# endif -# endif #endif @@ -1107,20 +1040,53 @@ extern "C" { #endif -#if !@HAVE_DECL_IMAXABS@ +#if @GNULIB_IMAXABS@ +# if !@HAVE_DECL_IMAXABS@ extern intmax_t imaxabs (intmax_t); +# endif +#elif defined GNULIB_POSIXCHECK +# undef imaxabs +# define imaxabs(a) \ + (GL_LINK_WARNING ("imaxabs is unportable - " \ + "use gnulib module imaxabs for portability"), \ + imaxabs (a)) #endif -#if !@HAVE_DECL_IMAXDIV@ +#if @GNULIB_IMAXDIV@ +# if !@HAVE_DECL_IMAXDIV@ typedef struct { intmax_t quot; intmax_t rem; } imaxdiv_t; extern imaxdiv_t imaxdiv (intmax_t, intmax_t); +# endif +#elif defined GNULIB_POSIXCHECK +# undef imaxdiv +# define imaxdiv(a,b) \ + (GL_LINK_WARNING ("imaxdiv is unportable - " \ + "use gnulib module imaxdiv for portability"), \ + imaxdiv (a, b)) #endif -#if !@HAVE_DECL_STRTOIMAX@ +#if @GNULIB_STRTOIMAX@ +# if !@HAVE_DECL_STRTOIMAX@ extern intmax_t strtoimax (const char *, char **, int); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strtoimax +# define strtoimax(p,e,b) \ + (GL_LINK_WARNING ("strtoimax is unportable - " \ + "use gnulib module strtoimax for portability"), \ + strtoimax (p, e, b)) #endif -#if !@HAVE_DECL_STRTOUMAX@ + +#if @GNULIB_STRTOUMAX@ +# if !@HAVE_DECL_STRTOUMAX@ extern uintmax_t strtoumax (const char *, char **, int); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strtoumax +# define strtoumax(p,e,b) \ + (GL_LINK_WARNING ("strtoumax is unportable - " \ + "use gnulib module strtoumax for portability"), \ + strtoumax (p, e, b)) #endif /* Don't bother defining or declaring wcstoimax and wcstoumax, since