aboutsummaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2012-03-23 03:27:44 +0000
committerMike Frysinger <vapier@gentoo.org>2012-03-23 03:27:44 +0000
commitac0aacdffa67b3fab21e79cf439a09ed92ef3133 (patch)
tree2ec06b5b5e939e5082bc561946df6bb3b08b0874 /sim
parent51dc010c5adf1043d55adef654cd2163e780d5bf (diff)
downloadgdb-ac0aacdffa67b3fab21e79cf439a09ed92ef3133.zip
gdb-ac0aacdffa67b3fab21e79cf439a09ed92ef3133.tar.gz
gdb-ac0aacdffa67b3fab21e79cf439a09ed92ef3133.tar.bz2
sim: sync build_warnings handling with gdb
The sim code gets the logic for SIM_AC_OPTION_WARNINGS from gdb, but it hasn't been updated in a good long while. Sync with the latest gdb code. There is a sim specific change in here: we disable -Werror for now. This is because all sim code atm contains warnings. Will probably have to slowly add a white list of targets which can tolerate this until everyone is updated. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'sim')
-rw-r--r--sim/common/ChangeLog6
-rw-r--r--sim/common/acinclude.m464
2 files changed, 44 insertions, 26 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index d3dd137..5e6e03f 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,9 @@
+2012-03-22 Mike Frysinger <vapier@gentoo.org>
+
+ * acinclude.m4 (SIM_AC_OPTION_WARNINGS): Copy AC_ARG_ENABLE(werror),
+ WERROR_CFLAGS, and build_warnings from gdb/configure.ac. Comment
+ out -Werror initialization.
+
2012-03-19 Mike Frysinger <vapier@gentoo.org>
* Make-common.in (TAGS): Change a-z to [:lower:].
diff --git a/sim/common/acinclude.m4 b/sim/common/acinclude.m4
index 20155ad..2833d8e 100644
--- a/sim/common/acinclude.m4
+++ b/sim/common/acinclude.m4
@@ -816,31 +816,44 @@ dnl --enable-build-warnings is for developers of the simulator.
dnl it enables extra GCC specific warnings.
AC_DEFUN([SIM_AC_OPTION_WARNINGS],
[
-# NOTE: Don't add -Wall or -Wunused, they both include
-# -Wunused-parameter which reports bogus warnings.
-# NOTE: If you add to this list, remember to update
-# gdb/doc/gdbint.texinfo.
-build_warnings="-Wimplicit -Wreturn-type -Wcomment -Wtrigraphs \
--Wformat -Wparentheses -Wpointer-arith"
-# GCC supports -Wuninitialized only with -O or -On, n != 0.
-if test x${CFLAGS+set} = xset; then
- case "${CFLAGS}" in
- *"-O0"* ) ;;
- *"-O"* )
- build_warnings="${build_warnings} -Wuninitialized"
- ;;
- esac
-else
- build_warnings="${build_warnings} -Wuninitialized"
+AC_ARG_ENABLE(werror,
+ AS_HELP_STRING([--enable-werror], [treat compile warnings as errors]),
+ [case "${enableval}" in
+ yes | y) ERROR_ON_WARNING="yes" ;;
+ no | n) ERROR_ON_WARNING="no" ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-werror) ;;
+ esac])
+
+# Enable -Werror by default when using gcc
+if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
+ ERROR_ON_WARNING=yes
+fi
+
+WERROR_CFLAGS=""
+if test "${ERROR_ON_WARNING}" = yes ; then
+# NOTE: Disabled in the sim dir due to most sims generating warnings.
+# WERROR_CFLAGS="-Werror"
+ true
fi
-# Up for debate: -Wswitch -Wcomment -trigraphs -Wtrigraphs
-# -Wunused-function -Wunused-label -Wunused-variable -Wunused-value
-# -Wchar-subscripts -Wtraditional -Wshadow -Wcast-qual
-# -Wcast-align -Wwrite-strings -Wconversion -Wstrict-prototypes
-# -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls
-# -Woverloaded-virtual -Winline -Werror"
+
+# The entries after -Wno-pointer-sign are disabled warnings which may
+# be enabled in the future, which can not currently be used to build
+# GDB.
+# NOTE: If you change this list, remember to update
+# gdb/doc/gdbint.texinfo.
+build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
+-Wformat-nonliteral -Wno-pointer-sign \
+-Wno-unused -Wunused-value -Wunused-function \
+-Wno-switch -Wno-char-subscripts -Wmissing-prototypes"
+
+# Enable -Wno-format by default when using gcc on mingw since many
+# GCC versions complain about %I64.
+case "${host}" in
+ *-*-mingw32*) build_warnings="$build_warnings -Wno-format" ;;
+esac
+
AC_ARG_ENABLE(build-warnings,
-[ --enable-build-warnings Enable build-time compiler warnings if gcc is used],
+AS_HELP_STRING([--enable-build-warnings], [enable build-time compiler warnings if gcc is used]),
[case "${enableval}" in
yes) ;;
no) build_warnings="-w";;
@@ -854,7 +867,7 @@ if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
echo "Setting compiler warning flags = $build_warnings" 6>&1
fi])dnl
AC_ARG_ENABLE(sim-build-warnings,
-[ --enable-gdb-build-warnings Enable SIM specific build-time compiler warnings if gcc is used],
+AS_HELP_STRING([--enable-sim-build-warnings], [enable SIM specific build-time compiler warnings if gcc is used]),
[case "${enableval}" in
yes) ;;
no) build_warnings="-w";;
@@ -868,7 +881,6 @@ if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
echo "Setting GDB specific compiler warning flags = $build_warnings" 6>&1
fi])dnl
WARN_CFLAGS=""
-WERROR_CFLAGS=""
if test "x${build_warnings}" != x -a "x$GCC" = xyes
then
AC_MSG_CHECKING(compiler warning flags)
@@ -884,7 +896,7 @@ then
CFLAGS="$saved_CFLAGS"
esac
done
- AC_MSG_RESULT(${WARN_CFLAGS}${WERROR_CFLAGS})
+ AC_MSG_RESULT(${WARN_CFLAGS} ${WERROR_CFLAGS})
fi
])
AC_SUBST(WARN_CFLAGS)