From 624ac1a3466bba1e18215df3f91c6d581f7bcb55 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 8 May 2017 10:37:48 -0700 Subject: [PATCH] =?UTF-8?q?intprops:=20don=E2=80=99t=20depend=20on=20?= =?UTF-8?q?=E2=80=98verify=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem reported by Ævar Arnfjörð Bjarmason in: http://lists.gnu.org/archive/html/bug-gnulib/2017-05/msg00054.html * lib/intprops.h: Do not include verify.h, and move compile-time checks from here ... * tests/test-intprops.c (main): ... to here, if they’re not here already. Check widths of other standard integer types. * modules/intprops (Depends-on): Remove ‘verify’. --- ChangeLog | 11 +++++++++++ lib/intprops.h | 20 +------------------- modules/intprops | 1 - tests/test-intprops.c | 21 +++++++++++++++++++++ 4 files changed, 33 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index f596fcd..b159e4a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2017-05-08 Paul Eggert + + intprops: don’t depend on ‘verify’ + Problem reported by Ævar Arnfjörð Bjarmason in: + http://lists.gnu.org/archive/html/bug-gnulib/2017-05/msg00054.html + * lib/intprops.h: Do not include verify.h, and move compile-time + checks from here ... + * tests/test-intprops.c (main): ... to here, if they’re not here + already. Check widths of other standard integer types. + * modules/intprops (Depends-on): Remove ‘verify’. + 2017-05-07 Bruno Haible utimens: On native Windows, support 100ns resolution also if fd < 0. diff --git a/lib/intprops.h b/lib/intprops.h index c31a455..d8c7120 100644 --- a/lib/intprops.h +++ b/lib/intprops.h @@ -21,7 +21,6 @@ #define _GL_INTPROPS_H #include -#include /* Return a value with the common real type of E and V and the value of V. */ #define _GL_INT_CONVERT(e, v) (0 * (e) + (v)) @@ -80,24 +79,7 @@ /* This include file assumes that signed types are two's complement without padding bits; the above macros have undefined behavior otherwise. If this is a problem for you, please let us know how to fix it for your host. - As a sanity check, test the assumption for some signed types that - bounds. */ -verify (TYPE_MINIMUM (signed char) == SCHAR_MIN); -verify (TYPE_MAXIMUM (signed char) == SCHAR_MAX); -verify (TYPE_MINIMUM (short int) == SHRT_MIN); -verify (TYPE_MAXIMUM (short int) == SHRT_MAX); -verify (TYPE_MINIMUM (int) == INT_MIN); -verify (TYPE_MAXIMUM (int) == INT_MAX); -verify (TYPE_MINIMUM (long int) == LONG_MIN); -verify (TYPE_MAXIMUM (long int) == LONG_MAX); -#ifdef LLONG_MAX -verify (TYPE_MINIMUM (long long int) == LLONG_MIN); -verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); -#endif -/* Similarly, sanity-check one ISO/IEC TS 18661-1:2014 macro if defined. */ -#ifdef UINT_WIDTH -verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH); -#endif + This assumption is tested by the intprops-tests module. */ /* Does the __typeof__ keyword work? This could be done by 'configure', but for now it's easier to do it by hand. */ diff --git a/modules/intprops b/modules/intprops index ec107ca..0680adf 100644 --- a/modules/intprops +++ b/modules/intprops @@ -5,7 +5,6 @@ Files: lib/intprops.h Depends-on: -verify configure.ac: diff --git a/tests/test-intprops.c b/tests/test-intprops.c index b7740dd..a030e73 100644 --- a/tests/test-intprops.c +++ b/tests/test-intprops.c @@ -113,11 +113,32 @@ main (void) VERIFY (TYPE_MAXIMUM (long int) == LONG_MAX); VERIFY (TYPE_MINIMUM (unsigned long int) == 0); VERIFY (TYPE_MAXIMUM (unsigned long int) == ULONG_MAX); + #ifdef LLONG_MAX + verify (TYPE_MINIMUM (long long int) == LLONG_MIN); + verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); + #endif VERIFY (TYPE_MINIMUM (intmax_t) == INTMAX_MIN); VERIFY (TYPE_MAXIMUM (intmax_t) == INTMAX_MAX); VERIFY (TYPE_MINIMUM (uintmax_t) == 0); VERIFY (TYPE_MAXIMUM (uintmax_t) == UINTMAX_MAX); + /* TYPE_WIDTH. */ + #ifdef CHAR_WIDTH + verify (TYPE_WIDTH (char) == CHAR_WIDTH); + verify (TYPE_WIDTH (signed char) == SCHAR_WIDTH); + verify (TYPE_WIDTH (unsigned char) == UCHAR_WIDTH); + verify (TYPE_WIDTH (short int) == SHRT_WIDTH); + verify (TYPE_WIDTH (unsigned short int) == USHRT_WIDTH); + verify (TYPE_WIDTH (int) == INT_WIDTH); + verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH); + verify (TYPE_WIDTH (long int) == LONG_WIDTH); + verify (TYPE_WIDTH (unsigned long int) == ULONG_WIDTH); + #ifdef LLONG_WIDTH + verify (TYPE_WIDTH (long long int) == LLONG_WIDTH); + verify (TYPE_WIDTH (unsigned long long int) == ULLONG_WIDTH); + #endif + #endif + /* INT_BITS_STRLEN_BOUND. */ VERIFY (INT_BITS_STRLEN_BOUND (1) == 1); VERIFY (INT_BITS_STRLEN_BOUND (2620) == 789); -- 2.9.3