]> Savannah Git Hosting - gnulib.git/commitdiff
string-buffer tests: Fix a gcc -Wformat warning.
authorBruno Haible <bruno@clisp.org>
Mon, 4 Sep 2023 14:02:36 +0000 (16:02 +0200)
committerBruno Haible <bruno@clisp.org>
Thu, 14 Sep 2023 10:09:42 +0000 (12:09 +0200)
* tests/test-string-buffer.c: Include <wchar.h>. Don't assume that
wint_t has the same size as 'int'.

ChangeLog
tests/test-string-buffer.c

index 04fe6fe67413d377a47676b50ee6697beaef71b5..d64702a63b9003846e09b1b981080ca2e0480a71 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2023-09-04  Bruno Haible  <bruno@clisp.org>
 
+       string-buffer tests: Fix a gcc -Wformat warning.
+       * tests/test-string-buffer.c: Include <wchar.h>. Don't assume that
+       wint_t has the same size as 'int'.
+
        crypto/* tests: Fix some gcc -Wdiscarded-qualifiers warnings.
        * tests/test-gc-hmac-md5.c (main): Change type of variables with a
        string literal initializer to 'const char *'.
index 3d26ad25b9ff808d926e742642341f9f57c2ba6c..e5c2c5f9188c3431aa51fb4a368c6c4bdad2a7fb 100644 (file)
@@ -21,6 +21,7 @@
 #include "string-buffer.h"
 
 #include <string.h>
+#include <wchar.h>
 
 #include "macros.h"
 
@@ -101,7 +102,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, "|");