summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2017-05-08 10:37:48 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2017-05-08 10:38:24 -0700
commitd9c44b2b3b0faf7eda80e356caa0d09e6ea91679 (patch)
tree7214b174631332290c198b91d620ef60e3709b63
parent26d566787603c3469760670613f34aab760ec6f3 (diff)
downloadgnulib-d9c44b2b3b0faf7eda80e356caa0d09e6ea91679.tar.gz
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’.
-rw-r--r--ChangeLog11
-rw-r--r--lib/intprops.h20
-rw-r--r--modules/intprops1
-rw-r--r--tests/test-intprops.c21
4 files changed, 33 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index f596fcd806..b159e4a5d3 100644
--- 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.
diff --git a/lib/intprops.h b/lib/intprops.h
index c31a455e4a..d8c7120649 100644
--- a/lib/intprops.h
+++ b/lib/intprops.h
@@ -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))
@@ -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
- <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. */
diff --git a/modules/intprops b/modules/intprops
index ec107caef3..0680adf05a 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 b7740dd0b8..a030e733ab 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);