public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org, andrew.burgess@embecosm.com
Subject: Re: [PATCH] sim: ppc: fix some Wpointer-sign warnings
Date: Thu, 20 May 2021 13:59:34 +0200	[thread overview]
Message-ID: <4a3cbd46-ce48-44f5-7d82-309c6257c8df@suse.de> (raw)
In-Reply-To: <YKU9gkJQzwr2ydJm@vapier>

[-- Attachment #1: Type: text/plain, Size: 558 bytes --]

On 5/19/21 6:32 PM, Mike Frysinger wrote:
> On 19 May 2021 12:46, Tom de Vries wrote:
>> --- a/sim/ppc/hw_memory.c
>> +++ b/sim/ppc/hw_memory.c
>> @@ -190,7 +190,7 @@ hw_memory_init_address(device *me)
>>    if (device_find_property(me, "available") != NULL) {
>>      hw_memory_chunk **curr_chunk = &hw_memory->heap;
>>      int cell_nr;
>> -    unsigned_cell dummy;
>> +    signed_cell dummy;
>>      int nr_cells = device_find_integer_array_property(me, "available", 0, &dummy);
> 
> this one is fine
> 

Committed separately, as attached.

Thanks,
- Tom

[-- Attachment #2: 0001-sim-ppc-fix-Wpointer-sign-warning.patch --]
[-- Type: text/x-patch, Size: 1217 bytes --]

sim: ppc: fix Wpointer-sign warning

When compiling with --enable-werror and CFLAGS="-O0 -g -Wall", we run into:
...
src/sim/ppc/hw_memory.c: In function 'hw_memory_init_address':
src/sim/ppc/hw_memory.c:194:75: error: pointer targets in passing \
  argument 4 of 'device_find_integer_array_property' differ in signedness \
  [-Werror=pointer-sign]
     int nr_cells
       = device_find_integer_array_property(me, "available", 0, &dummy);
                                                                ^
...

Fix this by changing the type of dummy.

---
 sim/ppc/hw_memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sim/ppc/hw_memory.c b/sim/ppc/hw_memory.c
index 09c331c3295..46b22f7b6e3 100644
--- a/sim/ppc/hw_memory.c
+++ b/sim/ppc/hw_memory.c
@@ -190,7 +190,7 @@ hw_memory_init_address(device *me)
   if (device_find_property(me, "available") != NULL) {
     hw_memory_chunk **curr_chunk = &hw_memory->heap;
     int cell_nr;
-    unsigned_cell dummy;
+    signed_cell dummy;
     int nr_cells = device_find_integer_array_property(me, "available", 0, &dummy);
     if ((nr_cells % 2) != 0)
       device_error(me, "property \"available\" invalid - contains an odd number of cells");

  reply	other threads:[~2021-05-20 11:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-19 10:46 Tom de Vries
2021-05-19 16:32 ` Mike Frysinger
2021-05-20 11:59   ` Tom de Vries [this message]
2021-05-20 12:08   ` Tom de Vries
2021-09-09  3:17   ` Mike Frysinger

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=4a3cbd46-ce48-44f5-7d82-309c6257c8df@suse.de \
    --to=tdevries@suse.de \
    --cc=andrew.burgess@embecosm.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).