{"thread":{"id":"35299","subject":"[PATCH 5/5] ewah_bitmap.c: Fix printf format warnings on MinGW","startedAt":"2013-11-07T22:12:57Z","lastAt":"2013-11-07T23:01:17Z","messageCount":2,"participants":["Ramsay Jones","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":5},"messages":[{"id":"230220","messageId":"527C1069.1080000@ramsay1.demon.co.uk","threadId":"35299","inReplyTo":null,"subject":"[PATCH 5/5] ewah_bitmap.c: Fix printf format warnings on MinGW","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2013-11-07T22:12:57Z","receivedAt":"2013-11-07T22:12:57Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\nOn MinGW, gcc complains as follows:\n\n        CC ewah/ewah_bitmap.o\n    ewah/ewah_bitmap.c: In function 'ewah_dump':\n    ewah/ewah_bitmap.c:389: warning: unknown conversion type \\\n        character 'z' in format\n    ewah/ewah_bitmap.c:389: warning: unknown conversion type \\\n        character 'z' in format\n    ewah/ewah_bitmap.c:389: warning: too many arguments for format\n    ewah/ewah_bitmap.c:392: warning: unknown conversion type \\\n        character 'l' in format\n    ewah/ewah_bitmap.c:392: warning: too many arguments for format\n\nIn order to suppress the warnings, use the PRIuMAX and PRIx64 macros\nfrom the <inttypes.h> header file.\n\nSigned-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n---\n ewah/ewah_bitmap.c | 6 ++++--\n 1 file changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/ewah/ewah_bitmap.c b/ewah/ewah_bitmap.c\nindex 625f5a6..1e363b9 100644\n--- a/ewah/ewah_bitmap.c\n+++ b/ewah/ewah_bitmap.c\n@@ -22,6 +22,7 @@\n #include <unistd.h>\n #include <string.h>\n #include <stdio.h>\n+#include <inttypes.h>\n \n #include \"ewok.h\"\n #include \"ewok_rlw.h\"\n@@ -386,10 +387,11 @@ void ewah_iterator_init(struct ewah_iterator *it, struct ewah_bitmap *parent)\n void ewah_dump(struct ewah_bitmap *self)\n {\n \tsize_t i;\n-\tfprintf(stderr, \"%zu bits | %zu words | \", self->bit_size, self->buffer_size);\n+\tfprintf(stderr, \"%\"PRIuMAX\" bits | %\"PRIuMAX\" words | \",\n+\t\t(uintmax_t)self->bit_size, (uintmax_t)self->buffer_size);\n \n \tfor (i = 0; i < self->buffer_size; ++i)\n-\t\tfprintf(stderr, \"%016llx \", (unsigned long long)self->buffer[i]);\n+\t\tfprintf(stderr, \"%016\"PRIx64\" \", (unsigned long long)self->buffer[i]);\n \n \tfprintf(stderr, \"\\n\");\n }\n-- \n1.8.4\n"},{"id":"230227","messageId":"xmqq7gcjq0jm.fsf@gitster.dls.corp.google.com","threadId":"35299","inReplyTo":"527C1069.1080000@ramsay1.demon.co.uk","subject":"Re: [PATCH 5/5] ewah_bitmap.c: Fix printf format warnings on MinGW","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-11-07T23:01:17Z","receivedAt":"2013-11-07T23:01:17Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:\n\n> On MinGW, gcc complains as follows:\n>\n>         CC ewah/ewah_bitmap.o\n>     ewah/ewah_bitmap.c: In function 'ewah_dump':\n>     ewah/ewah_bitmap.c:389: warning: unknown conversion type \\\n>         character 'z' in format\n>     ewah/ewah_bitmap.c:389: warning: unknown conversion type \\\n>         character 'z' in format\n>     ewah/ewah_bitmap.c:389: warning: too many arguments for format\n>     ewah/ewah_bitmap.c:392: warning: unknown conversion type \\\n>         character 'l' in format\n>     ewah/ewah_bitmap.c:392: warning: too many arguments for format\n>\n> In order to suppress the warnings, use the PRIuMAX and PRIx64 macros\n> from the <inttypes.h> header file.\n\nGood; it is in line with 28bd70d8 (unbreak and eliminate\nNO_C99_FORMAT, 2011-03-16) and 3efb1f34 (Check for PRIuMAX rather\nthan NO_C99_FORMAT in fast-import.c., 2007-02-20).\n\nThanks.\n\n\n> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n> ---\n>  ewah/ewah_bitmap.c | 6 ++++--\n>  1 file changed, 4 insertions(+), 2 deletions(-)\n>\n> diff --git a/ewah/ewah_bitmap.c b/ewah/ewah_bitmap.c\n> index 625f5a6..1e363b9 100644\n> --- a/ewah/ewah_bitmap.c\n> +++ b/ewah/ewah_bitmap.c\n> @@ -22,6 +22,7 @@\n>  #include <unistd.h>\n>  #include <string.h>\n>  #include <stdio.h>\n> +#include <inttypes.h>\n>  \n>  #include \"ewok.h\"\n>  #include \"ewok_rlw.h\"\n> @@ -386,10 +387,11 @@ void ewah_iterator_init(struct ewah_iterator *it, struct ewah_bitmap *parent)\n>  void ewah_dump(struct ewah_bitmap *self)\n>  {\n>  \tsize_t i;\n> -\tfprintf(stderr, \"%zu bits | %zu words | \", self->bit_size, self->buffer_size);\n> +\tfprintf(stderr, \"%\"PRIuMAX\" bits | %\"PRIuMAX\" words | \",\n> +\t\t(uintmax_t)self->bit_size, (uintmax_t)self->buffer_size);\n>  \n>  \tfor (i = 0; i < self->buffer_size; ++i)\n> -\t\tfprintf(stderr, \"%016llx \", (unsigned long long)self->buffer[i]);\n> +\t\tfprintf(stderr, \"%016\"PRIx64\" \", (unsigned long long)self->buffer[i]);\n>  \n>  \tfprintf(stderr, \"\\n\");\n>  }\n"}]}