public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: dwz@sourceware.org, jakub@redhat.com
Subject: [committed] Fix Wformat warnings with make CC="gcc -m32"
Date: Tue, 01 Jan 2019 00:00:00 -0000	[thread overview]
Message-ID: <20190704093617.GA4741@delia> (raw)

Hi,

We see this warning (and similar) with make CC="gcc -m32":
...
dwz.c: In function ‘calculate_section_distance’:
dwz.c:10517:47: warning: format ‘%lx’ expects argument of \
  type ‘long unsigned int’, but argument 4 has \
  type ‘GElf_Off {aka long long unsigned int}’ [-Wformat=]
      error (0, 0, "Section header table: [0x%lx, 0x%ld)", prev_offset,
...

Fix this by using %llx and casting the argument to unsigned long long.

Committed to trunk.

Thanks,
- Tom

Fix Wformat warnings with make CC="gcc -m32"

2019-07-04  Tom de Vries  <tdevries@suse.de>

	PR dwz/24765
	* dwz.c (calculate_section_distance): Fix Wformat warnings.

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

diff --git a/dwz.c b/dwz.c
index 19e8f10..f854c66 100644
--- a/dwz.c
+++ b/dwz.c
@@ -10514,15 +10514,18 @@ calculate_section_distance (DSO *dso, unsigned int *sorted_section_numbers,
 	{
 	  error (0, 0, "Section overlap detected");
 	  if (prev == dso->ehdr.e_shnum)
-	    error (0, 0, "Section header table: [0x%lx, 0x%ld)", prev_offset,
-		   prev_offset + prev_size);
+	    error (0, 0, "Section header table: [0x%llx, 0x%lld)",
+		   (unsigned long long)prev_offset,
+		   (unsigned long long)(prev_offset + prev_size));
 	  else
-	    error (0, 0, "Section %d: [0x%lx, 0x%ld)", j, prev_offset,
-		   prev_offset + prev_size);
+	    error (0, 0, "Section %d: [0x%llx, 0x%lld)", j,
+		   (unsigned long long)prev_offset,
+		   (unsigned long long)(prev_offset + prev_size));
 	  if (j == dso->ehdr.e_shnum)
-	    error (0, 0, "Section header table: 0x%lx", offset);
+	    error (0, 0, "Section header table: 0x%llx",
+		   (unsigned long long)offset);
 	  else
-	    error (0, 0, "Section %d: 0x%lx", j, offset);
+	    error (0, 0, "Section %d: 0x%llx", j, (unsigned long long)offset);
 	  return 1;
 	}
 

                 reply	other threads:[~2019-07-04  9:36 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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=20190704093617.GA4741@delia \
    --to=tdevries@suse.de \
    --cc=dwz@sourceware.org \
    --cc=jakub@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

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