]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Return EXIT_UNSUPPORTED if __builtin_add_overflow unavailable
authorH.J. Lu <hjl.tools@gmail.com>
Sat, 14 Dec 2024 12:12:21 +0000 (20:12 +0800)
committerH.J. Lu <hjl.tools@gmail.com>
Sat, 14 Dec 2024 21:24:19 +0000 (05:24 +0800)
Since GCC 4.9 doesn't have __builtin_add_overflow:

In file included from tst-stringtable.c:180:0:
stringtable.c: In function ‘stringtable_finalize’:
stringtable.c:185:7: error: implicit declaration of function ‘__builtin_add_overflow’ [-Werror=implicit-function-declaration]
       else if (__builtin_add_overflow (previous->offset,
       ^

return EXIT_UNSUPPORTED for GCC 4.9 or older.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
elf/tst-stringtable.c
io/tst-utimensat-skeleton.c
sysdeps/unix/sysv/linux/tst-getdents64.c
time/tst-ctime.c
time/tst-difftime.c
time/tst-mktime4.c

index e18496f3f1383fbbad4b51edfd78098535741b74..a0e358f02aeb0fde99fadc1d64cc7c57b5d50d3b 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <array_length.h>
 #include <stdlib.h>
+#if __GNUC_PREREQ (5, 0)
 #include <string.h>
 #include <stringtable.h>
 #include <support/check.h>
@@ -179,3 +180,12 @@ do_test (void)
 #define _(arg) arg
 #include "stringtable.c"
 #include "stringtable_free.c"
+#else
+#include <support/test-driver.h>
+
+int
+main (void)
+{
+  return EXIT_UNSUPPORTED;
+}
+#endif
index 290ed81c9b116135ec5e067b83054260065bcfc2..1386fa3c8fae6caa7a78385209a59073eb5cf7d9 100644 (file)
@@ -20,6 +20,7 @@
 #include <inttypes.h>
 #include <support/support.h>
 #include <support/temp_file.h>
+#include <support/test-driver.h>
 #include <stdio.h>
 
 static int temp_fd = -1;
@@ -72,6 +73,7 @@ do_test (void)
   for (int i = 0; i < array_length (tests); i++)
     {
       /* Check if we run on port with 32 bit time_t size.  */
+#if __GNUC_PREREQ (5, 0)
       time_t t;
       if (__builtin_add_overflow (tests[i].v1, 0, &t)
          || __builtin_add_overflow (tests[i].v2, 0, &t))
@@ -80,6 +82,9 @@ do_test (void)
                  "time_t overflows\n", i, tests[i].v1, tests[i].v2);
          continue;
         }
+#else
+      return EXIT_UNSUPPORTED;
+#endif
 
       if (tests[i].v1 >= 0x100000000LL && !y2106)
        {
index 3dd22a4e0380561ea2be4a004ffbe9aa6f834291..ba66d49a2ebd703354e6fc037f401606f776496c 100644 (file)
@@ -30,6 +30,7 @@
 #include <sys/mman.h>
 #include <unistd.h>
 
+#if __GNUC_PREREQ (5, 0)
 /* Called by large_buffer_checks below.  */
 static void
 large_buffer_check (int fd, char *large_buffer, size_t large_buffer_size)
@@ -85,6 +86,12 @@ do_test_large_size (void)
 
   xclose (fd);
 }
+#else
+static void
+do_test_large_size (void)
+{
+}
+#endif
 
 static void
 do_test_by_size (size_t buffer_size)
index 8debf15004ea0d5510ae54f3c1aa47e769a450ff..204225992a804f112243eb18a2ca2a8a210f6507 100644 (file)
@@ -20,6 +20,7 @@
 #include <stdlib.h>
 #include <support/check.h>
 
+#if __GNUC_PREREQ (5, 0)
 static int
 do_test (void)
 {
@@ -70,3 +71,12 @@ do_test (void)
 }
 
 #include <support/test-driver.c>
+#else
+#include <support/test-driver.h>
+
+int
+main (void)
+{
+  return EXIT_UNSUPPORTED;
+}
+#endif
index 5043d550875ed632650a0cbf097f8989f70f9f1f..5a9a66badb693e3e643ec5d6e8144c487f8d43cb 100644 (file)
@@ -19,6 +19,7 @@
 #include <time.h>
 #include <support/check.h>
 
+#if __GNUC_PREREQ (5, 0)
 static void
 test_difftime_helper (time_t t1, time_t t0, double exp_val)
 {
@@ -54,3 +55,12 @@ do_test (void)
 }
 
 #include <support/test-driver.c>
+#else
+#include <support/test-driver.h>
+
+int
+main ()
+{
+  return EXIT_UNSUPPORTED;
+}
+#endif
index 505d9fcc2e063bfafecd9694293ea271a741b03a..05c833c816122201f01d930dc206f779890930f0 100644 (file)
@@ -20,6 +20,7 @@
 #include <stdlib.h>
 #include <support/check.h>
 
+#if __GNUC_PREREQ (5, 0)
 const struct tm tm0 =
   {
     .tm_year = 70,
@@ -107,3 +108,12 @@ do_test (void)
 }
 
 #include <support/test-driver.c>
+#else
+#include <support/test-driver.h>
+
+int
+main (void)
+{
+  return EXIT_UNSUPPORTED;
+}
+#endif