From: Bruno Haible Date: Sun, 12 Oct 2025 11:31:49 +0000 (+0200) Subject: stdcountof-h tests: Fix link error on MSVC 14 (regression 2025-06-07). X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=94dcab943a787bc9234a0cd324071d83cea74b12;p=thirdparty%2Fgnulib.git stdcountof-h tests: Fix link error on MSVC 14 (regression 2025-06-07). * tests/test-stdcountof-h.c (a, b, c): Define as variables on MSVC. --- diff --git a/ChangeLog b/ChangeLog index 07f0503f84..932e94c630 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2025-10-12 Bruno Haible + + stdcountof-h tests: Fix link error on MSVC 14 (regression 2025-06-07). + * tests/test-stdcountof-h.c (a, b, c): Define as variables on MSVC. + 2025-10-10 Collin Funk getline tests: Add a test for the glibc bug. diff --git a/tests/test-stdcountof-h.c b/tests/test-stdcountof-h.c index 77cfbc4dec..615cccda16 100644 --- a/tests/test-stdcountof-h.c +++ b/tests/test-stdcountof-h.c @@ -105,3 +105,12 @@ main () return test_exit_status; } + +/* A definition of the variables a, b, c is not required by ISO C, because + these identifiers are only used as part of 'sizeof' expressions whose + results are integer expressions. See ISO C 23 § 6.9.1.(5). However, + MSVC 14 generates actual references to these variables. We thus need + to define these variables; otherwise we get link errors. */ +#if defined _MSC_VER && !defined __clang__ +int a, b, c; +#endif