[PATCH] svndump.c: Fix a printf format compiler warning

Subsystems: the rest

STALE3752d

3 messages, 2 authors, 2016-06-15 · open the first message on its own page

[PATCH] svndump.c: Fix a printf format compiler warning

From: Ramsay Jones <hidden>
Date: 2016-06-15 22:50:22

In particular, on systems that define uint32_t as an unsigned long,
gcc complains as follows:

        CC vcs-svn/svndump.o
    vcs-svn/svndump.c: In function `svndump_read':
    vcs-svn/svndump.c:215: warning: int format, uint32_t arg (arg 2)

In order to suppress the warning we use the C99 format specifier
macro PRIu32 from <inttypes.h>.

Signed-off-by: Ramsay Jones <redacted>
---
 vcs-svn/svndump.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c
index fa580e6..2ad2c30 100644
--- a/vcs-svn/svndump.c
+++ b/vcs-svn/svndump.c
@@ -211,7 +211,7 @@ void svndump_read(const char *url)
 		if (key == keys.svn_fs_dump_format_version) {
 			dump_ctx.version = atoi(val);
 			if (dump_ctx.version > 2)
-				die("expected svn dump format version <= 2, found %d",
+				die("expected svn dump format version <= 2, found %"PRIu32,
 				    dump_ctx.version);
 		} else if (key == keys.uuid) {
 			dump_ctx.uuid = pool_intern(val);
-- 
1.7.3

Re: [PATCH] svndump.c: Fix a printf format compiler warning

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:50:22

Ramsay Jones wrote:
quoted hunk
--- a/vcs-svn/svndump.c
+++ b/vcs-svn/svndump.c
@@ -211,7 +211,7 @@ void svndump_read(const char *url)
 		if (key == keys.svn_fs_dump_format_version) {
 			dump_ctx.version = atoi(val);
 			if (dump_ctx.version > 2)
-				die("expected svn dump format version <= 2, found %d",
+				die("expected svn dump format version <= 2, found %"PRIu32,
 				    dump_ctx.version);
Acked-by: Jonathan Nieder <redacted>

I think we should just use "int", but that is a wider sweeping change
for another time.  Thanks.

Does gcc or sparse provide a warning that could have caught this
mistake?

Re: [PATCH] svndump.c: Fix a printf format compiler warning

From: Ramsay Jones <hidden>
Date: 2016-06-15 22:50:25

Jonathan Nieder wrote:
Ramsay Jones wrote:
quoted
--- a/vcs-svn/svndump.c
+++ b/vcs-svn/svndump.c
@@ -211,7 +211,7 @@ void svndump_read(const char *url)
 		if (key == keys.svn_fs_dump_format_version) {
 			dump_ctx.version = atoi(val);
 			if (dump_ctx.version > 2)
-				die("expected svn dump format version <= 2, found %d",
+				die("expected svn dump format version <= 2, found %"PRIu32,
 				    dump_ctx.version);
Acked-by: Jonathan Nieder <redacted>
Thanks!
I think we should just use "int", but that is a wider sweeping change
for another time.  Thanks.

Does gcc or sparse provide a warning that could have caught this
mistake?
None that I know of, no ... :(

ATB,
Ramsay Jones
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help