From: Bruno Haible Date: Thu, 15 Jan 2026 13:24:53 +0000 (+0100) Subject: stdcountof-h tests: Fix link error on MSVC (regression 2026-01-13). X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=10c82a407192d79738ff6835494c208588974fa1;p=thirdparty%2Fgnulib.git stdcountof-h tests: Fix link error on MSVC (regression 2026-01-13). * tests/test-stdcountof-h.c: Revert 2026-01-13 change. Instead: (a, b, c): Declare extern at top level. --- diff --git a/ChangeLog b/ChangeLog index 419dfec25d..7d7d0f6f50 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2026-01-15 Bruno Haible + + stdcountof-h tests: Fix link error on MSVC (regression 2026-01-13). + * tests/test-stdcountof-h.c: Revert 2026-01-13 change. Instead: + (a, b, c): Declare extern at top level. + 2026-01-14 Bruno Haible stdcountof-h tests: Avoid compilation error in C++ mode. diff --git a/tests/test-stdcountof-h.c b/tests/test-stdcountof-h.c index 03498ae99d..07a86fef98 100644 --- a/tests/test-stdcountof-h.c +++ b/tests/test-stdcountof-h.c @@ -34,6 +34,7 @@ extern int integer; extern int unbounded[]; extern int bounded[10]; extern int multidimensional[10][20]; +extern int a, b, c; static void test_func (int parameter[3]) @@ -81,8 +82,8 @@ test_func (int parameter[3]) /* Avoid MSVC C++ error C4576 "a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax". */ #if !defined __cplusplus - ASSERT (countof ((int[]) { integer, integer, integer }) == 3); - ASSERT (countof (((int[]) { integer, integer, integer })) == 3); + ASSERT (countof ((int[]) { a, b, c }) == 3); + ASSERT (countof (((int[]) { a, b, c })) == 3); #endif /* Check that countof(...) is an expression of type size_t. */