From: Bruno Haible Date: Tue, 3 Jun 2025 12:15:39 +0000 (+0200) Subject: stdcountof-h tests: Fix compilation error with gcc versions < 15. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=18ebf1852d2b682786a2a6a9c9cb9c217b4439d1;p=thirdparty%2Fgnulib.git stdcountof-h tests: Fix compilation error with gcc versions < 15. * tests/test-stdcountof-h.c (HAVE___TYPEOF__): Remove macro. (test_func): Remove __typeof__ invocations. --- diff --git a/ChangeLog b/ChangeLog index 7e0bbee928..93503e5aaf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2025-06-03 Bruno Haible + + 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 fcntl-h, open: Fix two regressions on native Windows (regr. 2025-05-26). diff --git a/tests/test-stdcountof-h.c b/tests/test-stdcountof-h.c index a382dc1b1e..cd7e03f331 100644 --- a/tests/test-stdcountof-h.c +++ b/tests/test-stdcountof-h.c @@ -20,15 +20,6 @@ #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 }