git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 5/5] ewah_bitmap.c: Fix printf format warnings on MinGW

From
Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Date
Nov 7, 2013, 22:12 UTC
Message-ID
<527C1069.1080000@ramsay1.demon.co.uk>
On MinGW, gcc complains as follows:
        CC ewah/ewah_bitmap.o
    ewah/ewah_bitmap.c: In function 'ewah_dump':
    ewah/ewah_bitmap.c:389: warning: unknown conversion type \
        character 'z' in format
    ewah/ewah_bitmap.c:389: warning: unknown conversion type \
        character 'z' in format
    ewah/ewah_bitmap.c:389: warning: too many arguments for format
    ewah/ewah_bitmap.c:392: warning: unknown conversion type \
        character 'l' in format
    ewah/ewah_bitmap.c:392: warning: too many arguments for format

In order to suppress the warnings, use the PRIuMAX and PRIx64 macros from the <inttypes.h> header file.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 ewah/ewah_bitmap.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/ewah/ewah_bitmap.c b/ewah/ewah_bitmap.c
index 625f5a6..1e363b9 100644
--- a/ewah/ewah_bitmap.c
+++ b/ewah/ewah_bitmap.c
@@ -22,6 +22,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdio.h>
+#include <inttypes.h>
 
 #include "ewok.h"
 #include "ewok_rlw.h"
@@ -386,10 +387,11 @@ void ewah_iterator_init(struct ewah_iterator *it, struct ewah_bitmap *parent)
 void ewah_dump(struct ewah_bitmap *self)
 {
 	size_t i;
-	fprintf(stderr, "%zu bits | %zu words | ", self->bit_size, self->buffer_size);
+	fprintf(stderr, "%"PRIuMAX" bits | %"PRIuMAX" words | ",
+		(uintmax_t)self->bit_size, (uintmax_t)self->buffer_size);
 
 	for (i = 0; i < self->buffer_size; ++i)
-		fprintf(stderr, "%016llx ", (unsigned long long)self->buffer[i]);
+		fprintf(stderr, "%016"PRIx64" ", (unsigned long long)self->buffer[i]);
 
 	fprintf(stderr, "\n");
 }
-- 
1.8.4
Next: Junio C Hamano
Message 1 of 2 in “ewah_bitmap.c: Fix printf format warnings on MinGW”
  1. 5/5 ewah_bitmap.c: Fix printf format warnings on MinGWRamsay Jones, Nov 7, 2013
  2. Junio C HamanoNov 7, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.