• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

修訂feab6abfe23b5b1724cb3c00059254e8f1bc5225 (tree)
時間2022-10-19 22:32:22
作者Andrew Burgess <aburgess@redh...>
CommiterAndrew Burgess

Log Message

sim/iq2000: silence pointer-sign warnings

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.

Change Summary

差異

--- a/sim/iq2000/Makefile.in
+++ b/sim/iq2000/Makefile.in
@@ -37,9 +37,6 @@ ALL_CPU_CFLAGS = -DHAVE_CPU_IQ2000BF -DHAVE_CPU_IQ10BF
3737
3838 SIM_EXTRA_CLEAN = iq2000-clean
3939
40-# Some modules don't build cleanly yet.
41-iq2000.o mloop.o: SIM_WERROR_CFLAGS =
42-
4340 ## COMMON_POST_CONFIG_FRAG
4441
4542 arch = iq2000
--- a/sim/iq2000/iq2000.c
+++ b/sim/iq2000/iq2000.c
@@ -47,7 +47,8 @@ fetch_str (SIM_CPU *current_cpu, PCADDR pc, DI addr)
4747 pc, read_map, CPU2DATA(addr + nr)) != 0)
4848 nr++;
4949 buf = NZALLOC (char, nr + 1);
50- sim_read (CPU_STATE (current_cpu), CPU2DATA(addr), buf, nr);
50+ sim_read (CPU_STATE (current_cpu), CPU2DATA(addr), (unsigned char *) buf,
51+ nr);
5152 return buf;
5253 }
5354
@@ -82,7 +83,8 @@ do_syscall (SIM_CPU *current_cpu, PCADDR pc)
8283
8384 case TARGET_NEWLIB_SYS_write:
8485 buf = zalloc (PARM3);
85- sim_read (CPU_STATE (current_cpu), CPU2DATA(PARM2), buf, PARM3);
86+ sim_read (CPU_STATE (current_cpu), CPU2DATA(PARM2),
87+ (unsigned char *) buf, PARM3);
8688 SET_H_GR (ret_reg,
8789 sim_io_write (CPU_STATE (current_cpu),
8890 PARM1, buf, PARM3));
@@ -105,7 +107,8 @@ do_syscall (SIM_CPU *current_cpu, PCADDR pc)
105107 SET_H_GR (ret_reg,
106108 sim_io_read (CPU_STATE (current_cpu),
107109 PARM1, buf, PARM3));
108- sim_write (CPU_STATE (current_cpu), CPU2DATA(PARM2), buf, PARM3);
110+ sim_write (CPU_STATE (current_cpu), CPU2DATA(PARM2),
111+ (unsigned char *) buf, PARM3);
109112 free (buf);
110113 break;
111114