public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
* [committed] Fix Wformat warnings in write_die with CC="gcc -m32"
@ 2019-01-01  0:00 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2019-01-01  0:00 UTC (permalink / raw)
  To: dwz, jakub

Hi,

Using:
...
$ 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",
                                                     ~~^
                                                     %llx
...

Fix this by using PRIx64 to print the uint64_t value.

Committed to trunk.

Thanks,
- Tom

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

2019-11-28  Tom de Vries  <tdevries@suse.de>

	* 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)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-11-28 10:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-01  0:00 [committed] Fix Wformat warnings in write_die with CC="gcc -m32" Tom de Vries

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).