With clang 22, I see this warning:

In file included from ../../gltests/test-stdcountof-h-c++.cc:17:
../../gltests/test-stdcountof-h.c:40:1: warning: unused function 'do_call' 
[-Wunused-function]
   40 | do_call ()
      | ^~~~~~~
1 warning generated.

This patch should fix the warning.


2026-03-01  Bruno Haible  <[email protected]>

        stdcountof-h tests: Avoid a clang warning.
        * tests/test-stdcountof-h.c (call_count, do_call): Don't define in C++
        mode.

diff --git a/tests/test-stdcountof-h.c b/tests/test-stdcountof-h.c
index 8be40adc40..a0b887425e 100644
--- a/tests/test-stdcountof-h.c
+++ b/tests/test-stdcountof-h.c
@@ -35,12 +35,14 @@ extern int unbounded[];
 extern int bounded[10];
 extern int multidimensional[10][20];
 
+#if !defined __cplusplus
 static int call_count;
 static int
 do_call ()
 {
   return call_count++;
 }
+#endif
 
 static void
 test_func (int parameter[3])




Reply via email to