From: Jim Meyering <meyering@fb.com>
Date: Wed, 12 Oct 2016 19:30:07 +0000 (-0700)
Subject: test-stdint: use _GL_VERIFY rather than "verify" for some tests
X-Git-Tag: v1.0~6607
X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=d487c185786cac7b2db30098c799e4adf7518317;p=gnulib.git

test-stdint: use _GL_VERIFY rather than "verify" for some tests

* tests/test-stdint.c (verify_width): Implement with _GL_VERIFY
and an abbreviated diagnostic rather than verify with the full one,
because the full-length strings would evoke warnings from gcc with
-Woverlength-strings.
---

diff --git a/ChangeLog b/ChangeLog
index 32bddf8119..f94feb1982 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2016-10-12  Jim Meyering  <meyering@fb.com>
+
+	test-stdint: use _GL_VERIFY rather than "verify" for some tests
+	* tests/test-stdint.c (verify_width): Implement with _GL_VERIFY
+	and an abbreviated diagnostic rather than verify with the full one,
+	because the full-length strings would evoke warnings from gcc with
+	-Woverlength-strings.
+
 2016-10-13  Paul Eggert  <eggert@cs.ucla.edu>
 
 	stdint: port SIZE_MAX to glibc s390
diff --git a/tests/test-stdint.c b/tests/test-stdint.c
index c0e2f08abf..6eb1d2edab 100644
--- a/tests/test-stdint.c
+++ b/tests/test-stdint.c
@@ -351,10 +351,19 @@ verify_same_types (INTMAX_C (17), (intmax_t)0 + 0);
 verify (UINTMAX_C (17) == 17);
 verify_same_types (UINTMAX_C (17), (uintmax_t)0 + 0);
 
-/* Macros specified by ISO/IEC TS 18661-1:2014.  */
-
+/* Use _GL_VERIFY (with a fixed-length diagnostic string) rather than verify,
+   because the latter would require forming each stringified expression, and
+   many of these would be so long as to trigger a warning/error like this:
+
+   test-stdint.c:407:1: error: string length '6980' is greater than the \
+     length '4095' ISO C99 compilers are required to support \
+     [-Werror=overlength-strings]
+  */
 #define verify_width(width, min, max) \
-  verify ((max) >> ((width) - 1 - ((min) < 0)) == 1)
+  _GL_VERIFY ((max) >> ((width) - 1 - ((min) < 0)) == 1, \
+              "verify_width check")
+
+/* Macros specified by ISO/IEC TS 18661-1:2014.  */
 
 #ifdef INT8_MAX
 verify_width (INT8_WIDTH, INT8_MIN, INT8_MAX);