public inbox for
 help / color / mirror / Atom feed
From: Tom de Vries <>
Subject: [committed] Fix Wformat warnings in write_die with CC="gcc -m32"
Date: Tue, 01 Jan 2019 00:00:00 -0000	[thread overview]
Message-ID: <20191128103927.GA11594@delia> (raw)


$ make CC="gcc -m32"
we run into this warning:
gcc -m32 -O2 -g -Wall -W -D_FILE_OFFSET_BITS=64 -DDWZ_VERSION='"0.13"' \
  -DFSF_YEARS='"1992-2019"' -DRH_YEARS='"2001-2018"' -DSUSE_YEARS='"2019"' \
  -c -o dwz.o /data/dwz/dwz.git/dwz.c
dwz.c: In function 'write_die':
dwz.c:9463:55: warning: format '%lx' expects argument of type \
  'long unsigned int', but argument 4 has type \
  'uint64_t {aka long long unsigned int}' [-Wformat=]
     "Couldn't find DIE at DW_FORM_ref_addr offset 0x%lx",

Fix this by using PRIx64 to print the uint64_t value.

Committed to trunk.

- Tom

Fix Wformat warnings in write_die with CC="gcc -m32"

2019-11-28  Tom de Vries  <>

	* dwz.c: Include inttypes.h to provide PRIx64.
	(write_die): Use PRIx64 to fix Wformat warning.

 dwz.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/dwz.c b/dwz.c
index 5cf05f8..93fc9de 100644
--- a/dwz.c
+++ b/dwz.c
@@ -28,6 +28,7 @@
 #include <stdbool.h>
 #include <stddef.h>
 #include <stdint.h>
+#include <inttypes.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <sys/mman.h>
@@ -9459,9 +9460,8 @@ write_die (unsigned char *ptr, dw_cu_ref cu, dw_die_ref die,
 		inptr += refcu->cu_version == 2 ? ptr_size : 4;
 		refd = off_htab_lookup (NULL, value);
 		if (refd == NULL || refd->die_tag == 0)
-		  error (1, 0,
-			 "Couldn't find DIE at DW_FORM_ref_addr offset 0x%lx",
-			 value);
+		  error (1, 0, "Couldn't find DIE at DW_FORM_ref_addr offset"
+			 " 0x%" PRIx64, value);
 		assert (refd != NULL);
 		refdt = refd;
 		while (refdt->die_toplevel == 0)

                 reply	other threads:[~2019-11-28 10:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191128103927.GA11594@delia \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).