]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
stdcountof-h tests: Fix compilation error with gcc versions < 15.
authorBruno Haible <bruno@clisp.org>
Tue, 3 Jun 2025 12:15:39 +0000 (14:15 +0200)
committerBruno Haible <bruno@clisp.org>
Tue, 3 Jun 2025 12:15:39 +0000 (14:15 +0200)
* tests/test-stdcountof-h.c (HAVE___TYPEOF__): Remove macro.
(test_func): Remove __typeof__ invocations.

ChangeLog
tests/test-stdcountof-h.c

index 7e0bbee92841dc1cb7c30ed2d632eba062012d72..93503e5aaf95a0bbacb041327fc3b97044a89dfd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2025-06-03  Bruno Haible  <bruno@clisp.org>
+
+       stdcountof-h tests: Fix compilation error with gcc versions < 15.
+       * tests/test-stdcountof-h.c (HAVE___TYPEOF__): Remove macro.
+       (test_func): Remove __typeof__ invocations.
+
 2025-06-03  Bruno Haible  <bruno@clisp.org>
 
        fcntl-h, open: Fix two regressions on native Windows (regr. 2025-05-26).
index a382dc1b1e61577a7ed16b2588292d853135176a..cd7e03f3319c99fe16e36473fe0dc0e58b526d9f 100644 (file)
 
 #include "macros.h"
 
-/* Whether the compiler supports __typeof__.  */
-#if ((defined __GNUC__ && 2 <= __GNUC__) \
-     || (defined __clang_major__ && 4 <= __clang_major__) \
-     || (defined __IBMC__ && 1210 <= __IBMC__ && defined __IBM__TYPEOF__) \
-     || (defined __SUNPRO_C && 0x5110 <= __SUNPRO_C && !__STDC__) \
-     || (defined _MSC_VER && 1939 <= _MSC_VER))
-# define HAVE___TYPEOF__ 1
-#endif
-
 /* Whether the compiler supports _Generic.
    Test program:
      int f (int x) { return _Generic (x, char *: 2, int: 3); }
@@ -68,10 +59,10 @@ test_func (int parameter[3])
 #endif
 
   /* Check that countof(...) is an expression of type size_t.  */
-#if !defined __cplusplus && HAVE___TYPEOF__ && HAVE__GENERIC
-  ASSERT (_Generic (__typeof__ (countof (bounded)),          size_t: 1, default: 0));
-  ASSERT (_Generic (__typeof__ (countof (multidimensional)), size_t: 1, default: 0));
-  ASSERT (_Generic (__typeof__ (countof (local_bounded)),    size_t: 1, default: 0));
+#if !defined __cplusplus && HAVE__GENERIC
+  ASSERT (_Generic (countof (bounded),          size_t: 1, default: 0));
+  ASSERT (_Generic (countof (multidimensional), size_t: 1, default: 0));
+  ASSERT (_Generic (countof (local_bounded),    size_t: 1, default: 0));
 #endif
 }