bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/2] stdint: support new _WIDTH macros


From: Jim Meyering
Subject: Re: [PATCH 2/2] stdint: support new _WIDTH macros
Date: Thu, 22 Sep 2016 09:22:33 -0700

On Thu, Sep 15, 2016 at 3:45 PM, Paul Eggert <address@hidden> wrote:
> * doc/posix-headers/stdint.texi: Document this.
> * lib/stdint.in.h: Add support for INTMAX_WIDTH. etc.
> * m4/stdint.m4 (gl_STDINT_H): Require gl_LIMITS_H.  Check for
> support for INTMAX_WIDTH, etc. as well as for support for just C99.
> * modules/stdint (Depends-on): Add limits-h.
> (Makefile.am): Substitute HAVE_C99_STDINT_H.
> * modules/stdint-tests (Depends-on): Add extensions, so that
> INTMAX_MAX etc. are defined.
> * tests/test-stdint.c: Verify the new macros.
> ---
>  ChangeLog                     |  11 +
>  doc/posix-headers/stdint.texi |   3 +
>  lib/stdint.in.h               | 747 
> +++++++++++++++++++++++-------------------
>  m4/stdint.m4                  |  48 ++-
>  modules/stdint                |   5 +-
>  modules/stdint-tests          |   1 +
>  tests/test-stdint.c           |  58 ++++
>  7 files changed, 514 insertions(+), 359 deletions(-)

Nice change.
However, on a system like Fedora24 for which stdint.h is built, yet
not limits.h, there is a problem.
stdint.h uses _GL_INTEGER_WIDTH, and gnulib's limits.h defines it.
Hence, any time we use certain features of stdint.h, we must currently
also be sure to build gnulib-derived limits.h for that definition.
Otherwise, the following fails:

  ./gnulib-tool --create-testdir --dir=/tmp/x --with-tests --test stdint

with many errors like these:

In file included from ../../gltests/test-stdint.c:26:0:
../../gltests/test-stdint.c:357:48: error: expression in static
assertion is not constant
   verify ((max) >> ((width) - 1 - ((min) < 0)) == 1)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
../../gltests/../gllib/verify.h:251:31: note: in definition of macro ‘verify’
 #define verify(R) _GL_VERIFY (R, "verify (" #R ")")
                               ^
../../gltests/test-stdint.c:360:1: note: in expansion of macro ‘verify_width’
 verify_width (INT8_WIDTH, INT8_MIN, INT8_MAX);
 ^~~~~~~~~~~~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]