This gcc warning

test-string-buffer.c:104:29: warning: format '%lc' expects argument of type 
'wint_t', but argument 3 has type 'int' [-Wformat=]

is justified: in theory, a platform could have a 64-bit wint_t type. Although
I don't know of any current platform that has this.


2023-09-04  Bruno Haible  <br...@clisp.org>

        string-buffer tests: Fix a gcc -Wformat warning.
        * tests/test-string-buffer.c: Don't assume that wint_t has the same size
        as 'int'.

diff --git a/tests/test-string-buffer.c b/tests/test-string-buffer.c
index 3d26ad25b9..1c9181d838 100644
--- a/tests/test-string-buffer.c
+++ b/tests/test-string-buffer.c
@@ -101,7 +101,7 @@ main ()
 
     sb_init (&buffer);
     sb_append (&buffer, "<");
-    sb_appendf (&buffer, "%lc", 0x76543210);
+    sb_appendf (&buffer, "%lc", (wint_t) 0x76543210);
     sb_append (&buffer, "|");
     sb_appendf (&buffer, invalid_format_string_1, 1);
     sb_append (&buffer, "|");




Reply via email to