[PATCH v1 21/35] In tests, assume GCC 5 or later or compatible

Alejandro Colomar alx@kernel.org
Sun Nov 9 21:53:40 GMT 2025


In theory, some of these features might not be supported by Clang 4
(which is the minimum Clang version we assume).  However, since these
are tests, it's safe to assume that most (if not all) of them are
supported, or at least that it won't be worse than not testing them at
all.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
---
 assert/tst-assert-c++.cc                 | 10 ----------
 elf/tst-stringtable.c                    | 10 ----------
 io/tst-utimensat-skeleton.c              |  4 ----
 misc/tst-fd_to_filename.c                | 10 ----------
 signal/tst-minsigstksz-1.c               |  2 +-
 string/tester.c                          |  2 --
 sysdeps/unix/sysv/linux/tst-getdents64.c |  7 -------
 sysdeps/x86/tst-cpu-features-supports.c  | 10 ----------
 time/tst-ctime.c                         | 10 ----------
 time/tst-difftime.c                      | 10 ----------
 time/tst-mktime4.c                       | 10 ----------
 11 files changed, 1 insertion(+), 84 deletions(-)

diff --git a/assert/tst-assert-c++.cc b/assert/tst-assert-c++.cc
index ab404ef0f9..154a6c2dd1 100644
--- a/assert/tst-assert-c++.cc
+++ b/assert/tst-assert-c++.cc
@@ -21,7 +21,6 @@
 #undef NDEBUG
 #include <assert.h>
 
-#if __GNUC_PREREQ (5, 0)
 /* The C++ standard requires that if the assert argument is a constant
    subexpression, then the assert itself is one, too.  */
 constexpr int
@@ -78,14 +77,5 @@ do_test ()
 
   return 0;
 }
-#else
-#include <support/test-driver.h>
-
-static int
-do_test ()
-{
-  return EXIT_UNSUPPORTED;
-}
-#endif
 
 #include <support/test-driver.c>
diff --git a/elf/tst-stringtable.c b/elf/tst-stringtable.c
index 5fffb0de1b..baeca020bb 100644
--- a/elf/tst-stringtable.c
+++ b/elf/tst-stringtable.c
@@ -17,7 +17,6 @@
 
 #include <array_length.h>
 #include <stdlib.h>
-#if __GNUC_PREREQ (5, 0)
 #include <string.h>
 #include <stringtable.h>
 #include <support/check.h>
@@ -180,12 +179,3 @@ 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
diff --git a/io/tst-utimensat-skeleton.c b/io/tst-utimensat-skeleton.c
index ccfae789b3..a20e91ee27 100644
--- a/io/tst-utimensat-skeleton.c
+++ b/io/tst-utimensat-skeleton.c
@@ -73,7 +73,6 @@ 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))
@@ -82,9 +81,6 @@ 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)
 	{
diff --git a/misc/tst-fd_to_filename.c b/misc/tst-fd_to_filename.c
index bc7cf9826b..0e89ba4d4a 100644
--- a/misc/tst-fd_to_filename.c
+++ b/misc/tst-fd_to_filename.c
@@ -17,7 +17,6 @@
    <https://www.gnu.org/licenses/>.  */
 
 #include <fcntl.h>
-#if __GNUC_PREREQ (5, 0)
 #include <fd_to_filename.h>
 #include <stdio.h>
 #include <support/check.h>
@@ -100,12 +99,3 @@ do_test (void)
 }
 
 #include <support/test-driver.c>
-#else
-#include <support/test-driver.h>
-
-int
-main (void)
-{
-  return EXIT_UNSUPPORTED;
-}
-#endif
diff --git a/signal/tst-minsigstksz-1.c b/signal/tst-minsigstksz-1.c
index 1b9778516d..44634d36a2 100644
--- a/signal/tst-minsigstksz-1.c
+++ b/signal/tst-minsigstksz-1.c
@@ -38,7 +38,7 @@
 /* We do not try to test atomic operations exhaustively, only a simple
    atomic counter increment.  This is only safe if atomic_[u]int is
    unconditionally lock-free.  */
-#if defined __STDC_NO_ATOMICS__ || !__GNUC_PREREQ (5, 0)
+#if defined __STDC_NO_ATOMICS__
 # define TEST_ATOMIC_OPS 0
 #else
 # include <stdatomic.h>
diff --git a/string/tester.c b/string/tester.c
index 33a77d5eb2..462de22478 100644
--- a/string/tester.c
+++ b/string/tester.c
@@ -64,9 +64,7 @@ static __typeof (memset) * volatile memset_indirect = memset;
    are larger than the actual buffers, which result in various
    warnings.  */
 DIAG_IGNORE_NEEDS_COMMENT (8, "-Warray-bounds");
-#if __GNUC_PREREQ (5, 0)
 DIAG_IGNORE_NEEDS_COMMENT (5.0, "-Wmemset-transposed-args");
-#endif
 #if __GNUC_PREREQ (7, 0)
 DIAG_IGNORE_NEEDS_COMMENT (9, "-Wrestrict");
 DIAG_IGNORE_NEEDS_COMMENT (7, "-Wstringop-overflow=");
diff --git a/sysdeps/unix/sysv/linux/tst-getdents64.c b/sysdeps/unix/sysv/linux/tst-getdents64.c
index cdbd9c9c3f..e8e23d8eeb 100644
--- a/sysdeps/unix/sysv/linux/tst-getdents64.c
+++ b/sysdeps/unix/sysv/linux/tst-getdents64.c
@@ -30,7 +30,6 @@
 #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)
