aboutsummaryrefslogtreecommitdiff
path: root/sim/common
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2002-06-16 16:33:35 +0000
committerAndrew Cagney <cagney@redhat.com>2002-06-16 16:33:35 +0000
commitc8cca39f988d5670cbef3d40cf7b9fa26877aee4 (patch)
tree5701c4950e92a68bef1a9d940ee6fc1e1d8aa401 /sim/common
parent3832c25c185d324f411ab880aab6b1e5e17f23f6 (diff)
downloadgdb-c8cca39f988d5670cbef3d40cf7b9fa26877aee4.zip
gdb-c8cca39f988d5670cbef3d40cf7b9fa26877aee4.tar.gz
gdb-c8cca39f988d5670cbef3d40cf7b9fa26877aee4.tar.bz2
Import current --enable-gdb-build-warnings.
Diffstat (limited to 'sim/common')
-rw-r--r--sim/common/ChangeLog6
-rw-r--r--sim/common/aclocal.m465
2 files changed, 54 insertions, 17 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 979c1ee..d3d21a6 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,9 @@
+2002-06-16 Andrew Cagney <ac131313@redhat.com>
+
+ * aclocal.m4 (SIM_AC_OPTION_WARNINGS): Update to match GDB's
+ --enable-gdb-build-warnings.
+ * configure: Regenerated to track ../common/aclocal.m4 changes.
+
2002-06-09 Aldy Hernandez <aldyh@redhat.com>
* sim-fpu.c (unpack_fpu): Initialize exponent for
diff --git a/sim/common/aclocal.m4 b/sim/common/aclocal.m4
index a1c797a..ceee6d4 100644
--- a/sim/common/aclocal.m4
+++ b/sim/common/aclocal.m4
@@ -787,34 +787,65 @@ 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 -Wuninitialized"
+# 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"
AC_ARG_ENABLE(build-warnings,
-[ --enable-build-warnings[=LIST] Enable build-time compiler warnings],
-[build_warnings="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations"
-case "${enableval}" in
+[ --enable-build-warnings Enable build-time compiler warnings if gcc is used],
+[case "${enableval}" in
yes) ;;
no) build_warnings="-w";;
,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
- build_warnings="${build_warnings} ${t}";;
+ build_warnings="${build_warnings} ${t}";;
*,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
- build_warnings="${t} ${build_warnings}";;
- *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
+ build_warnings="${t} ${build_warnings}";;
+ *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
esac
if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
- echo "Setting warning flags = $build_warnings" 6>&1
-fi
+ 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],
+[case "${enableval}" in
+ yes) ;;
+ no) build_warnings="-w";;
+ ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
+ build_warnings="${build_warnings} ${t}";;
+ *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
+ build_warnings="${t} ${build_warnings}";;
+ *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
+esac
+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
- # Separate out the -Werror flag as some files just cannot be
- # compiled with it enabled.
- for w in ${build_warnings}; do
- case $w in
- -Werr*) WERROR_CFLAGS=-Werror ;;
- *) WARN_CFLAGS="${WARN_CFLAGS} $w"
- esac
- done
-fi],[build_warnings=""])dnl
+ AC_MSG_CHECKING(compiler warning flags)
+ # Separate out the -Werror flag as some files just cannot be
+ # compiled with it enabled.
+ for w in ${build_warnings}; do
+ case $w in
+ -Werr*) WERROR_CFLAGS=-Werror ;;
+ *) # Check that GCC accepts it
+ saved_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $w"
+ AC_TRY_COMPILE([],[],WARN_CFLAGS="${WARN_CFLAGS} $w",)
+ CFLAGS="$saved_CFLAGS"
+ esac
+ done
+ AC_MSG_RESULT(${WARN_CFLAGS}${WERROR_CFLAGS})
+fi
])
AC_SUBST(WARN_CFLAGS)
AC_SUBST(WERROR_CFLAGS)