sim/iq2000: silence pointer-sign warnings
authorAndrew Burgess <aburgess@redhat.com>
Wed, 12 Oct 2022 11:46:42 +0000 (12:46 +0100)
committerAndrew Burgess <aburgess@redhat.com>
Wed, 19 Oct 2022 13:32:22 +0000 (14:32 +0100)
When building the iq2000 simulator I see a few warnings like this:

  /tmp/build/sim/../../src/sim/iq2000/iq2000.c: In function ‘fetch_str’:
  /tmp/build/sim/../../src/sim/iq2000/iq2000.c:50:54: error: pointer targets in passing argument 3 of ‘sim_read’ differ in signedness [-Werror=pointer-sign]
     50 |   sim_read (CPU_STATE (current_cpu), CPU2DATA(addr), buf, nr);
        |                                                      ^~~
        |                                                      |
        |                                                      char *

I've silenced these warnings by casting buf to 'unsigned char *'.
With this change I now see no warnings when compiling iq2000.c, so
I've removed the line from Makefile.in that disables -Werror.

Makefile.in was also disabling -Werror when compiling mloop.c,
however, I'm not seeing any warnings when compiling that file, so I've
removed the -Werror disable in that case too.

sim/iq2000/Makefile.in
sim/iq2000/iq2000.c

index 9f64adcecb4ff55e41b7e62e03176e872ec2c2db..757ed28ef6bc9e077b066e4c7160d757317ec53f 100644 (file)
@@ -37,9 +37,6 @@ ALL_CPU_CFLAGS = -DHAVE_CPU_IQ2000BF -DHAVE_CPU_IQ10BF
 
 SIM_EXTRA_CLEAN = iq2000-clean
 
-# Some modules don't build cleanly yet.
-iq2000.o mloop.o: SIM_WERROR_CFLAGS =
-
 ## COMMON_POST_CONFIG_FRAG
 
 arch = iq2000
index b685a31b07a5ee3827d1a439cf4581be5a7f0c1d..2c01434c308c5e562c179f83b3c8dd77c48abc89 100644 (file)
@@ -47,7 +47,8 @@ fetch_str (SIM_CPU *current_cpu, PCADDR pc, DI addr)
                           pc, read_map, CPU2DATA(addr + nr)) != 0)
     nr++;
   buf = NZALLOC (char, nr + 1);
-  sim_read (CPU_STATE (current_cpu), CPU2DATA(addr), buf, nr);
+  sim_read (CPU_STATE (current_cpu), CPU2DATA(addr), (unsigned char *) buf,
+           nr);
   return buf;
 }
 
@@ -82,7 +83,8 @@ do_syscall (SIM_CPU *current_cpu, PCADDR pc)
 
     case TARGET_NEWLIB_SYS_write:
       buf = zalloc (PARM3);
-      sim_read (CPU_STATE (current_cpu), CPU2DATA(PARM2), buf, PARM3);
+      sim_read (CPU_STATE (current_cpu), CPU2DATA(PARM2),
+               (unsigned char *) buf, PARM3);
       SET_H_GR (ret_reg,
                sim_io_write (CPU_STATE (current_cpu),
                              PARM1, buf, PARM3));
@@ -105,7 +107,8 @@ do_syscall (SIM_CPU *current_cpu, PCADDR pc)
       SET_H_GR (ret_reg,
                sim_io_read (CPU_STATE (current_cpu),
                             PARM1, buf, PARM3));
-      sim_write (CPU_STATE (current_cpu), CPU2DATA(PARM2), buf, PARM3);
+      sim_write (CPU_STATE (current_cpu), CPU2DATA(PARM2),
+                (unsigned char *) buf, PARM3);
       free (buf);
       break;