public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] sim/iq2000: silence pointer-sign warnings
Date: Wed, 19 Oct 2022 13:33:08 +0000 (GMT)	[thread overview]
Message-ID: <20221019133308.44A4A3858D39@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=feab6abfe23b5b1724cb3c00059254e8f1bc5225

commit feab6abfe23b5b1724cb3c00059254e8f1bc5225
Author: Andrew Burgess <aburgess@redhat.com>
Date:   Wed Oct 12 12:46:42 2022 +0100

    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.

Diff:
---
 sim/iq2000/Makefile.in | 3 ---
 sim/iq2000/iq2000.c    | 9 ++++++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/sim/iq2000/Makefile.in b/sim/iq2000/Makefile.in
index 9f64adcecb4..757ed28ef6b 100644
--- a/sim/iq2000/Makefile.in
+++ b/sim/iq2000/Makefile.in
@@ -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
diff --git a/sim/iq2000/iq2000.c b/sim/iq2000/iq2000.c
index b685a31b07a..2c01434c308 100644
--- a/sim/iq2000/iq2000.c
+++ b/sim/iq2000/iq2000.c
@@ -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;

                 reply	other threads:[~2022-10-19 13:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20221019133308.44A4A3858D39@sourceware.org \
    --to=aburgess@sourceware.org \
    --cc=gdb-cvs@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).