@@ -86,12 +85,6 @@ 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)
diff --git a/sysdeps/x86/tst-cpu-features-supports.c b/sysdeps/x86/tst-cpu-features-supports.c
index 88b6a6daae..4b5cd2d12e 100644
--- a/sysdeps/x86/tst-cpu-features-supports.c
+++ b/sysdeps/x86/tst-cpu-features-supports.c
@@ -97,19 +97,15 @@ do_test (int argc, char **argv)
 # endif
   fails += CHECK_FEATURE_ACTIVE (avx512dq, AVX512DQ);
 #endif
-#if __GNUC_PREREQ (5, 0)
   fails += CHECK_FEATURE_ACTIVE (avx512f, AVX512F);
-#endif
 #if __GNUC_PREREQ (6, 0)
 # if !__GNUC_PREREQ (15, 0)
   fails += CHECK_FEATURE_ACTIVE (avx512pf, AVX512PF);
 # endif
   fails += CHECK_FEATURE_ACTIVE (avx512vl, AVX512VL);
 #endif
-#if __GNUC_PREREQ (5, 0)
   fails += CHECK_FEATURE_ACTIVE (bmi, BMI1);
   fails += CHECK_FEATURE_ACTIVE (bmi2, BMI2);
-#endif
 #if __GNUC_PREREQ (11, 0)
   fails += CHECK_FEATURE_ACTIVE (cldemote, CLDEMOTE);
   fails += CHECK_FEATURE_ACTIVE (clflushopt, CLFLUSHOPT);
@@ -122,10 +118,8 @@ do_test (int argc, char **argv)
   fails += CHECK_FEATURE_PRESENT (enqcmd, ENQCMD);
   fails += CHECK_FEATURE_ACTIVE (f16c, F16C);
 #endif
-#if __GNUC_PREREQ (4, 9)
   fails += CHECK_FEATURE_ACTIVE (fma, FMA);
   fails += CHECK_FEATURE_ACTIVE (fma4, FMA4);
-#endif
 #if __GNUC_PREREQ (11, 0)
   fails += CHECK_FEATURE_PRESENT (fsgsbase, FSGSBASE);
   fails += CHECK_FEATURE_ACTIVE (fxsave, FXSR);
@@ -169,9 +163,7 @@ do_test (int argc, char **argv)
   fails += CHECK_FEATURE_ACTIVE (sse3, SSE3);
   fails += CHECK_FEATURE_ACTIVE (sse4.1, SSE4_1);
   fails += CHECK_FEATURE_ACTIVE (sse4.2, SSE4_2);
-#if __GNUC_PREREQ (4, 9)
   fails += CHECK_FEATURE_ACTIVE (sse4a, SSE4A);
-#endif
   fails += CHECK_FEATURE_ACTIVE (ssse3, SSSE3);
 #if __GNUC_PREREQ (11, 0)
   fails += CHECK_FEATURE_ACTIVE (tbm, TBM);
@@ -185,9 +177,7 @@ do_test (int argc, char **argv)
   fails += CHECK_FEATURE_ACTIVE (waitpkg, WAITPKG);
   fails += CHECK_FEATURE_ACTIVE (wbnoinvd, WBNOINVD);
 #endif
-#if __GNUC_PREREQ (4, 9)
   fails += CHECK_FEATURE_ACTIVE (xop, XOP);
-#endif
 #if __GNUC_PREREQ (11, 0)
   fails += CHECK_FEATURE_ACTIVE (xsave, XSAVE);
   fails += CHECK_FEATURE_ACTIVE (xsavec, XSAVEC);
diff --git a/time/tst-ctime.c b/time/tst-ctime.c
index 05c3805504..55dc941d3c 100644
--- a/time/tst-ctime.c
+++ b/time/tst-ctime.c
@@ -20,7 +20,6 @@
 #include <stdlib.h>
 #include <support/check.h>
 
-#if __GNUC_PREREQ (5, 0)
 static int
 do_test (void)
 {
@@ -71,12 +70,3 @@ do_test (void)
 }
 
 #include <support/test-driver.c>
-#else
-#include <support/test-driver.h>
-
-int
-main (void)
-{
-  return EXIT_UNSUPPORTED;
-}
-#endif
diff --git a/time/tst-difftime.c b/time/tst-difftime.c
index 378eaab1f6..6fe679bf18 100644
--- a/time/tst-difftime.c
+++ b/time/tst-difftime.c
@@ -19,7 +19,6 @@
 #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)
 {
@@ -55,12 +54,3 @@ do_test (void)
 }
 
 #include <support/test-driver.c>
-#else
-#include <support/test-driver.h>
-
-int
-main (void)
-{
-  return EXIT_UNSUPPORTED;
-}
-#endif
diff --git a/time/tst-mktime4.c b/time/tst-mktime4.c
index 08b1da324b..9f869c1a9d 100644
--- a/time/tst-mktime4.c
+++ b/time/tst-mktime4.c
@@ -20,7 +20,6 @@
 #include <stdlib.h>
 #include <support/check.h>
 
-#if __GNUC_PREREQ (5, 0)
 const struct tm tm0 =
   {
     .tm_year = 70,
@@ -108,12 +107,3 @@ do_test (void)
 }
 
 #include <support/test-driver.c>
-#else
-#include <support/test-driver.h>
-
-int
-main (void)
-{
-  return EXIT_UNSUPPORTED;
-}
-#endif
-- 
2.51.0



More information about the Libc-alpha mailing list