]> Savannah Git Hosting - gnulib.git/commitdiff
intprops: don’t depend on ‘verify’
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 8 May 2017 17:37:48 +0000 (10:37 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 8 May 2017 17:38:24 +0000 (10:38 -0700)
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
lib/intprops.h
modules/intprops
tests/test-intprops.c

index f596fcd80616e1ef4c10a0034d2ab50109c2c452..b159e4a5d3d17d97eb53ead23ca8ea8fa67f465d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2017-05-08  Paul Eggert  <eggert@cs.ucla.edu>
+
+       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  <bruno@clisp.org>
 
        utimens: On native Windows, support 100ns resolution also if fd < 0.
index c31a455e4a4c382533a99b9a495b513ccb72a633..d8c7120649063955e097b388c5e0d28f15963900 100644 (file)
@@ -21,7 +21,6 @@
 #define _GL_INTPROPS_H
 
 #include <limits.h>
-#include <verify.h>
 
 /* 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))
 /* 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
-   <limits.h> 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.  */
index ec107caef3ef62eeda524462376f8d910c293b21..0680adf05ad35f4e3d63bf2ea151be312b4d770b 100644 (file)
@@ -5,7 +5,6 @@ Files:
 lib/intprops.h
 
 Depends-on:
-verify
 
 configure.ac:
 
index b7740dd0b8d0ba7b14160f5b6c1cdefc89602cf0..a030e733ab781701c04ff9e65cb2ec2c63abe248 100644 (file)
@@ -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);