]> Savannah Git Hosting - gnulib.git/commitdiff
test-calloc-gnu: port to GCC7
authorJim Meyering <meyering@fb.com>
Sat, 4 Mar 2017 22:50:41 +0000 (14:50 -0800)
committerJim Meyering <meyering@fb.com>
Sat, 4 Mar 2017 22:51:50 +0000 (14:51 -0800)
* tests/test-calloc-gnu.c (main) [__GNUC__ >= 7]: Skip a test
that attempts to calloc more than SIZE_MAX bytes, because GCC7
and newer would detect that at compilation time.

ChangeLog
tests/test-calloc-gnu.c

index e653d82992a0e593694106150751277e380dedeb..e856f85f448ff08272e85cbd8ec35ae65bed131f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2017-03-04  Jim Meyering  <meyering@fb.com>
+
+       test-calloc-gnu: port to GCC7
+       * tests/test-calloc-gnu.c (main) [__GNUC__ >= 7]: Skip a test
+       that attempts to calloc more than SIZE_MAX bytes, because GCC7
+       and newer would detect that at compilation time.
+
 2017-03-04  Bruno Haible  <bruno@clisp.org>
 
        tests: Avoid compiler warning about uses of null_ptr.
index 762d68b642654e342e436a9f7a74c8e86ea3a3c3..3f964c38ed5b79c83963262d28f88f898f444c58 100644 (file)
@@ -27,6 +27,10 @@ main ()
     return 1;
   free (p);
 
+#if __GNUC__ < 7
+  /* GCC7's -Werror=alloc-size-larger-than= would cause the following error
+     to be detected at compile time, so skip the test for GCC7 and newer.  */
+
   /* Check that calloc fails when requested to allocate a block of memory
      larger than SIZE_MAX bytes.  */
   p = calloc ((size_t) -1 / 8 + 1, 8);
@@ -35,6 +39,7 @@ main ()
       free (p);
       return 1;
     }
+#endif
 
   return 0;
 }