From 996cae1ddb5eb56222a4f7018aad1e1dc201b8c9 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Oct 2019 12:48:54 -0700 Subject: inttypes: use more-robust test for int range This fixes Bison 3.4.2 when built with Oracle Solaris Studio 12.3. Problem reported by Dagobert Michelsen in: https://lists.gnu.org/r/bug-gnulib/2019-10/msg00042.html * lib/inttypes.in.h: Rely only on limits.h when checking int range. --- ChangeLog | 9 +++++++++ lib/inttypes.in.h | 6 +++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2c63d42b6f..cd62812712 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2019-10-15 Paul Eggert + + inttypes: use more-robust test for int range + This fixes Bison 3.4.2 when built with Oracle Solaris Studio 12.3. + Problem reported by Dagobert Michelsen in: + https://lists.gnu.org/r/bug-gnulib/2019-10/msg00042.html + * lib/inttypes.in.h: Rely only on limits.h when checking + int range. + 2019-10-15 Bruno Haible libtextstyle-optional: Sync with current not-yet-released libtextstyle. diff --git a/lib/inttypes.in.h b/lib/inttypes.in.h index 31e40c51a6..49bcbc168f 100644 --- a/lib/inttypes.in.h +++ b/lib/inttypes.in.h @@ -49,15 +49,15 @@ #ifndef __GLIBC__ # include #endif -/* Get CHAR_BIT. */ +/* Get CHAR_BIT, INT_MAX, LONG_MAX, etc. */ #include /* On mingw, __USE_MINGW_ANSI_STDIO only works if is also included */ #if defined _WIN32 && ! defined __CYGWIN__ # include #endif -#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 ." +#if !(INT_MAX == 0x7fffffff && INT_MIN + INT_MAX == -1) +# error "This file assumes that 'int' is 32-bit two's complement. Please report your platform and compiler to ." #endif /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ -- cgit v1.2.1