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>
This commit is contained in:
parent
51dc010c5a
commit
ac0aacdffa
|
@ -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>
|
2012-03-19 Mike Frysinger <vapier@gentoo.org>
|
||||||
|
|
||||||
* Make-common.in (TAGS): Change a-z to [:lower:].
|
* Make-common.in (TAGS): Change a-z to [:lower:].
|
||||||
|
|
|
@ -816,31 +816,44 @@ dnl --enable-build-warnings is for developers of the simulator.
|
||||||
dnl it enables extra GCC specific warnings.
|
dnl it enables extra GCC specific warnings.
|
||||||
AC_DEFUN([SIM_AC_OPTION_WARNINGS],
|
AC_DEFUN([SIM_AC_OPTION_WARNINGS],
|
||||||
[
|
[
|
||||||
# NOTE: Don't add -Wall or -Wunused, they both include
|
AC_ARG_ENABLE(werror,
|
||||||
# -Wunused-parameter which reports bogus warnings.
|
AS_HELP_STRING([--enable-werror], [treat compile warnings as errors]),
|
||||||
# NOTE: If you add to this list, remember to update
|
[case "${enableval}" in
|
||||||
# gdb/doc/gdbint.texinfo.
|
yes | y) ERROR_ON_WARNING="yes" ;;
|
||||||
build_warnings="-Wimplicit -Wreturn-type -Wcomment -Wtrigraphs \
|
no | n) ERROR_ON_WARNING="no" ;;
|
||||||
-Wformat -Wparentheses -Wpointer-arith"
|
*) AC_MSG_ERROR(bad value ${enableval} for --enable-werror) ;;
|
||||||
# GCC supports -Wuninitialized only with -O or -On, n != 0.
|
esac])
|
||||||
if test x${CFLAGS+set} = xset; then
|
|
||||||
case "${CFLAGS}" in
|
# Enable -Werror by default when using gcc
|
||||||
*"-O0"* ) ;;
|
if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
|
||||||
*"-O"* )
|
ERROR_ON_WARNING=yes
|
||||||
build_warnings="${build_warnings} -Wuninitialized"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
else
|
|
||||||
build_warnings="${build_warnings} -Wuninitialized"
|
|
||||||
fi
|
fi
|
||||||
# Up for debate: -Wswitch -Wcomment -trigraphs -Wtrigraphs
|
|
||||||
# -Wunused-function -Wunused-label -Wunused-variable -Wunused-value
|
WERROR_CFLAGS=""
|
||||||
# -Wchar-subscripts -Wtraditional -Wshadow -Wcast-qual
|
if test "${ERROR_ON_WARNING}" = yes ; then
|
||||||
# -Wcast-align -Wwrite-strings -Wconversion -Wstrict-prototypes
|
# NOTE: Disabled in the sim dir due to most sims generating warnings.
|
||||||
# -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls
|
# WERROR_CFLAGS="-Werror"
|
||||||
# -Woverloaded-virtual -Winline -Werror"
|
true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 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,
|
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
|
[case "${enableval}" in
|
||||||
yes) ;;
|
yes) ;;
|
||||||
no) build_warnings="-w";;
|
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
|
echo "Setting compiler warning flags = $build_warnings" 6>&1
|
||||||
fi])dnl
|
fi])dnl
|
||||||
AC_ARG_ENABLE(sim-build-warnings,
|
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
|
[case "${enableval}" in
|
||||||
yes) ;;
|
yes) ;;
|
||||||
no) build_warnings="-w";;
|
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
|
echo "Setting GDB specific compiler warning flags = $build_warnings" 6>&1
|
||||||
fi])dnl
|
fi])dnl
|
||||||
WARN_CFLAGS=""
|
WARN_CFLAGS=""
|
||||||
WERROR_CFLAGS=""
|
|
||||||
if test "x${build_warnings}" != x -a "x$GCC" = xyes
|
if test "x${build_warnings}" != x -a "x$GCC" = xyes
|
||||||
then
|
then
|
||||||
AC_MSG_CHECKING(compiler warning flags)
|
AC_MSG_CHECKING(compiler warning flags)
|
||||||
|
@ -884,7 +896,7 @@ then
|
||||||
CFLAGS="$saved_CFLAGS"
|
CFLAGS="$saved_CFLAGS"
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
AC_MSG_RESULT(${WARN_CFLAGS}${WERROR_CFLAGS})
|
AC_MSG_RESULT(${WARN_CFLAGS} ${WERROR_CFLAGS})
|
||||||
fi
|
fi
|
||||||
])
|
])
|
||||||
AC_SUBST(WARN_CFLAGS)
|
AC_SUBST(WARN_CFLAGS)
|
||||||
|
|
Loading…
Reference in New Issue