From: Mike Frysinger <vapier@gentoo.org>
To: Chen Gang <gang.chen.5i5j@gmail.com>, gdb-patches@sourceware.org
Cc: eager@eagercon.com
Subject: Re: [PATCH] sim/microblaze/interp.c: Use long int format instead of int to avoid compiling warnings
Date: Sun, 08 Mar 2015 07:24:00 -0000 [thread overview]
Message-ID: <20150308072453.GV12857@vapier> (raw)
In-Reply-To: <1444359.20hJbUDvYc@vapier>
[-- Attachment #1: Type: text/plain, Size: 2039 bytes --]
On 02 Aug 2014 13:21, Mike Frysinger wrote:
> On Tue 01 Jul 2014 08:14:46 Chen Gang wrote:
>
> sim patches only go to gdb-patches, so don't include cgen/binutils in the
> future please
>
> > --- a/sim/microblaze/interp.c
> > +++ b/sim/microblaze/interp.c
> >
> > if (len > (int) sizeof (unsigned long))
> > printf ("That operation is not available on integers of more than "
> > - "%d bytes.", sizeof (unsigned long));
> > + "%ld bytes.", sizeof (unsigned long));
>
> unfortunately, i don't believe this is correct. pretty sure the right answer
> is %zu as sizeof() is a size_t.
i've committed this now
-mike
From 3e95021c775db2c483e87033ebef3d42ff99c7e0 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Sun, 8 Mar 2015 03:24:03 -0400
Subject: [PATCH] sim: microblaze: fix printf string
Since sizeof returns a size_t, use %zu to display it.
---
sim/microblaze/ChangeLog | 4 ++++
sim/microblaze/interp.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/sim/microblaze/ChangeLog b/sim/microblaze/ChangeLog
index 0a068ff..e34a21d 100644
--- a/sim/microblaze/ChangeLog
+++ b/sim/microblaze/ChangeLog
@@ -1,3 +1,7 @@
+2015-03-08 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c (microblaze_extract_unsigned_integer): Change %ld to %zu.
+
2015-02-20 Mike Frysinger <vapier@gentoo.org>
* interp.c: Delete sysdep.h and netinet/in.h includes.
diff --git a/sim/microblaze/interp.c b/sim/microblaze/interp.c
index 64850ef..ac2adb8 100644
--- a/sim/microblaze/interp.c
+++ b/sim/microblaze/interp.c
@@ -51,7 +51,7 @@ microblaze_extract_unsigned_integer (unsigned char *addr, int len)
if (len > (int) sizeof (unsigned long))
printf ("That operation is not available on integers of more than "
- "%ld bytes.", sizeof (unsigned long));
+ "%zu bytes.", sizeof (unsigned long));
/* Start at the most significant end of the integer, and work towards
the least significant. */
--
2.3.1
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-03-08 7:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-01 0:15 Chen Gang
2014-07-01 0:43 ` Michael Eager
2014-07-01 1:08 ` Chen Gang
2014-07-01 1:11 ` Michael Eager
2014-08-02 17:21 ` Mike Frysinger
2015-03-08 7:24 ` Mike Frysinger [this message]
2015-03-08 21:22 ` Chen Gang
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=20150308072453.GV12857@vapier \
--to=vapier@gentoo.org \
--cc=eager@eagercon.com \
--cc=gang.chen.5i5j@gmail.com \
--cc=gdb-patches@sourceware.org \
/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