* [PATCH] sim/microblaze/interp.c: Use long int format instead of int to avoid compiling warnings @ 2014-07-01 0:15 Chen Gang 2014-07-01 0:43 ` Michael Eager 2014-08-02 17:21 ` Mike Frysinger 0 siblings, 2 replies; 7+ messages in thread From: Chen Gang @ 2014-07-01 0:15 UTC (permalink / raw) To: eager; +Cc: vapier, cgen, binutils, gdb-patches The related warnings (cross compile microblaze-linux-elf): ../../../binutils-gdb/sim/microblaze/interp.c: In function ‘microblaze_extract_unsigned_integer’: ../../../binutils-gdb/sim/microblaze/interp.c:53:6: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat] ../../../binutils-gdb/sim/microblaze/interp.c: In function ‘sim_size’: ../../../binutils-gdb/sim/microblaze/interp.c:329:4: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long unsigned int’ [-Wformat] ../../../binutils-gdb/sim/microblaze/interp.c: In function ‘set_initial_gprs’: ../../../binutils-gdb/sim/microblaze/interp.c:360:7: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long unsigned int’ [-Wformat] ../../../binutils-gdb/sim/microblaze/interp.c:360:7: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘long unsigned int’ [-Wformat] Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com> --- sim/ChangeLog | 5 +++++ sim/microblaze/interp.c | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/sim/ChangeLog b/sim/ChangeLog index 35d0920..03c244b 100644 --- a/sim/ChangeLog +++ b/sim/ChangeLog @@ -1,3 +1,8 @@ +2014-07-01 Chen Gang <gang.chen.5i5j@gmail.com> + + * sim/microblaze/interp.c: Use long int format instead of int + format to avoid compiling warnings. + 2014-03-12 Nick Clifton <nickc@redhat.com> * MAINTAINERS: Add myself as the maintainer for the MSP430. diff --git a/sim/microblaze/interp.c b/sim/microblaze/interp.c index cc61278..e92a1d0 100644 --- a/sim/microblaze/interp.c +++ b/sim/microblaze/interp.c @@ -50,7 +50,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 " - "%d bytes.", sizeof (unsigned long)); + "%ld bytes.", sizeof (unsigned long)); /* Start at the most significant end of the integer, and work towards the least significant. */ @@ -325,7 +325,7 @@ sim_size (int size) { if (issue_messages) fprintf (stderr, - "Not enough VM for simulation of %d bytes of RAM\n", + "Not enough VM for simulation of %ld bytes of RAM\n", CPU.msize); CPU.msize = 1; @@ -356,7 +356,7 @@ set_initial_gprs () memsize = CPU.msize / (1024 * 1024); if (issue_messages > 1) - fprintf (stderr, "Simulated memory of %d Mbytes (0x0 .. 0x%08x)\n", + fprintf (stderr, "Simulated memory of %ld Mbytes (0x0 .. 0x%08lx)\n", memsize, CPU.msize - 1); /* Clean out the GPRs */ -- 1.9.2.459.g68773ac ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] sim/microblaze/interp.c: Use long int format instead of int to avoid compiling warnings 2014-07-01 0:15 [PATCH] sim/microblaze/interp.c: Use long int format instead of int to avoid compiling warnings Chen Gang @ 2014-07-01 0:43 ` Michael Eager 2014-07-01 1:08 ` Chen Gang 2014-08-02 17:21 ` Mike Frysinger 1 sibling, 1 reply; 7+ messages in thread From: Michael Eager @ 2014-07-01 0:43 UTC (permalink / raw) To: Chen Gang; +Cc: vapier, cgen, binutils, gdb-patches On 06/30/14 17:14, Chen Gang wrote: > The related warnings (cross compile microblaze-linux-elf): > > ../../../binutils-gdb/sim/microblaze/interp.c: In function ‘microblaze_extract_unsigned_integer’: > ../../../binutils-gdb/sim/microblaze/interp.c:53:6: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat] > ../../../binutils-gdb/sim/microblaze/interp.c: In function ‘sim_size’: > ../../../binutils-gdb/sim/microblaze/interp.c:329:4: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long unsigned int’ [-Wformat] > ../../../binutils-gdb/sim/microblaze/interp.c: In function ‘set_initial_gprs’: > ../../../binutils-gdb/sim/microblaze/interp.c:360:7: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long unsigned int’ [-Wformat] > ../../../binutils-gdb/sim/microblaze/interp.c:360:7: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘long unsigned int’ [-Wformat] > > > Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com> > --- > sim/ChangeLog | 5 +++++ > sim/microblaze/interp.c | 6 +++--- > 2 files changed, 8 insertions(+), 3 deletions(-) > > diff --git a/sim/ChangeLog b/sim/ChangeLog > index 35d0920..03c244b 100644 > --- a/sim/ChangeLog > +++ b/sim/ChangeLog > @@ -1,3 +1,8 @@ > +2014-07-01 Chen Gang <gang.chen.5i5j@gmail.com> > + > + * sim/microblaze/interp.c: Use long int format instead of int > + format to avoid compiling warnings. > + > 2014-03-12 Nick Clifton <nickc@redhat.com> > > * MAINTAINERS: Add myself as the maintainer for the MSP430. Please put your ChangeLog in the email, not in a patch. > diff --git a/sim/microblaze/interp.c b/sim/microblaze/interp.c > index cc61278..e92a1d0 100644 > --- a/sim/microblaze/interp.c > +++ b/sim/microblaze/interp.c > @@ -50,7 +50,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 " > - "%d bytes.", sizeof (unsigned long)); > + "%ld bytes.", sizeof (unsigned long)); > > /* Start at the most significant end of the integer, and work towards > the least significant. */ > @@ -325,7 +325,7 @@ sim_size (int size) > { > if (issue_messages) > fprintf (stderr, > - "Not enough VM for simulation of %d bytes of RAM\n", > + "Not enough VM for simulation of %ld bytes of RAM\n", > CPU.msize); > > CPU.msize = 1; > @@ -356,7 +356,7 @@ set_initial_gprs () > memsize = CPU.msize / (1024 * 1024); > > if (issue_messages > 1) > - fprintf (stderr, "Simulated memory of %d Mbytes (0x0 .. 0x%08x)\n", > + fprintf (stderr, "Simulated memory of %ld Mbytes (0x0 .. 0x%08lx)\n", > memsize, CPU.msize - 1); > > /* Clean out the GPRs */ Commit ba8e7d1e2. -- Michael Eager eager@eagercon.com 1960 Park Blvd., Palo Alto, CA 94306 650-325-8077 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] sim/microblaze/interp.c: Use long int format instead of int to avoid compiling warnings 2014-07-01 0:43 ` Michael Eager @ 2014-07-01 1:08 ` Chen Gang 2014-07-01 1:11 ` Michael Eager 0 siblings, 1 reply; 7+ messages in thread From: Chen Gang @ 2014-07-01 1:08 UTC (permalink / raw) To: Michael Eager; +Cc: vapier, cgen, binutils, gdb-patches On 07/01/2014 08:43 AM, Michael Eager wrote: > On 06/30/14 17:14, Chen Gang wrote: >> The related warnings (cross compile microblaze-linux-elf): >> >> ../../../binutils-gdb/sim/microblaze/interp.c: In function >> âmicroblaze_extract_unsigned_integerâ: >> ../../../binutils-gdb/sim/microblaze/interp.c:53:6: warning: format >> â%dâ expects argument of type âintâ, but argument 2 has type âlong >> unsigned intâ [-Wformat] >> ../../../binutils-gdb/sim/microblaze/interp.c: In function âsim_sizeâ: >> ../../../binutils-gdb/sim/microblaze/interp.c:329:4: warning: >> format â%dâ expects argument of type âintâ, but argument 3 has type >> âlong unsigned intâ [-Wformat] >> ../../../binutils-gdb/sim/microblaze/interp.c: In function >> âset_initial_gprsâ: >> ../../../binutils-gdb/sim/microblaze/interp.c:360:7: warning: >> format â%dâ expects argument of type âintâ, but argument 3 has type >> âlong unsigned intâ [-Wformat] >> ../../../binutils-gdb/sim/microblaze/interp.c:360:7: warning: >> format â%xâ expects argument of type âunsigned intâ, but argument 4 >> has type âlong unsigned intâ [-Wformat] >> >> >> Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com> >> --- >> sim/ChangeLog | 5 +++++ >> sim/microblaze/interp.c | 6 +++--- >> 2 files changed, 8 insertions(+), 3 deletions(-) >> >> diff --git a/sim/ChangeLog b/sim/ChangeLog >> index 35d0920..03c244b 100644 >> --- a/sim/ChangeLog >> +++ b/sim/ChangeLog >> @@ -1,3 +1,8 @@ >> +2014-07-01 Chen Gang <gang.chen.5i5j@gmail.com> >> + >> + * sim/microblaze/interp.c: Use long int format instead of int >> + format to avoid compiling warnings. >> + >> 2014-03-12 Nick Clifton <nickc@redhat.com> >> >> * MAINTAINERS: Add myself as the maintainer for the MSP430. > > Please put your ChangeLog in the email, not in a patch. OK, thanks. I shall notice about it next time. If necessary to send patch v2 for it, please let me know. > >> diff --git a/sim/microblaze/interp.c b/sim/microblaze/interp.c >> index cc61278..e92a1d0 100644 >> --- a/sim/microblaze/interp.c >> +++ b/sim/microblaze/interp.c >> @@ -50,7 +50,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 " >> - "%d bytes.", sizeof (unsigned long)); >> + "%ld bytes.", sizeof (unsigned long)); >> >> /* Start at the most significant end of the integer, and work towards >> the least significant. */ >> @@ -325,7 +325,7 @@ sim_size (int size) >> { >> if (issue_messages) >> fprintf (stderr, >> - "Not enough VM for simulation of %d bytes of RAM\n", >> + "Not enough VM for simulation of %ld bytes of RAM\n", >> CPU.msize); >> >> CPU.msize = 1; >> @@ -356,7 +356,7 @@ set_initial_gprs () >> memsize = CPU.msize / (1024 * 1024); >> >> if (issue_messages > 1) >> - fprintf (stderr, "Simulated memory of %d Mbytes (0x0 .. 0x%08x)\n", >> + fprintf (stderr, "Simulated memory of %ld Mbytes (0x0 .. >> 0x%08lx)\n", >> memsize, CPU.msize - 1); >> >> /* Clean out the GPRs */ > > > Commit ba8e7d1e2. Excuse me, I do not quite undersand the meaning. I guess it means: "have applied this patch, and its' commit number is ba8e7d1e2...", If what I guess is incorrect, please let me know, and I shall send patch v2 for it. Thanks. -- Chen Gang Open, share, and attitude like air, water, and life which God blessed ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] sim/microblaze/interp.c: Use long int format instead of int to avoid compiling warnings 2014-07-01 1:08 ` Chen Gang @ 2014-07-01 1:11 ` Michael Eager 0 siblings, 0 replies; 7+ messages in thread From: Michael Eager @ 2014-07-01 1:11 UTC (permalink / raw) To: Chen Gang; +Cc: vapier, cgen, binutils, gdb-patches On 06/30/14 18:07, Chen Gang wrote: > On 07/01/2014 08:43 AM, Michael Eager wrote: >> On 06/30/14 17:14, Chen Gang wrote: >>> The related warnings (cross compile microblaze-linux-elf): >>> >>> ../../../binutils-gdb/sim/microblaze/interp.c: In function >>> ‘microblaze_extract_unsigned_integer’: >>> ../../../binutils-gdb/sim/microblaze/interp.c:53:6: warning: format >>> ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long >>> unsigned int’ [-Wformat] >>> ../../../binutils-gdb/sim/microblaze/interp.c: In function ‘sim_size’: >>> ../../../binutils-gdb/sim/microblaze/interp.c:329:4: warning: >>> format ‘%d’ expects argument of type ‘int’, but argument 3 has type >>> ‘long unsigned int’ [-Wformat] >>> ../../../binutils-gdb/sim/microblaze/interp.c: In function >>> ‘set_initial_gprs’: >>> ../../../binutils-gdb/sim/microblaze/interp.c:360:7: warning: >>> format ‘%d’ expects argument of type ‘int’, but argument 3 has type >>> ‘long unsigned int’ [-Wformat] >>> ../../../binutils-gdb/sim/microblaze/interp.c:360:7: warning: >>> format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 >>> has type ‘long unsigned int’ [-Wformat] >>> >>> >>> Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com> >>> --- >>> sim/ChangeLog | 5 +++++ >>> sim/microblaze/interp.c | 6 +++--- >>> 2 files changed, 8 insertions(+), 3 deletions(-) >>> >>> diff --git a/sim/ChangeLog b/sim/ChangeLog >>> index 35d0920..03c244b 100644 >>> --- a/sim/ChangeLog >>> +++ b/sim/ChangeLog >>> @@ -1,3 +1,8 @@ >>> +2014-07-01 Chen Gang <gang.chen.5i5j@gmail.com> >>> + >>> + * sim/microblaze/interp.c: Use long int format instead of int >>> + format to avoid compiling warnings. >>> + >>> 2014-03-12 Nick Clifton <nickc@redhat.com> >>> >>> * MAINTAINERS: Add myself as the maintainer for the MSP430. >> >> Please put your ChangeLog in the email, not in a patch. > > OK, thanks. I shall notice about it next time. If necessary to send > patch v2 for it, please let me know. > >> >>> diff --git a/sim/microblaze/interp.c b/sim/microblaze/interp.c >>> index cc61278..e92a1d0 100644 >>> --- a/sim/microblaze/interp.c >>> +++ b/sim/microblaze/interp.c >>> @@ -50,7 +50,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 " >>> - "%d bytes.", sizeof (unsigned long)); >>> + "%ld bytes.", sizeof (unsigned long)); >>> >>> /* Start at the most significant end of the integer, and work towards >>> the least significant. */ >>> @@ -325,7 +325,7 @@ sim_size (int size) >>> { >>> if (issue_messages) >>> fprintf (stderr, >>> - "Not enough VM for simulation of %d bytes of RAM\n", >>> + "Not enough VM for simulation of %ld bytes of RAM\n", >>> CPU.msize); >>> >>> CPU.msize = 1; >>> @@ -356,7 +356,7 @@ set_initial_gprs () >>> memsize = CPU.msize / (1024 * 1024); >>> >>> if (issue_messages > 1) >>> - fprintf (stderr, "Simulated memory of %d Mbytes (0x0 .. 0x%08x)\n", >>> + fprintf (stderr, "Simulated memory of %ld Mbytes (0x0 .. >>> 0x%08lx)\n", >>> memsize, CPU.msize - 1); >>> >>> /* Clean out the GPRs */ >> >> >> Commit ba8e7d1e2. > > Excuse me, I do not quite undersand the meaning. I guess it means: > > "have applied this patch, and its' commit number is ba8e7d1e2...", That's correct. The patch has been committed as an obvious fix. -- Michael Eager eager@eagercon.com 1960 Park Blvd., Palo Alto, CA 94306 650-325-8077 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] sim/microblaze/interp.c: Use long int format instead of int to avoid compiling warnings 2014-07-01 0:15 [PATCH] sim/microblaze/interp.c: Use long int format instead of int to avoid compiling warnings Chen Gang 2014-07-01 0:43 ` Michael Eager @ 2014-08-02 17:21 ` Mike Frysinger 2015-03-08 7:24 ` Mike Frysinger 1 sibling, 1 reply; 7+ messages in thread From: Mike Frysinger @ 2014-08-02 17:21 UTC (permalink / raw) To: Chen Gang, gdb-patches; +Cc: eager [-- Attachment #1: Type: text/plain, Size: 548 bytes --] 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. -mike [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] sim/microblaze/interp.c: Use long int format instead of int to avoid compiling warnings 2014-08-02 17:21 ` Mike Frysinger @ 2015-03-08 7:24 ` Mike Frysinger 2015-03-08 21:22 ` Chen Gang 0 siblings, 1 reply; 7+ messages in thread From: Mike Frysinger @ 2015-03-08 7:24 UTC (permalink / raw) To: Chen Gang, gdb-patches; +Cc: eager [-- 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 --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] sim/microblaze/interp.c: Use long int format instead of int to avoid compiling warnings 2015-03-08 7:24 ` Mike Frysinger @ 2015-03-08 21:22 ` Chen Gang 0 siblings, 0 replies; 7+ messages in thread From: Chen Gang @ 2015-03-08 21:22 UTC (permalink / raw) To: Chen Gang, gdb-patches, eager On 3/8/15 15:24, Mike Frysinger wrote: > > i've committed this now > -mike > Thank you for your work. I shall try to make another patches for binutils/gdb within this month. (before 2015-03-15, I am mainly focus on Linux kernel and qemu, after 2015-03-15, I am mainly focus on gcc/binutils). Thanks. > 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. */ > -- Chen Gang Open, share, and attitude like air, water, and life which God blessed ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-03-08 21:22 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2014-07-01 0:15 [PATCH] sim/microblaze/interp.c: Use long int format instead of int to avoid compiling warnings 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 2015-03-08 21:22 ` Chen Gang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox