Message ID | 53B1FD76.7030500@gmail.com |
---|---|
State | Committed |
Headers |
Received: (qmail 29596 invoked by alias); 1 Jul 2014 00:15:18 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 29563 invoked by uid 89); 1 Jul 2014 00:15:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 3 recipients X-HELO: mail-pa0-f44.google.com Received: from mail-pa0-f44.google.com (HELO mail-pa0-f44.google.com) (209.85.220.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 01 Jul 2014 00:15:13 +0000 Received: by mail-pa0-f44.google.com with SMTP id rd3so9537263pab.31 for <multiple recipients>; Mon, 30 Jun 2014 17:15:11 -0700 (PDT) X-Received: by 10.68.197.195 with SMTP id iw3mr56597128pbc.139.1404173711078; Mon, 30 Jun 2014 17:15:11 -0700 (PDT) Received: from [192.168.1.23] ([124.127.118.42]) by mx.google.com with ESMTPSA id lq6sm106863436pab.48.2014.06.30.17.15.08 for <multiple recipients> (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 30 Jun 2014 17:15:10 -0700 (PDT) Message-ID: <53B1FD76.7030500@gmail.com> Date: Tue, 01 Jul 2014 08:14:46 +0800 From: Chen Gang <gang.chen.5i5j@gmail.com> User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: eager@eagercon.com CC: vapier@gentoo.org, cgen@sourceware.org, binutils@sourceware.org, gdb-patches@sourceware.org Subject: [PATCH] sim/microblaze/interp.c: Use long int format instead of int to avoid compiling warnings Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit |
Commit Message
Chen Gang
July 1, 2014, 12:14 a.m. UTC
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(-)
Comments
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.
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.
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.
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
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 */