[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: rewritten inttypes module
From: |
Bruno Haible |
Subject: |
Re: rewritten inttypes module |
Date: |
Mon, 28 Aug 2006 14:44:25 +0200 |
User-agent: |
KMail/1.9.1 |
Paul Eggert wrote a month ago:
> I was worried about the case where an implementation provides a
> conforming stdint.h but not a conforming inttypes.h. Such an
> implementation might have 64-bit int. There are a few ILP64 hosts,
> e.g., GCC on MIPS with the -mint64 option. Currently, I suspect that
> all these platforms fail to have conforming stdint.h or inttypes.h
> (since we are so picky about conformance) but it's possible we'll run
> into one as conformance improves (i.e., we're not talking about old
> UNIVACs here :-).
>
> Instead of adding more ifdefs you could add a simple compile-time test
> that INT_MIN == INT32_MIN && INT32_MAX == INT_MAX, and we can fill in
> the blanks later, if/when we run into a host with 64-bit int.
Agreed. I'm adding this verification so we get notified when the case of
a 64-bit 'int' appears for real.
> >> I don't see why the changes to lib/stdint_.h, m4/stdint.m4, and
> >> modules/stdint are needed. They have an effect only if we use
> >> gnulib's inttypes.h and gnulib's stdint.h. If the program includes
> >> inttypes.h first, this includes stdint.h, which in turn recursively
> >> includes inttypes.h, but this innermost include is a noop because
> >> INTTYPES_H is defined.
> >
> > Yes, and it shouldn't be a noop. It should include the system's inttypes.h
> > file. Otherwise, if a user source code does
> >
> > #include <inttypes.h>
> > #include </usr/include/inttypes.h>
> >
> > it leads to big havoc.
>
> I don't see how the havoc could occur, since the substitute
> <inttypes.h> includes /usr/include/inttypes.h before it includes
> the substitute <stdint.h>.
OK, my argument was not good. A better argument is: If our replacement
<stdint.h> includes simply <inttypes.h>, not @ABSOLUTE_INTTYPES_H@, then
a simple
#include <stdint.h>
will do the wrong thing: It will
- start including our stdint.h,
- include the system's stdint.h,
- start including our inttypes.h,
- include the system's inttypes.h,
- include our stdint.h, but this has no effect due to the double-inclusion
guard,
- go on testing various macros like UINT32_MAX or INT64_MAX
which have not been defined yet!
- end including our inttypes.h,
- define the various *_MIN and *_MAX macros
- end including our stdint.h.
Whereas if our replacement <stdint.h> includes @ABSOLUTE_INTTYPES_H@, the
sequence of events is this:
- start including our stdint.h,
- include the system's stdint.h,
- start including the system's inttypes.h,
- possibly: include our stdint.h, but this has no effect due to the
double-inclusion guard,
- end including the system's inttypes.h,
- end including our stdint.h.
> > The abort() is precisely to protect against such old implementations.
> > If we encounter an implementation where % on negative numbers works
> > not like C99 says, we have to deal not only in imaxdiv but also / and %.
> > I hope this will never be necessary, that's why I put the abort() there.
>
> OK, I see; perhaps that should be commented then. Maybe a comment like this?
>
> /* This code checks that / and % work on integers the way that C99 says
> (i.e., Fortran-like integer division). C89 does not specify
> whether ceiling or floor is taken for division when either operand is
> negative. We know of no practical C89 host that violates the C99
> rules; if this host is a counterexample, bad things can happen
> here and probably elsewhere in the program. Abort so that we are
> more likely to be informed of the porting-related bug. */
I'm adding a comment like this.
> One other nit:
>
> if (!(numer >= 0
> ? result.rem >= 0 && result.rem < (denom >= 0 ? denom : - denom)
> : result.rem <= 0 && result.rem > (denom >= 0 ? - denom : denom)))
>
> This has undefined behavior if denom == INTMAX_MIN. How about
> something like this instead?
>
> if (!(numer >= 0
> ? (result.rem >= 0
> && (denom >= 0 ? result.rem < denom : - result.rem > denom))
> : (result.rem <= 0
> && (denom >= 0 ? - result.rem < denom : result.rem > denom))))
I agree for the first half of the code. In the second half, the original
code with "- denom" is safer than your proposed code with "- result.rem" -
because here it could be result.rem which is == INTMAX_MIN. But thanks for
having noticed this; I don't usually view a unary minus as a dangerous
operation :-)
So here's the patch I'm committing.
2006-08-26 Bruno Haible <address@hidden>
* modules/inttypes (Files): Add lib/inttypes_.h, remove lib/inttypes.h.
Add m4/inttypes.m4, remove m4/_inttypes_h.m4 and m4/include_next.m4.
(Makefile.am): Create inttypes.h from inttypes_.h.
* lib/inttypes_.h: New file.
* lib/inttypes.h: Remove file.
* m4/inttypes.m4: New file.
* m4/_inttypes_h.m4: Remove file.
* m4/inttypes-pri.m4 (gt_INTTYPES_PRI): Also AC_SUBST PRI_MACROS_BROKEN.
* lib/stdint_.h: Include <inttypes.h> through its absolute filename.
* m4/stdint.m4 (gl_STDINT_H): Define also ABSOLUTE_INTTYPES_H.
* modules/stdint (Makefile.am): Substitute also ABSOLUTE_INTTYPES_H.
* modules/imaxabs: New file.
* lib/imaxabs.c: New file.
* m4/imaxabs.m4: New file.
* modules/imaxdiv: New file.
* lib/imaxdiv.c: New file.
* m4/imaxdiv.m4: New file.
*** gnulib-20060823/modules/inttypes 2006-08-22 14:50:25.000000000 +0200
--- gnulib-20060823-modified/modules/inttypes 2006-08-27 02:32:34.000000000
+0200
***************
*** 1,21 ****
Description:
! A wrapper C99 <inttypes.h> header which will always include <stdint.h>
! (possibly the *almost* C99 compliant GNULIB <stdint.h>) and prototypes for the
! strtoimax & strtoumax functions.
Files:
! lib/inttypes.h
! m4/include_next.m4
m4/absolute-header.m4
! m4/_inttypes_h.m4
Depends-on:
configure.ac:
gl_INTTYPES_H
Makefile.am:
! EXTRA_DIST += inttypes.h
Include:
#include <inttypes.h>
--- 1,37 ----
Description:
! An <inttypes.h> that nearly conforms to C99.
Files:
! lib/inttypes_.h
m4/absolute-header.m4
! m4/inttypes-pri.m4
! m4/inttypes.m4
Depends-on:
+ stdint
configure.ac:
gl_INTTYPES_H
Makefile.am:
! BUILT_SOURCES += $(INTTYPES_H)
! EXTRA_DIST += inttypes_.h
!
! # We need the following in order to create <inttypes.h> when the system
! # doesn't have one that works with the given compiler.
! inttypes.h: inttypes_.h
! sed -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
! -e 's/@''ABSOLUTE_INTTYPES_H''@/$(ABSOLUTE_INTTYPES_H)/g' \
! -e 's/@''PRI_MACROS_BROKEN''@/$(PRI_MACROS_BROKEN)/g' \
! -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \
! -e 's/@''PRIPTR_PREFIX''@/$(PRIPTR_PREFIX)/g' \
! -e 's/@''HAVE_DECL_IMAXABS''@/$(HAVE_DECL_IMAXABS)/g' \
! -e 's/@''HAVE_DECL_IMAXDIV''@/$(HAVE_DECL_IMAXDIV)/g' \
! -e 's/@''HAVE_DECL_STRTOIMAX''@/$(HAVE_DECL_STRTOIMAX)/g' \
! -e 's/@''HAVE_DECL_STRTOUMAX''@/$(HAVE_DECL_STRTOUMAX)/g' \
! < $(srcdir)/inttypes_.h > address@hidden
! mv address@hidden $@
! MOSTLYCLEANFILES += inttypes.h inttypes.h-t
Include:
#include <inttypes.h>
*** /dev/null 2003-09-23 19:59:22.000000000 +0200
--- gnulib-20060823-modified/lib/inttypes_.h 2006-08-27 02:40:44.000000000
+0200
***************
*** 0 ****
--- 1,1133 ----
+ /* Copyright (C) 2006 Free Software Foundation, Inc.
+ Written by Paul Eggert, Bruno Haible, Derek Price.
+ 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 Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ 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
+ #define INTTYPES_H
+
+ /*
+ * ISO C 99 <inttypes.h> for platforms that lack it.
+ * <http://www.opengroup.org/susv3xbd/inttypes.h.html>
+ */
+
+ /* Include the original <inttypes.h> if it exists. */
+ #if @HAVE_INTTYPES_H@
+ # include @ABSOLUTE_INTTYPES_H@
+ #endif
+ /* Include <stdint.h> or the gnulib replacement. */
+ #include <stdint.h>
+ /* Get CHAR_BIT. */
+ #include <limits.h>
+
+ #if !(INT_MIN == INT32_MIN && INT_MAX == INT32_MAX)
+ # error "This file assumes that 'int' has exactly 32 bits. Please report your
platform and compiler to <address@hidden>."
+ #endif
+
+ /* 7.8.1 Macros for format specifiers */
+
+ #if ! defined __cplusplus || defined __STDC_FORMAT_MACROS
+
+ # if !defined PRId8 || @PRI_MACROS_BROKEN@
+ # undef PRId8
+ # ifdef INT8_MAX
+ # define PRId8 "d"
+ # endif
+ # endif
+ # if !defined PRIi8 || @PRI_MACROS_BROKEN@
+ # undef PRIi8
+ # ifdef INT8_MAX
+ # define PRIi8 "i"
+ # endif
+ # endif
+ # if !defined PRIo8 || @PRI_MACROS_BROKEN@
+ # undef PRIo8
+ # ifdef UINT8_MAX
+ # define PRIo8 "o"
+ # endif
+ # endif
+ # if !defined PRIu8 || @PRI_MACROS_BROKEN@
+ # undef PRIu8
+ # ifdef UINT8_MAX
+ # define PRIu8 "u"
+ # endif
+ # endif
+ # if !defined PRIx8 || @PRI_MACROS_BROKEN@
+ # undef PRIx8
+ # ifdef UINT8_MAX
+ # define PRIx8 "x"
+ # endif
+ # endif
+ # if !defined PRIX8 || @PRI_MACROS_BROKEN@
+ # undef PRIX8
+ # ifdef UINT8_MAX
+ # define PRIX8 "X"
+ # endif
+ # endif
+ # if !defined PRId16 || @PRI_MACROS_BROKEN@
+ # undef PRId16
+ # ifdef INT16_MAX
+ # define PRId16 "d"
+ # endif
+ # endif
+ # if !defined PRIi16 || @PRI_MACROS_BROKEN@
+ # undef PRIi16
+ # ifdef INT16_MAX
+ # define PRIi16 "i"
+ # endif
+ # endif
+ # if !defined PRIo16 || @PRI_MACROS_BROKEN@
+ # undef PRIo16
+ # ifdef UINT16_MAX
+ # define PRIo16 "o"
+ # endif
+ # endif
+ # if !defined PRIu16 || @PRI_MACROS_BROKEN@
+ # undef PRIu16
+ # ifdef UINT16_MAX
+ # define PRIu16 "u"
+ # endif
+ # endif
+ # if !defined PRIx16 || @PRI_MACROS_BROKEN@
+ # undef PRIx16
+ # ifdef UINT16_MAX
+ # define PRIx16 "x"
+ # endif
+ # endif
+ # if !defined PRIX16 || @PRI_MACROS_BROKEN@
+ # undef PRIX16
+ # ifdef UINT16_MAX
+ # define PRIX16 "X"
+ # endif
+ # endif
+ # if !defined PRId32 || @PRI_MACROS_BROKEN@
+ # undef PRId32
+ # ifdef INT32_MAX
+ # define PRId32 "d"
+ # endif
+ # endif
+ # if !defined PRIi32 || @PRI_MACROS_BROKEN@
+ # undef PRIi32
+ # ifdef INT32_MAX
+ # define PRIi32 "i"
+ # endif
+ # endif
+ # if !defined PRIo32 || @PRI_MACROS_BROKEN@
+ # undef PRIo32
+ # ifdef UINT32_MAX
+ # define PRIo32 "o"
+ # endif
+ # endif
+ # if !defined PRIu32 || @PRI_MACROS_BROKEN@
+ # undef PRIu32
+ # ifdef UINT32_MAX
+ # define PRIu32 "u"
+ # endif
+ # endif
+ # if !defined PRIx32 || @PRI_MACROS_BROKEN@
+ # undef PRIx32
+ # ifdef UINT32_MAX
+ # define PRIx32 "x"
+ # endif
+ # endif
+ # if !defined PRIX32 || @PRI_MACROS_BROKEN@
+ # undef PRIX32
+ # ifdef UINT32_MAX
+ # define PRIX32 "X"
+ # endif
+ # endif
+ # ifdef INT64_MAX
+ # if INT64_MAX == LONG_MAX
+ # define _PRI64_PREFIX "l"
+ # elif defined _MSC_VER || defined __MINGW32__
+ # define _PRI64_PREFIX "I64"
+ # elif @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
+ # define _PRI64_PREFIX "ll"
+ # endif
+ # if !defined PRId64 || @PRI_MACROS_BROKEN@
+ # undef PRId64
+ # define PRId64 _PRI64_PREFIX "d"
+ # endif
+ # if !defined PRIi64 || @PRI_MACROS_BROKEN@
+ # undef PRIi64
+ # define PRIi64 _PRI64_PREFIX "i"
+ # endif
+ # endif
+ # ifdef UINT64_MAX
+ # if INT64_MAX == LONG_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"
+ # endif
+ # if !defined PRIo64 || @PRI_MACROS_BROKEN@
+ # undef PRIo64
+ # define PRIo64 _PRIu64_PREFIX "o"
+ # endif
+ # if !defined PRIu64 || @PRI_MACROS_BROKEN@
+ # undef PRIu64
+ # define PRIu64 _PRIu64_PREFIX "u"
+ # endif
+ # if !defined PRIx64 || @PRI_MACROS_BROKEN@
+ # undef PRIx64
+ # define PRIx64 _PRIu64_PREFIX "x"
+ # endif
+ # if !defined PRIX64 || @PRI_MACROS_BROKEN@
+ # undef PRIX64
+ # define PRIX64 _PRIu64_PREFIX "X"
+ # endif
+ # endif
+
+ # if !defined PRIdLEAST8 || @PRI_MACROS_BROKEN@
+ # undef PRIdLEAST8
+ # define PRIdLEAST8 "d"
+ # endif
+ # if !defined PRIiLEAST8 || @PRI_MACROS_BROKEN@
+ # undef PRIiLEAST8
+ # define PRIiLEAST8 "i"
+ # endif
+ # if !defined PRIoLEAST8 || @PRI_MACROS_BROKEN@
+ # undef PRIoLEAST8
+ # define PRIoLEAST8 "o"
+ # endif
+ # if !defined PRIuLEAST8 || @PRI_MACROS_BROKEN@
+ # undef PRIuLEAST8
+ # define PRIuLEAST8 "u"
+ # endif
+ # if !defined PRIxLEAST8 || @PRI_MACROS_BROKEN@
+ # undef PRIxLEAST8
+ # define PRIxLEAST8 "x"
+ # endif
+ # if !defined PRIXLEAST8 || @PRI_MACROS_BROKEN@
+ # undef PRIXLEAST8
+ # define PRIXLEAST8 "X"
+ # endif
+ # if !defined PRIdLEAST16 || @PRI_MACROS_BROKEN@
+ # undef PRIdLEAST16
+ # define PRIdLEAST16 "d"
+ # endif
+ # if !defined PRIiLEAST16 || @PRI_MACROS_BROKEN@
+ # undef PRIiLEAST16
+ # define PRIiLEAST16 "i"
+ # endif
+ # if !defined PRIoLEAST16 || @PRI_MACROS_BROKEN@
+ # undef PRIoLEAST16
+ # define PRIoLEAST16 "o"
+ # endif
+ # if !defined PRIuLEAST16 || @PRI_MACROS_BROKEN@
+ # undef PRIuLEAST16
+ # define PRIuLEAST16 "u"
+ # endif
+ # if !defined PRIxLEAST16 || @PRI_MACROS_BROKEN@
+ # undef PRIxLEAST16
+ # define PRIxLEAST16 "x"
+ # endif
+ # if !defined PRIXLEAST16 || @PRI_MACROS_BROKEN@
+ # undef PRIXLEAST16
+ # define PRIXLEAST16 "X"
+ # endif
+ # if !defined PRIdLEAST32 || @PRI_MACROS_BROKEN@
+ # undef PRIdLEAST32
+ # define PRIdLEAST32 "d"
+ # endif
+ # if !defined PRIiLEAST32 || @PRI_MACROS_BROKEN@
+ # undef PRIiLEAST32
+ # define PRIiLEAST32 "i"
+ # endif
+ # if !defined PRIoLEAST32 || @PRI_MACROS_BROKEN@
+ # undef PRIoLEAST32
+ # define PRIoLEAST32 "o"
+ # endif
+ # if !defined PRIuLEAST32 || @PRI_MACROS_BROKEN@
+ # undef PRIuLEAST32
+ # define PRIuLEAST32 "u"
+ # endif
+ # if !defined PRIxLEAST32 || @PRI_MACROS_BROKEN@
+ # undef PRIxLEAST32
+ # define PRIxLEAST32 "x"
+ # endif
+ # if !defined PRIXLEAST32 || @PRI_MACROS_BROKEN@
+ # undef PRIXLEAST32
+ # define PRIXLEAST32 "X"
+ # endif
+ # ifdef INT64_MAX
+ # if !defined PRIdLEAST64 || @PRI_MACROS_BROKEN@
+ # undef PRIdLEAST64
+ # define PRIdLEAST64 PRId64
+ # endif
+ # if !defined PRIiLEAST64 || @PRI_MACROS_BROKEN@
+ # undef PRIiLEAST64
+ # define PRIiLEAST64 PRIi64
+ # endif
+ # endif
+ # ifdef UINT64_MAX
+ # if !defined PRIoLEAST64 || @PRI_MACROS_BROKEN@
+ # undef PRIoLEAST64
+ # define PRIoLEAST64 PRIo64
+ # endif
+ # if !defined PRIuLEAST64 || @PRI_MACROS_BROKEN@
+ # undef PRIuLEAST64
+ # define PRIuLEAST64 PRIu64
+ # endif
+ # if !defined PRIxLEAST64 || @PRI_MACROS_BROKEN@
+ # undef PRIxLEAST64
+ # define PRIxLEAST64 PRIx64
+ # endif
+ # if !defined PRIXLEAST64 || @PRI_MACROS_BROKEN@
+ # undef PRIXLEAST64
+ # define PRIXLEAST64 PRIX64
+ # endif
+ # endif
+
+ # if !defined PRIdFAST8 || @PRI_MACROS_BROKEN@
+ # undef PRIdFAST8
+ # if INT_FAST8_MAX > INT32_MAX
+ # define PRIdFAST8 PRId64
+ # else
+ # define PRIdFAST8 "d"
+ # endif
+ # endif
+ # if !defined PRIiFAST8 || @PRI_MACROS_BROKEN@
+ # undef PRIiFAST8
+ # if INT_FAST8_MAX > INT32_MAX
+ # define PRIiFAST8 PRIi64
+ # else
+ # define PRIiFAST8 "i"
+ # endif
+ # endif
+ # if !defined PRIoFAST8 || @PRI_MACROS_BROKEN@
+ # undef PRIoFAST8
+ # if UINT_FAST8_MAX > UINT32_MAX
+ # define PRIoFAST8 PRIo64
+ # else
+ # define PRIoFAST8 "o"
+ # endif
+ # endif
+ # if !defined PRIuFAST8 || @PRI_MACROS_BROKEN@
+ # undef PRIuFAST8
+ # if UINT_FAST8_MAX > UINT32_MAX
+ # define PRIuFAST8 PRIu64
+ # else
+ # define PRIuFAST8 "u"
+ # endif
+ # endif
+ # if !defined PRIxFAST8 || @PRI_MACROS_BROKEN@
+ # undef PRIxFAST8
+ # if UINT_FAST8_MAX > UINT32_MAX
+ # define PRIxFAST8 PRIx64
+ # else
+ # define PRIxFAST8 "x"
+ # endif
+ # endif
+ # if !defined PRIXFAST8 || @PRI_MACROS_BROKEN@
+ # undef PRIXFAST8
+ # if UINT_FAST8_MAX > UINT32_MAX
+ # define PRIXFAST8 PRIX64
+ # else
+ # define PRIXFAST8 "X"
+ # endif
+ # endif
+ # if !defined PRIdFAST16 || @PRI_MACROS_BROKEN@
+ # undef PRIdFAST16
+ # if INT_FAST16_MAX > INT32_MAX
+ # define PRIdFAST16 PRId64
+ # else
+ # define PRIdFAST16 "d"
+ # endif
+ # endif
+ # if !defined PRIiFAST16 || @PRI_MACROS_BROKEN@
+ # undef PRIiFAST16
+ # if INT_FAST16_MAX > INT32_MAX
+ # define PRIiFAST16 PRIi64
+ # else
+ # define PRIiFAST16 "i"
+ # endif
+ # endif
+ # if !defined PRIoFAST16 || @PRI_MACROS_BROKEN@
+ # undef PRIoFAST16
+ # if UINT_FAST16_MAX > UINT32_MAX
+ # define PRIoFAST16 PRIo64
+ # else
+ # define PRIoFAST16 "o"
+ # endif
+ # endif
+ # if !defined PRIuFAST16 || @PRI_MACROS_BROKEN@
+ # undef PRIuFAST16
+ # if UINT_FAST16_MAX > UINT32_MAX
+ # define PRIuFAST16 PRIu64
+ # else
+ # define PRIuFAST16 "u"
+ # endif
+ # endif
+ # if !defined PRIxFAST16 || @PRI_MACROS_BROKEN@
+ # undef PRIxFAST16
+ # if UINT_FAST16_MAX > UINT32_MAX
+ # define PRIxFAST16 PRIx64
+ # else
+ # define PRIxFAST16 "x"
+ # endif
+ # endif
+ # if !defined PRIXFAST16 || @PRI_MACROS_BROKEN@
+ # undef PRIXFAST16
+ # if UINT_FAST16_MAX > UINT32_MAX
+ # define PRIXFAST16 PRIX64
+ # else
+ # define PRIXFAST16 "X"
+ # endif
+ # endif
+ # if !defined PRIdFAST32 || @PRI_MACROS_BROKEN@
+ # undef PRIdFAST32
+ # if INT_FAST32_MAX > INT32_MAX
+ # define PRIdFAST32 PRId64
+ # else
+ # define PRIdFAST32 "d"
+ # endif
+ # endif
+ # if !defined PRIiFAST32 || @PRI_MACROS_BROKEN@
+ # undef PRIiFAST32
+ # if INT_FAST32_MAX > INT32_MAX
+ # define PRIiFAST32 PRIi64
+ # else
+ # define PRIiFAST32 "i"
+ # endif
+ # endif
+ # if !defined PRIoFAST32 || @PRI_MACROS_BROKEN@
+ # undef PRIoFAST32
+ # if UINT_FAST32_MAX > UINT32_MAX
+ # define PRIoFAST32 PRIo64
+ # else
+ # define PRIoFAST32 "o"
+ # endif
+ # endif
+ # if !defined PRIuFAST32 || @PRI_MACROS_BROKEN@
+ # undef PRIuFAST32
+ # if UINT_FAST32_MAX > UINT32_MAX
+ # define PRIuFAST32 PRIu64
+ # else
+ # define PRIuFAST32 "u"
+ # endif
+ # endif
+ # if !defined PRIxFAST32 || @PRI_MACROS_BROKEN@
+ # undef PRIxFAST32
+ # if UINT_FAST32_MAX > UINT32_MAX
+ # define PRIxFAST32 PRIx64
+ # else
+ # define PRIxFAST32 "x"
+ # endif
+ # endif
+ # if !defined PRIXFAST32 || @PRI_MACROS_BROKEN@
+ # undef PRIXFAST32
+ # if UINT_FAST32_MAX > UINT32_MAX
+ # define PRIXFAST32 PRIX64
+ # else
+ # define PRIXFAST32 "X"
+ # endif
+ # endif
+ # ifdef INT64_MAX
+ # if !defined PRIdFAST64 || @PRI_MACROS_BROKEN@
+ # undef PRIdFAST64
+ # define PRIdFAST64 PRId64
+ # endif
+ # if !defined PRIiFAST64 || @PRI_MACROS_BROKEN@
+ # undef PRIiFAST64
+ # define PRIiFAST64 PRIi64
+ # endif
+ # endif
+ # ifdef UINT64_MAX
+ # if !defined PRIoFAST64 || @PRI_MACROS_BROKEN@
+ # undef PRIoFAST64
+ # define PRIoFAST64 PRIo64
+ # endif
+ # if !defined PRIuFAST64 || @PRI_MACROS_BROKEN@
+ # undef PRIuFAST64
+ # define PRIuFAST64 PRIu64
+ # endif
+ # if !defined PRIxFAST64 || @PRI_MACROS_BROKEN@
+ # undef PRIxFAST64
+ # define PRIxFAST64 PRIx64
+ # endif
+ # if !defined PRIXFAST64 || @PRI_MACROS_BROKEN@
+ # undef PRIXFAST64
+ # define PRIXFAST64 PRIX64
+ # endif
+ # endif
+
+ # if !defined PRIdMAX || @PRI_MACROS_BROKEN@
+ # undef PRIdMAX
+ # if INTMAX_MAX > INT32_MAX
+ # define PRIdMAX PRId64
+ # else
+ # define PRIdMAX "ld"
+ # endif
+ # endif
+ # if !defined PRIiMAX || @PRI_MACROS_BROKEN@
+ # undef PRIiMAX
+ # if INTMAX_MAX > INT32_MAX
+ # define PRIiMAX PRIi64
+ # else
+ # define PRIiMAX "li"
+ # endif
+ # endif
+ # if !defined PRIoMAX || @PRI_MACROS_BROKEN@
+ # undef PRIoMAX
+ # if UINTMAX_MAX > UINT32_MAX
+ # define PRIoMAX PRIo64
+ # else
+ # define PRIoMAX "lo"
+ # endif
+ # endif
+ # if !defined PRIuMAX || @PRI_MACROS_BROKEN@
+ # undef PRIuMAX
+ # if UINTMAX_MAX > UINT32_MAX
+ # define PRIuMAX PRIu64
+ # else
+ # define PRIuMAX "lu"
+ # endif
+ # endif
+ # if !defined PRIxMAX || @PRI_MACROS_BROKEN@
+ # undef PRIxMAX
+ # if UINTMAX_MAX > UINT32_MAX
+ # define PRIxMAX PRIx64
+ # else
+ # define PRIxMAX "lx"
+ # endif
+ # endif
+ # if !defined PRIXMAX || @PRI_MACROS_BROKEN@
+ # undef PRIXMAX
+ # if UINTMAX_MAX > UINT32_MAX
+ # define PRIXMAX PRIX64
+ # else
+ # define PRIXMAX "lX"
+ # endif
+ # endif
+
+ # if !defined PRIdPTR || @PRI_MACROS_BROKEN@
+ # undef PRIdPTR
+ # ifdef INTPTR_MAX
+ # define PRIdPTR @PRIPTR_PREFIX@ "d"
+ # endif
+ # endif
+ # if !defined PRIiPTR || @PRI_MACROS_BROKEN@
+ # undef PRIiPTR
+ # ifdef INTPTR_MAX
+ # define PRIiPTR @PRIPTR_PREFIX@ "i"
+ # endif
+ # endif
+ # if !defined PRIoPTR || @PRI_MACROS_BROKEN@
+ # undef PRIoPTR
+ # ifdef UINTPTR_MAX
+ # define PRIoPTR @PRIPTR_PREFIX@ "o"
+ # endif
+ # endif
+ # if !defined PRIuPTR || @PRI_MACROS_BROKEN@
+ # undef PRIuPTR
+ # ifdef UINTPTR_MAX
+ # define PRIuPTR @PRIPTR_PREFIX@ "u"
+ # endif
+ # endif
+ # if !defined PRIxPTR || @PRI_MACROS_BROKEN@
+ # undef PRIxPTR
+ # ifdef UINTPTR_MAX
+ # define PRIxPTR @PRIPTR_PREFIX@ "x"
+ # endif
+ # endif
+ # if !defined PRIXPTR || @PRI_MACROS_BROKEN@
+ # undef PRIXPTR
+ # ifdef UINTPTR_MAX
+ # define PRIXPTR @PRIPTR_PREFIX@ "X"
+ # endif
+ # endif
+
+ # if !defined SCNd8 || @PRI_MACROS_BROKEN@
+ # undef SCNd8
+ # ifdef INT8_MAX
+ # define SCNd8 "hhd"
+ # endif
+ # endif
+ # if !defined SCNi8 || @PRI_MACROS_BROKEN@
+ # undef SCNi8
+ # ifdef INT8_MAX
+ # define SCNi8 "hhi"
+ # endif
+ # endif
+ # if !defined SCNo8 || @PRI_MACROS_BROKEN@
+ # undef SCNo8
+ # ifdef UINT8_MAX
+ # define SCNo8 "hho"
+ # endif
+ # endif
+ # if !defined SCNu8 || @PRI_MACROS_BROKEN@
+ # undef SCNu8
+ # ifdef UINT8_MAX
+ # define SCNu8 "hhu"
+ # endif
+ # endif
+ # if !defined SCNx8 || @PRI_MACROS_BROKEN@
+ # undef SCNx8
+ # ifdef UINT8_MAX
+ # 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
+ # define SCNd16 "hd"
+ # endif
+ # endif
+ # if !defined SCNi16 || @PRI_MACROS_BROKEN@
+ # undef SCNi16
+ # ifdef INT16_MAX
+ # define SCNi16 "hi"
+ # endif
+ # endif
+ # if !defined SCNo16 || @PRI_MACROS_BROKEN@
+ # undef SCNo16
+ # ifdef UINT16_MAX
+ # define SCNo16 "ho"
+ # endif
+ # endif
+ # if !defined SCNu16 || @PRI_MACROS_BROKEN@
+ # undef SCNu16
+ # ifdef UINT16_MAX
+ # define SCNu16 "hu"
+ # endif
+ # endif
+ # if !defined SCNx16 || @PRI_MACROS_BROKEN@
+ # undef SCNx16
+ # ifdef UINT16_MAX
+ # 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
+ # define SCNd32 "d"
+ # endif
+ # endif
+ # if !defined SCNi32 || @PRI_MACROS_BROKEN@
+ # undef SCNi32
+ # ifdef INT32_MAX
+ # define SCNi32 "i"
+ # endif
+ # endif
+ # if !defined SCNo32 || @PRI_MACROS_BROKEN@
+ # undef SCNo32
+ # ifdef UINT32_MAX
+ # define SCNo32 "o"
+ # endif
+ # endif
+ # if !defined SCNu32 || @PRI_MACROS_BROKEN@
+ # undef SCNu32
+ # ifdef UINT32_MAX
+ # define SCNu32 "u"
+ # endif
+ # endif
+ # if !defined SCNx32 || @PRI_MACROS_BROKEN@
+ # undef SCNx32
+ # ifdef UINT32_MAX
+ # 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"
+ # endif
+ # if !defined SCNd64 || @PRI_MACROS_BROKEN@
+ # undef SCNd64
+ # define SCNd64 _SCN64_PREFIX "d"
+ # endif
+ # if !defined SCNi64 || @PRI_MACROS_BROKEN@
+ # undef SCNi64
+ # define SCNi64 _SCN64_PREFIX "i"
+ # endif
+ # endif
+ # ifdef UINT64_MAX
+ # if INT64_MAX == LONG_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"
+ # endif
+ # if !defined SCNo64 || @PRI_MACROS_BROKEN@
+ # undef SCNo64
+ # define SCNo64 _SCNu64_PREFIX "o"
+ # endif
+ # if !defined SCNu64 || @PRI_MACROS_BROKEN@
+ # undef SCNu64
+ # define SCNu64 _SCNu64_PREFIX "u"
+ # endif
+ # if !defined SCNx64 || @PRI_MACROS_BROKEN@
+ # 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@
+ # undef SCNdLEAST8
+ # define SCNdLEAST8 "hhd"
+ # endif
+ # if !defined SCNiLEAST8 || @PRI_MACROS_BROKEN@
+ # undef SCNiLEAST8
+ # define SCNiLEAST8 "hhi"
+ # endif
+ # if !defined SCNoLEAST8 || @PRI_MACROS_BROKEN@
+ # undef SCNoLEAST8
+ # define SCNoLEAST8 "hho"
+ # endif
+ # if !defined SCNuLEAST8 || @PRI_MACROS_BROKEN@
+ # undef SCNuLEAST8
+ # define SCNuLEAST8 "hhu"
+ # endif
+ # if !defined SCNxLEAST8 || @PRI_MACROS_BROKEN@
+ # 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"
+ # endif
+ # if !defined SCNiLEAST16 || @PRI_MACROS_BROKEN@
+ # undef SCNiLEAST16
+ # define SCNiLEAST16 "hi"
+ # endif
+ # if !defined SCNoLEAST16 || @PRI_MACROS_BROKEN@
+ # undef SCNoLEAST16
+ # define SCNoLEAST16 "ho"
+ # endif
+ # if !defined SCNuLEAST16 || @PRI_MACROS_BROKEN@
+ # undef SCNuLEAST16
+ # define SCNuLEAST16 "hu"
+ # endif
+ # if !defined SCNxLEAST16 || @PRI_MACROS_BROKEN@
+ # 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"
+ # endif
+ # if !defined SCNiLEAST32 || @PRI_MACROS_BROKEN@
+ # undef SCNiLEAST32
+ # define SCNiLEAST32 "i"
+ # endif
+ # if !defined SCNoLEAST32 || @PRI_MACROS_BROKEN@
+ # undef SCNoLEAST32
+ # define SCNoLEAST32 "o"
+ # endif
+ # if !defined SCNuLEAST32 || @PRI_MACROS_BROKEN@
+ # undef SCNuLEAST32
+ # define SCNuLEAST32 "u"
+ # endif
+ # if !defined SCNxLEAST32 || @PRI_MACROS_BROKEN@
+ # 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
+ # define SCNdLEAST64 SCNd64
+ # endif
+ # if !defined SCNiLEAST64 || @PRI_MACROS_BROKEN@
+ # undef SCNiLEAST64
+ # define SCNiLEAST64 SCNi64
+ # endif
+ # endif
+ # ifdef UINT64_MAX
+ # if !defined SCNoLEAST64 || @PRI_MACROS_BROKEN@
+ # undef SCNoLEAST64
+ # define SCNoLEAST64 SCNo64
+ # endif
+ # if !defined SCNuLEAST64 || @PRI_MACROS_BROKEN@
+ # undef SCNuLEAST64
+ # define SCNuLEAST64 SCNu64
+ # endif
+ # if !defined SCNxLEAST64 || @PRI_MACROS_BROKEN@
+ # 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@
+ # undef SCNdFAST8
+ # if INT_FAST8_MAX > INT32_MAX
+ # define SCNdFAST8 SCNd64
+ # elif INT_FAST8_MAX == 0x7fff
+ # define SCNdFAST8 "hd"
+ # elif INT_FAST8_MAX == 0x7f
+ # define SCNdFAST8 "hhd"
+ # else
+ # define SCNdFAST8 "d"
+ # endif
+ # endif
+ # if !defined SCNiFAST8 || @PRI_MACROS_BROKEN@
+ # undef SCNiFAST8
+ # if INT_FAST8_MAX > INT32_MAX
+ # define SCNiFAST8 SCNi64
+ # elif INT_FAST8_MAX == 0x7fff
+ # define SCNiFAST8 "hi"
+ # elif INT_FAST8_MAX == 0x7f
+ # define SCNiFAST8 "hhi"
+ # else
+ # define SCNiFAST8 "i"
+ # endif
+ # endif
+ # if !defined SCNoFAST8 || @PRI_MACROS_BROKEN@
+ # undef SCNoFAST8
+ # if UINT_FAST8_MAX > UINT32_MAX
+ # define SCNoFAST8 SCNo64
+ # elif UINT_FAST8_MAX == 0xffff
+ # define SCNoFAST8 "ho"
+ # elif UINT_FAST8_MAX == 0xff
+ # define SCNoFAST8 "hho"
+ # else
+ # define SCNoFAST8 "o"
+ # endif
+ # endif
+ # if !defined SCNuFAST8 || @PRI_MACROS_BROKEN@
+ # undef SCNuFAST8
+ # if UINT_FAST8_MAX > UINT32_MAX
+ # define SCNuFAST8 SCNu64
+ # elif UINT_FAST8_MAX == 0xffff
+ # define SCNuFAST8 "hu"
+ # elif UINT_FAST8_MAX == 0xff
+ # define SCNuFAST8 "hhu"
+ # else
+ # define SCNuFAST8 "u"
+ # 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 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
+ # define SCNdFAST16 SCNd64
+ # elif INT_FAST16_MAX == 0x7fff
+ # define SCNdFAST16 "hd"
+ # else
+ # define SCNdFAST16 "d"
+ # endif
+ # endif
+ # if !defined SCNiFAST16 || @PRI_MACROS_BROKEN@
+ # undef SCNiFAST16
+ # if INT_FAST16_MAX > INT32_MAX
+ # define SCNiFAST16 SCNi64
+ # elif INT_FAST16_MAX == 0x7fff
+ # define SCNiFAST16 "hi"
+ # else
+ # define SCNiFAST16 "i"
+ # endif
+ # endif
+ # if !defined SCNoFAST16 || @PRI_MACROS_BROKEN@
+ # undef SCNoFAST16
+ # if UINT_FAST16_MAX > UINT32_MAX
+ # define SCNoFAST16 SCNo64
+ # elif UINT_FAST16_MAX == 0xffff
+ # define SCNoFAST16 "ho"
+ # else
+ # define SCNoFAST16 "o"
+ # endif
+ # endif
+ # if !defined SCNuFAST16 || @PRI_MACROS_BROKEN@
+ # undef SCNuFAST16
+ # if UINT_FAST16_MAX > UINT32_MAX
+ # define SCNuFAST16 SCNu64
+ # elif UINT_FAST16_MAX == 0xffff
+ # define SCNuFAST16 "hu"
+ # else
+ # define SCNuFAST16 "u"
+ # 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 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
+ # define SCNdFAST32 SCNd64
+ # else
+ # define SCNdFAST32 "d"
+ # endif
+ # endif
+ # if !defined SCNiFAST32 || @PRI_MACROS_BROKEN@
+ # undef SCNiFAST32
+ # if INT_FAST32_MAX > INT32_MAX
+ # define SCNiFAST32 SCNi64
+ # else
+ # define SCNiFAST32 "i"
+ # endif
+ # endif
+ # if !defined SCNoFAST32 || @PRI_MACROS_BROKEN@
+ # undef SCNoFAST32
+ # if UINT_FAST32_MAX > UINT32_MAX
+ # define SCNoFAST32 SCNo64
+ # else
+ # define SCNoFAST32 "o"
+ # endif
+ # endif
+ # if !defined SCNuFAST32 || @PRI_MACROS_BROKEN@
+ # undef SCNuFAST32
+ # if UINT_FAST32_MAX > UINT32_MAX
+ # define SCNuFAST32 SCNu64
+ # else
+ # define SCNuFAST32 "u"
+ # 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
+ # 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
+ # define SCNdFAST64 SCNd64
+ # endif
+ # if !defined SCNiFAST64 || @PRI_MACROS_BROKEN@
+ # undef SCNiFAST64
+ # define SCNiFAST64 SCNi64
+ # endif
+ # endif
+ # ifdef UINT64_MAX
+ # if !defined SCNoFAST64 || @PRI_MACROS_BROKEN@
+ # undef SCNoFAST64
+ # define SCNoFAST64 SCNo64
+ # endif
+ # if !defined SCNuFAST64 || @PRI_MACROS_BROKEN@
+ # undef SCNuFAST64
+ # define SCNuFAST64 SCNu64
+ # endif
+ # if !defined SCNxFAST64 || @PRI_MACROS_BROKEN@
+ # 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@
+ # undef SCNdMAX
+ # if INTMAX_MAX > INT32_MAX
+ # define SCNdMAX SCNd64
+ # else
+ # define SCNdMAX "ld"
+ # endif
+ # endif
+ # if !defined SCNiMAX || @PRI_MACROS_BROKEN@
+ # undef SCNiMAX
+ # if INTMAX_MAX > INT32_MAX
+ # define SCNiMAX SCNi64
+ # else
+ # define SCNiMAX "li"
+ # endif
+ # endif
+ # if !defined SCNoMAX || @PRI_MACROS_BROKEN@
+ # undef SCNoMAX
+ # if UINTMAX_MAX > UINT32_MAX
+ # define SCNoMAX SCNo64
+ # else
+ # define SCNoMAX "lo"
+ # endif
+ # endif
+ # if !defined SCNuMAX || @PRI_MACROS_BROKEN@
+ # undef SCNuMAX
+ # if UINTMAX_MAX > UINT32_MAX
+ # define SCNuMAX SCNu64
+ # else
+ # define SCNuMAX "lu"
+ # 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 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
+ # ifdef INTPTR_MAX
+ # define SCNdPTR @PRIPTR_PREFIX@ "d"
+ # endif
+ # endif
+ # if !defined SCNiPTR || @PRI_MACROS_BROKEN@
+ # undef SCNiPTR
+ # ifdef INTPTR_MAX
+ # define SCNiPTR @PRIPTR_PREFIX@ "i"
+ # endif
+ # endif
+ # if !defined SCNoPTR || @PRI_MACROS_BROKEN@
+ # undef SCNoPTR
+ # ifdef UINTPTR_MAX
+ # define SCNoPTR @PRIPTR_PREFIX@ "o"
+ # endif
+ # endif
+ # if !defined SCNuPTR || @PRI_MACROS_BROKEN@
+ # undef SCNuPTR
+ # ifdef UINTPTR_MAX
+ # define SCNuPTR @PRIPTR_PREFIX@ "u"
+ # endif
+ # endif
+ # if !defined SCNxPTR || @PRI_MACROS_BROKEN@
+ # undef SCNxPTR
+ # ifdef UINTPTR_MAX
+ # 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
+
+ /* 7.8.2 Functions for greatest-width integer types */
+
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+
+ #if address@hidden@
+ extern intmax_t imaxabs (intmax_t);
+ #endif
+
+ #if address@hidden@
+ typedef struct { intmax_t quot; intmax_t rem; } imaxdiv_t;
+ extern imaxdiv_t imaxdiv (intmax_t, intmax_t);
+ #endif
+
+ #if address@hidden@
+ extern intmax_t strtoimax (const char *, char **, int);
+ #endif
+ #if address@hidden@
+ extern uintmax_t strtoumax (const char *, char **, int);
+ #endif
+
+ /* Don't bother defining or declaring wcstoimax and wcstoumax, since
+ wide-character functions like this are hardly ever useful. */
+
+ #ifdef __cplusplus
+ }
+ #endif
+
+ #endif /* INTTYPES_H */
*** /dev/null 2003-09-23 19:59:22.000000000 +0200
--- gnulib-20060823-modified/m4/inttypes.m4 2006-07-27 03:12:58.000000000
+0200
***************
*** 0 ****
--- 1,192 ----
+ # inttypes.m4 serial 2
+ dnl Copyright (C) 2006 Free Software Foundation, Inc.
+ dnl This file is free software; the Free Software Foundation
+ dnl gives unlimited permission to copy and/or distribute it,
+ dnl with or without modifications, as long as this notice is preserved.
+
+ dnl From Derek Price, Bruno Haible.
+ dnl Test whether <inttypes.h> is supported or must be substituted.
+
+ AC_DEFUN([gl_INTTYPES_H],
+ [
+ AC_REQUIRE([gl_STDINT_H])
+ AC_REQUIRE([gt_INTTYPES_PRI])
+ AC_CHECK_DECLS_ONCE([imaxabs])
+ AC_CHECK_DECLS_ONCE([imaxdiv])
+ AC_CHECK_DECLS_ONCE([strtoimax])
+ AC_CHECK_DECLS_ONCE([strtoumax])
+
+ dnl Now see if we need a substitute <inttypes.h>.
+ dnl A complete <inttypes.h> requires
+ dnl - a complete <stdint.h>,
+ dnl - the existence of an <inttypes.h>,
+ dnl - that imaxabs, imaxdiv, strtoimax, strtoumax are declared,
+ dnl - some additional tests.
+ gl_cv_header_working_inttypes_h=no
+ if test $gl_cv_header_working_stdint_h = yes \
+ && test $gl_cv_header_inttypes_h = yes \
+ && test "$ac_cv_have_decl_imaxabs" = yes \
+ && test "$ac_cv_have_decl_imaxdiv" = yes \
+ && test "$ac_cv_have_decl_strtoimax" = yes \
+ && test "$ac_cv_have_decl_strtoumax" = yes; then
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([
+ #include <stddef.h>
+ #define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
+ #define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */
+ #define __STDC_FORMAT_MACROS 1 /* to make it work also in C++ mode */
+ #include ABSOLUTE_INTTYPES_H
+
+ /* No need to duplicate the tests of stdint.m4; they are subsumed by
+ $gl_cv_header_working_stdint_h = yes. */
+
+ /* Tests for macros supposed to be defined in inttypes.h. */
+
+ const char *k = /* implicit string concatenation */
+ #ifdef INT8_MAX
+ PRId8 PRIi8
+ #endif
+ #ifdef UINT8_MAX
+ PRIo8 PRIu8 PRIx8 PRIX8
+ #endif
+ #ifdef INT16_MAX
+ PRId16 PRIi16
+ #endif
+ #ifdef UINT16_MAX
+ PRIo16 PRIu16 PRIx16 PRIX16
+ #endif
+ #ifdef INT32_MAX
+ PRId32 PRIi32
+ #endif
+ #ifdef UINT32_MAX
+ PRIo32 PRIu32 PRIx32 PRIX32
+ #ifdef INT64_MAX
+ PRId64 PRIi64
+ #endif
+ #ifdef UINT64_MAX
+ PRIo64 PRIu64 PRIx64 PRIX64
+ #endif
+ PRIdLEAST8 PRIiLEAST8 PRIoLEAST8 PRIuLEAST8 PRIxLEAST8 PRIXLEAST8
+ PRIdLEAST16 PRIiLEAST16 PRIoLEAST16 PRIuLEAST16 PRIxLEAST16 PRIXLEAST16
+ PRIdLEAST32 PRIiLEAST32 PRIoLEAST32 PRIuLEAST32 PRIxLEAST32 PRIXLEAST32
+ PRIdLEAST64 PRIiLEAST64
+ PRIoLEAST64 PRIuLEAST64 PRIxLEAST64 PRIXLEAST64
+ PRIdFAST8 PRIiFAST8 PRIoFAST8 PRIuFAST8 PRIxFAST8 PRIXFAST8
+ PRIdFAST16 PRIiFAST16 PRIoFAST16 PRIuFAST16 PRIxFAST16 PRIXFAST16
+ PRIdFAST32 PRIiFAST32 PRIoFAST32 PRIuFAST32 PRIxFAST32 PRIXFAST32
+ PRIdFAST64 PRIiFAST64
+ PRIoFAST64 PRIuFAST64 PRIxFAST64 PRIXFAST64
+ PRIdMAX PRIiMAX PRIoMAX PRIuMAX PRIxMAX PRIXMAX
+ #ifdef INTPTR_MAX
+ PRIdPTR PRIiPTR
+ #endif
+ #ifdef UINTPTR_MAX
+ PRIoPTR PRIuPTR PRIxPTR PRIXPTR
+ #endif
+ ;
+ const char *l = /* implicit string concatenation */
+ #ifdef INT8_MAX
+ SCNd8 SCNi8
+ #endif
+ #ifdef UINT8_MAX
+ SCNo8 SCNu8 SCNx8 SCNX8
+ #endif
+ #ifdef INT16_MAX
+ SCNd16 SCNi16
+ #endif
+ #ifdef UINT16_MAX
+ SCNo16 SCNu16 SCNx16 SCNX16
+ #endif
+ #ifdef INT32_MAX
+ SCNd32 SCNi32
+ #endif
+ #ifdef UINT32_MAX
+ SCNo32 SCNu32 SCNx32 SCNX32
+ #endif
+ #ifdef INT64_MAX
+ SCNd64 SCNi64
+ #endif
+ #ifdef UINT64_MAX
+ SCNo64 SCNu64 SCNx64 SCNX64
+ #endif
+ SCNdLEAST8 SCNiLEAST8 SCNoLEAST8 SCNuLEAST8 SCNxLEAST8 SCNXLEAST8
+ SCNdLEAST16 SCNiLEAST16 SCNoLEAST16 SCNuLEAST16 SCNxLEAST16 SCNXLEAST16
+ SCNdLEAST32 SCNiLEAST32 SCNoLEAST32 SCNuLEAST32 SCNxLEAST32 SCNXLEAST32
+ SCNdLEAST64 SCNiLEAST64
+ SCNoLEAST64 SCNuLEAST64 SCNxLEAST64 SCNXLEAST64
+ SCNdFAST8 SCNiFAST8 SCNoFAST8 SCNuFAST8 SCNxFAST8 SCNXFAST8
+ SCNdFAST16 SCNiFAST16 SCNoFAST16 SCNuFAST16 SCNxFAST16 SCNXFAST16
+ SCNdFAST32 SCNiFAST32 SCNoFAST32 SCNuFAST32 SCNxFAST32 SCNXFAST32
+ SCNdFAST64 SCNiFAST64
+ SCNoFAST64 SCNuFAST64 SCNxFAST64 SCNXFAST64
+ SCNdMAX SCNiMAX SCNoMAX SCNuMAX SCNxMAX SCNXMAX
+ #ifdef INTPTR_MAX
+ SCNdPTR SCNiPTR
+ #endif
+ #ifdef UINTPTR_MAX
+ SCNoPTR SCNuPTR SCNxPTR SCNXPTR
+ #endif
+ ;
+ ])],
+ [gl_cv_header_working_inttypes_h=yes])
+ fi
+ if test $gl_cv_header_working_inttypes_h = yes; then
+ dnl Use the existing <inttypes.h>.
+ INTTYPES_H=''
+ else
+
+ PRIPTR_PREFIX=
+ if test -n "$STDINT_H"; then
+ dnl Using the gnulib <stdint.h>. It always defines intptr_t to 'long'.
+ PRIPTR_PREFIX='"l"'
+ else
+ dnl Using the system's <stdint.h>.
+ for glpfx in '' l ll I64; do
+ case $glpfx in
+ '') gltype1='int';;
+ l) gltype1='long int';;
+ ll) gltype1='long long int';;
+ I64) gltype1='__int64';;
+ esac
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([#include <stdint.h>
+ extern intptr_t foo;
+ extern $gltype1 foo;])],
+ [PRIPTR_PREFIX='"'$glpfx'"'])
+ test -n "$PRIPTR_PREFIX" && break
+ done
+ fi
+ AC_SUBST([PRIPTR_PREFIX])
+
+ if test "$ac_cv_have_decl_imaxabs" = yes; then
+ HAVE_DECL_IMAXABS=1
+ else
+ HAVE_DECL_IMAXABS=0
+ fi
+ AC_SUBST([HAVE_DECL_IMAXABS])
+
+ if test "$ac_cv_have_decl_imaxdiv" = yes; then
+ HAVE_DECL_IMAXDIV=1
+ else
+ HAVE_DECL_IMAXDIV=0
+ fi
+ AC_SUBST([HAVE_DECL_IMAXDIV])
+
+ if test "$ac_cv_have_decl_strtoimax" = yes; then
+ HAVE_DECL_STRTOIMAX=1
+ else
+ HAVE_DECL_STRTOIMAX=0
+ fi
+ AC_SUBST([HAVE_DECL_STRTOIMAX])
+
+ if test "$ac_cv_have_decl_strtoumax" = yes; then
+ HAVE_DECL_STRTOUMAX=1
+ else
+ HAVE_DECL_STRTOUMAX=0
+ fi
+ AC_SUBST([HAVE_DECL_STRTOUMAX])
+
+ INTTYPES_H='inttypes.h'
+ fi
+ AC_SUBST(INTTYPES_H)
+ ])
*** gnulib-20060823/m4/inttypes-pri.m4 2006-06-09 22:31:47.000000000 +0200
--- gnulib-20060823-modified/m4/inttypes-pri.m4 2006-08-27 02:31:46.000000000
+0200
***************
*** 1,4 ****
! # inttypes-pri.m4 serial 2 (gettext-0.15)
dnl Copyright (C) 1997-2002, 2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
--- 1,4 ----
! # inttypes-pri.m4 serial 3 (gettext-0.15.1)
dnl Copyright (C) 1997-2002, 2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
***************
*** 26,30 ****
--- 26,34 ----
if test "$gt_cv_inttypes_pri_broken" = yes; then
AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1,
[Define if <inttypes.h> exists and defines unusable PRI* macros.])
+ PRI_MACROS_BROKEN=1
+ else
+ PRI_MACROS_BROKEN=0
fi
+ AC_SUBST([PRI_MACROS_BROKEN])
])
*** gnulib-20060823/lib/stdint_.h 2006-07-27 14:46:02.000000000 +0200
--- gnulib-20060823-modified/lib/stdint_.h 2006-07-27 14:52:03.000000000
+0200
***************
*** 62,68 ****
/* 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. */
! # include <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.
*/
--- 62,68 ----
/* 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. */
! # 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.
*/
*** gnulib-20060823/m4/stdint.m4 2006-07-27 14:47:48.000000000 +0200
--- gnulib-20060823-modified/m4/stdint.m4 2006-07-27 14:52:43.000000000
+0200
***************
*** 1,4 ****
! # stdint.m4 serial 18
dnl Copyright (C) 2001-2002, 2004-2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
--- 1,4 ----
! # stdint.m4 serial 19
dnl Copyright (C) 2001-2002, 2004-2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
***************
*** 32,41 ****
--- 32,45 ----
dnl Check for <inttypes.h>.
dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_inttypes_h.
if test $ac_cv_header_inttypes_h = yes; then
+ gl_ABSOLUTE_HEADER([inttypes.h])
+ ABSOLUTE_INTTYPES_H=\"$gl_cv_absolute_inttypes_h\"
HAVE_INTTYPES_H=1
else
+ ABSOLUTE_INTTYPES_H=\"no/such/file/inttypes.h\"
HAVE_INTTYPES_H=0
fi
+ AC_SUBST([ABSOLUTE_INTTYPES_H])
AC_SUBST([HAVE_INTTYPES_H])
dnl Check for <sys/types.h>.
*** gnulib-20060823/modules/stdint 2006-07-27 14:45:46.000000000 +0200
--- gnulib-20060823-modified/modules/stdint 2006-07-27 14:29:00.000000000
+0200
***************
*** 26,34 ****
stdint.h: stdint_.h
sed -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \
-e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
- -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \
-e 's|@''ABSOLUTE_STDINT_H''@|$(ABSOLUTE_STDINT_H)|g' \
-e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
-e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \
-e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \
-e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \
--- 26,35 ----
stdint.h: stdint_.h
sed -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \
-e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
-e 's|@''ABSOLUTE_STDINT_H''@|$(ABSOLUTE_STDINT_H)|g' \
+ -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \
-e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
+ -e 's|@''ABSOLUTE_INTTYPES_H''@|$(ABSOLUTE_INTTYPES_H)|g' \
-e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \
-e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \
-e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \
*** /dev/null 2003-09-23 19:59:22.000000000 +0200
--- gnulib-20060823-modified/modules/imaxabs 2006-07-27 14:29:00.000000000
+0200
***************
*** 0 ****
--- 1,23 ----
+ Description:
+ imaxabs() function: absolute value of 'intmax_t'.
+
+ Files:
+ lib/imaxabs.c
+ m4/imaxabs.m4
+
+ Depends-on:
+ inttypes
+
+ configure.ac:
+ gl_FUNC_IMAXABS
+
+ Makefile.am:
+
+ Include:
+ <inttypes.h>
+
+ License:
+ LGPL
+
+ Maintainer:
+ Bruno Haible
*** /dev/null 2003-09-23 19:59:22.000000000 +0200
--- gnulib-20060823-modified/lib/imaxabs.c 2006-07-27 14:29:00.000000000
+0200
***************
*** 0 ****
--- 1,29 ----
+ /* imaxabs() function: absolute value of 'intmax_t'.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+ 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)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+ #ifdef HAVE_CONFIG_H
+ # include <config.h>
+ #endif
+
+ /* Specification. */
+ #include <inttypes.h>
+
+ intmax_t
+ imaxabs (intmax_t x)
+ {
+ return (x >= 0 ? x : - x);
+ }
*** /dev/null 2003-09-23 19:59:22.000000000 +0200
--- gnulib-20060823-modified/m4/imaxabs.m4 2006-07-27 14:29:00.000000000
+0200
***************
*** 0 ****
--- 1,17 ----
+ # imaxabs.m4 serial 1
+ dnl Copyright (C) 2006 Free Software Foundation, Inc.
+ dnl This file is free software; the Free Software Foundation
+ dnl gives unlimited permission to copy and/or distribute it,
+ dnl with or without modifications, as long as this notice is preserved.
+
+ AC_DEFUN([gl_FUNC_IMAXABS],
+ [
+ AC_REQUIRE([gl_INTTYPES_H])
+ if test "$ac_cv_have_decl_imaxabs" != yes; then
+ AC_LIBOBJ([imaxabs])
+ gl_PREREQ_IMAXABS
+ fi
+ ])
+
+ # Prerequisites of lib/imaxabs.c.
+ AC_DEFUN([gl_PREREQ_IMAXABS], [:])
*** /dev/null 2003-09-23 19:59:22.000000000 +0200
--- gnulib-20060823-modified/modules/imaxdiv 2006-07-27 14:29:00.000000000
+0200
***************
*** 0 ****
--- 1,23 ----
+ Description:
+ imaxdiv() function: division of 'intmax_t'.
+
+ Files:
+ lib/imaxdiv.c
+ m4/imaxdiv.m4
+
+ Depends-on:
+ inttypes
+
+ configure.ac:
+ gl_FUNC_IMAXDIV
+
+ Makefile.am:
+
+ Include:
+ <inttypes.h>
+
+ License:
+ LGPL
+
+ Maintainer:
+ Bruno Haible
*** /dev/null 2003-09-23 19:59:22.000000000 +0200
--- gnulib-20060823-modified/lib/imaxdiv.c 2006-08-27 03:11:10.000000000
+0200
***************
*** 0 ****
--- 1,66 ----
+ /* imaxdiv() function: division of 'intmax_t'.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+ 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)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+ #ifdef HAVE_CONFIG_H
+ # include <config.h>
+ #endif
+
+ /* Specification. */
+ #include <inttypes.h>
+
+ #include <stdlib.h>
+
+ imaxdiv_t
+ imaxdiv (intmax_t numer, intmax_t denom)
+ {
+ imaxdiv_t result;
+
+ result.quot = numer / denom;
+ result.rem = numer % denom;
+
+ /* Verify the requirements of ISO C 99 section 6.5.5 paragraph 6:
+ "When integers are divided, the result of the / operator is the
+ algebraic quotient with any fractional part discarded. (This is
+ often called "truncation toward zero".) If the quotient a/b is
+ representable, the expression (a/b)*b + a%b shall equal a." */
+ if (!(denom == 0
+ || (INTMAX_MIN + INTMAX_MAX < 0
+ && denom == -1
+ && numer < - INTMAX_MAX)))
+ {
+ if (!(result.quot * denom + result.rem == numer))
+ /* The compiler's implementation of / and % is broken. */
+ abort ();
+ if (!(numer >= 0
+ ? result.rem >= 0
+ && (denom >= 0
+ ? result.rem < denom
+ : /* Don't write result.rem < - denom,
+ as it gives integer overflow if denom == INTMAX_MIN. */
+ - result.rem > denom)
+ : result.rem <= 0
+ && (denom >= 0
+ ? result.rem > - denom
+ : result.rem > denom)))
+ /* The compiler's implementation of / and % may be ok according to
+ C89, but not to C99. Please report this to <address@hidden>.
+ This might be a big portability problem. */
+ abort ();
+ }
+
+ return result;
+ }
*** /dev/null 2003-09-23 19:59:22.000000000 +0200
--- gnulib-20060823-modified/m4/imaxdiv.m4 2006-07-27 14:29:00.000000000
+0200
***************
*** 0 ****
--- 1,17 ----
+ # imaxdiv.m4 serial 1
+ dnl Copyright (C) 2006 Free Software Foundation, Inc.
+ dnl This file is free software; the Free Software Foundation
+ dnl gives unlimited permission to copy and/or distribute it,
+ dnl with or without modifications, as long as this notice is preserved.
+
+ AC_DEFUN([gl_FUNC_IMAXDIV],
+ [
+ AC_REQUIRE([gl_INTTYPES_H])
+ if test "$ac_cv_have_decl_imaxdiv" != yes; then
+ AC_LIBOBJ([imaxdiv])
+ gl_PREREQ_IMAXDIV
+ fi
+ ])
+
+ # Prerequisites of lib/imaxdiv.c.
+ AC_DEFUN([gl_PREREQ_IMAXDIV], [:])