public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] sim: d10v: fix build warnings
@ 2021-04-19  1:16 Michael Frysinger
  0 siblings, 0 replies; only message in thread
From: Michael Frysinger @ 2021-04-19  1:16 UTC (permalink / raw)
  To: gdb-cvs

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

commit d3b0ab8b36319f4232367b046ecfc0c656a177ad
Author: Mike Frysinger <vapier@gentoo.org>
Date:   Sun Apr 18 21:13:34 2021 -0400

    sim: d10v: fix build warnings
    
    The printf fix uses our PRIxTA for our sim address type.
    
    Then cast away the const (since the underlying code safely treats it
    as such) even if it's ugly.
    
    Finally touch up the argv iterator pointer to match the new func arg.
    
    With this tidied up, we can delete the SIM_AC_OPTION_WARNINGS(no) call
    to get the default common behavior where -Werror is enabled.

Diff:
---
 sim/d10v/ChangeLog    | 8 ++++++++
 sim/d10v/configure    | 5 ++++-
 sim/d10v/configure.ac | 1 -
 sim/d10v/interp.c     | 8 +++++---
 4 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/sim/d10v/ChangeLog b/sim/d10v/ChangeLog
index e05746f6f15..0d5e8771d3e 100644
--- a/sim/d10v/ChangeLog
+++ b/sim/d10v/ChangeLog
@@ -1,3 +1,11 @@
+2021-04-18  Mike Frysinger  <vapier@gentoo.org>
+
+	* interp.c (xfer_mem): Use PRIxTA for printf format.
+	(sim_write): Cast buffer to (void *).
+	(sim_open): Add const to p.
+	* configure.ac (SIM_AC_OPTION_WARNINGS): Delete call.
+	* configure: Regenerate.
+
 2021-04-12  Mike Frysinger  <vapier@gentoo.org>
 
 	* interp.c (sim_open): Delete 3rd arg to sim_cpu_alloc_all.
diff --git a/sim/d10v/configure b/sim/d10v/configure
index 7bde3b270c3..ce7530dafa9 100755
--- a/sim/d10v/configure
+++ b/sim/d10v/configure
@@ -11978,6 +11978,7 @@ fi
 fi
 
 
+
 # Check whether --enable-werror was given.
 if test "${enable_werror+set}" = set; then :
   enableval=$enable_werror; case "${enableval}" in
@@ -11994,6 +11995,9 @@ if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
 fi
 
 WERROR_CFLAGS=""
+  if test "${ERROR_ON_WARNING}" = yes ; then
+    WERROR_CFLAGS="-Werror"
+  fi
 
 build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
 -Wpointer-sign \
@@ -12075,7 +12079,6 @@ $as_echo "${WARN_CFLAGS} ${WERROR_CFLAGS}" >&6; }
 fi
 
 
-
 cgen_breaks=""
 if grep CGEN_MAINT $srcdir/Makefile.in >/dev/null; then
 cgen_breaks="break cgen_rtx_error";
diff --git a/sim/d10v/configure.ac b/sim/d10v/configure.ac
index 4417ba4e561..81145209455 100644
--- a/sim/d10v/configure.ac
+++ b/sim/d10v/configure.ac
@@ -6,6 +6,5 @@ SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN
 SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT,STRICT_ALIGNMENT)
-SIM_AC_OPTION_WARNINGS(no)
 
 SIM_AC_OUTPUT
diff --git a/sim/d10v/interp.c b/sim/d10v/interp.c
index 4fa2069fda1..90c171eda39 100644
--- a/sim/d10v/interp.c
+++ b/sim/d10v/interp.c
@@ -678,7 +678,7 @@ xfer_mem (SIM_DESC sd,
     {
       sim_io_printf
 	(sd,
-	 "sim_%s %d bytes: 0x%08lx (%s) -> 0x%08lx (%s) -> 0x%08lx (%s)\n",
+	 "sim_%s %d bytes: 0x%08" PRIxTA " (%s) -> 0x%08lx (%s) -> 0x%08lx (%s)\n",
 	 write_p ? "write" : "read",
 	 phys_size, virt, last_from,
 	 phys, last_to,
@@ -703,7 +703,9 @@ int
 sim_write (SIM_DESC sd, SIM_ADDR addr, const unsigned char *buffer, int size)
 {
   /* FIXME: this should be performing a virtual transfer */
-  return xfer_mem (sd, addr, buffer, size, 1);
+  /* FIXME: We cast the const away, but it's safe because xfer_mem only reads
+     when write_p==1.  This is still ugly.  */
+  return xfer_mem (sd, addr, (void *) buffer, size, 1);
 }
 
 int
@@ -745,7 +747,7 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb,
   struct simops *s;
   struct hash_entry *h;
   static int init_p = 0;
-  char **p;
+  char * const *p;
   int i;
   SIM_DESC sd = sim_state_alloc (kind, cb);
   SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-19  1:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-19  1:16 [binutils-gdb] sim: d10v: fix build warnings Michael Frysinger

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).