| Index: sim/common/acinclude.m4
|
| diff --git a/sim/common/acinclude.m4 b/sim/common/acinclude.m4
|
| index efb1a29c14e14371c6178f80110c94e2de093734..fe0a5b728746f2e175a5e3d00f9d3c14ba17a58d 100644
|
| --- a/sim/common/acinclude.m4
|
| +++ b/sim/common/acinclude.m4
|
| @@ -29,6 +29,7 @@ AC_REQUIRE([AC_PROG_CC])
|
| # autoconf.info says this should be called right after AC_INIT.
|
| AC_CONFIG_HEADER(ifelse([$1],,config.h,[$1]):config.in)
|
| AC_CANONICAL_SYSTEM
|
| +AC_USE_SYSTEM_EXTENSIONS
|
| AC_ARG_PROGRAM
|
| AC_PROG_INSTALL
|
|
|
| @@ -46,6 +47,13 @@ AR=${AR-ar}
|
| AC_SUBST(AR)
|
| AC_PROG_RANLIB
|
|
|
| +# Some of the common include files depend on bfd.h, and bfd.h checks
|
| +# that config.h is included first by testing that the PACKAGE macro
|
| +# is defined.
|
| +PACKAGE=sim
|
| +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package. ])
|
| +AC_SUBST(PACKAGE)
|
| +
|
| # Dependency checking.
|
| ZW_CREATE_DEPDIR
|
| ZW_PROG_COMPILER_DEPENDENCIES([CC])
|
| @@ -178,7 +186,7 @@ AC_ARG_ENABLE(sim-trace,
|
| no) sim_trace="-DTRACE=0 -DWITH_TRACE=0";;
|
| [[-0-9]]*)
|
| sim_trace="-DTRACE='(${enableval})' -DWITH_TRACE='(${enableval})'";;
|
| - [[a-z]]*)
|
| + [[[:lower:]]]*)
|
| sim_trace=""
|
| for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
|
| if test x"$sim_trace" = x; then
|
| @@ -816,31 +824,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
|
| -# 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"
|
| +
|
| +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
|
| +
|
| +# 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 +875,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 +889,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 +904,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)
|
|
|