sim: ppc: fix Wpointer-sign warning
authorTom de Vries <tdevries@suse.de>
Thu, 20 May 2021 11:58:35 +0000 (13:58 +0200)
committerTom de Vries <tdevries@suse.de>
Thu, 20 May 2021 11:58:35 +0000 (13:58 +0200)
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

index 09c331c3295b482dd942350c338bfc26cf5343da..46b22f7b6e3370469b5337e5162351415614779e 100644 (file)
@@ -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");