sim: mcore: fix build time warnings

Message ID 20210504123623.9898-1-vapier@gentoo.org
State New
Headers show
Series
  • sim: mcore: fix build time warnings
Related show

Commit Message

Weimin Pan via Gdb-patches May 4, 2021, 12:36 p.m.
Once we fix a minor const warning we can enable -Werror in here.
---
 sim/mcore/configure    | 5 ++++-
 sim/mcore/configure.ac | 1 -
 sim/mcore/interp.c     | 2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)

-- 
2.31.1

Patch

diff --git a/sim/mcore/configure b/sim/mcore/configure
index 94c4f26d65b0..2d1e87ffead4 100755
--- a/sim/mcore/configure
+++ b/sim/mcore/configure
@@ -11943,6 +11943,7 @@  fi
 fi
 
 
+
 # Check whether --enable-werror was given.
 if test "${enable_werror+set}" = set; then :
   enableval=$enable_werror; case "${enableval}" in
@@ -11959,6 +11960,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 \
@@ -12040,7 +12044,6 @@  $as_echo "${WARN_CFLAGS} ${WERROR_CFLAGS}" >&6; }
 fi
 
 
-
 hardware="cfi core pal glue "
 sim_hw_cflags="-DWITH_HW=1"
 sim_hw="$hardware"
diff --git a/sim/mcore/configure.ac b/sim/mcore/configure.ac
index 4417ba4e561e..811452094557 100644
--- a/sim/mcore/configure.ac
+++ b/sim/mcore/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/mcore/interp.c b/sim/mcore/interp.c
index 6eadf04d0491..f726c1e7db77 100644
--- a/sim/mcore/interp.c
+++ b/sim/mcore/interp.c
@@ -1417,7 +1417,7 @@  sim_create_inferior (SIM_DESC sd, struct bfd *prog_bfd,
 		     char * const *argv, char * const *env)
 {
   SIM_CPU *cpu = STATE_CPU (sd, 0);
-  char ** avp;
+  char * const *avp;
   int nargs = 0;
   int nenv = 0;
   int s_length;