This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
[PATCH] Enable warnings by default
- To: GDB Patches <gdb-patches at sourceware dot cygnus dot com>
- Subject: [PATCH] Enable warnings by default
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Fri, 07 Apr 2000 18:55:16 +1000
- Organization: Cygnus Solutions
FYI,
The attatched patch:
o enables certain GCC warnings by default
(needs a top-level change before it
has any real effect)
o sets CFLAGS using configure
The second change is the most significant. Previously, GDB was compiled
using either ``-g -O2'' or ``-g -O'' depending where make was run
(because of a top-level CFLAGS=-g -O2 -W -Wall). It will now always
build with ``-g -O2''.
Andrew
Fri Apr 7 17:18:42 2000 Andrew Cagney <cagney@b1.cygnus.com>
* Makefile.in (CFLAGS): Set using configure.
* configure.in (WARN_CFLAGS): Enable by default when GCC.
* configure: Re-generate.
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.21
diff -p -r1.21 Makefile.in
*** Makefile.in 2000/04/04 02:08:52 1.21
--- Makefile.in 2000/04/07 08:50:55
*************** GLOBAL_CFLAGS = $(MT_CFLAGS) $(MH_CFLAGS
*** 264,270 ****
# CFLAGS is specifically reserved for setting from the command line
# when running make. I.E. "make CFLAGS=-Wmissing-prototypes".
! CFLAGS = -g
# Need to pass this to testsuite for "make check". Probably should be
# consistent with top-level Makefile.in and gdb/testsuite/Makefile.in
--- 264,270 ----
# CFLAGS is specifically reserved for setting from the command line
# when running make. I.E. "make CFLAGS=-Wmissing-prototypes".
! CFLAGS = @CFLAGS@
# Need to pass this to testsuite for "make check". Probably should be
# consistent with top-level Makefile.in and gdb/testsuite/Makefile.in
Index: configure.in
===================================================================
RCS file: /cvs/src/src/gdb/configure.in,v
retrieving revision 1.16
diff -p -r1.16 configure.in
*** configure.in 2000/04/07 01:16:17 1.16
--- configure.in 2000/04/07 08:50:59
*************** if test "${enable_netrom}" = "yes"; then
*** 454,465 ****
CONFIG_SRCS="${CONFIG_SRCS} remote-nrom.c"
fi
AC_ARG_ENABLE(build-warnings,
[ --enable-build-warnings Enable build-time compiler warnings if gcc is used],
! [
! # not yet: -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
! build_warnings="-Wimplicit -Wreturn-type -Wcomment -Wtrigraphs -Wformat -Wparentheses -Wpointer-arith"
! case "${enableval}" in
yes) ;;
no) build_warnings="-w";;
,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
--- 454,467 ----
CONFIG_SRCS="${CONFIG_SRCS} remote-nrom.c"
fi
+
+ build_warnings="-Wimplicit -Wreturn-type -Wcomment -Wtrigraphs \
+ -Wformat -Wparentheses -Wpointer-arith"
+ # Not yet: -Wall -Wpointer-arith -Wstrict-prototypes
+ # -Wmissing-prototypes -Wmissing-declarations
AC_ARG_ENABLE(build-warnings,
[ --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"`
*************** case "${enableval}" in
*** 470,476 ****
esac
if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
echo "Setting warning flags = $build_warnings" 6>&1
! fi
WARN_CFLAGS=""
WERROR_CFLAGS=""
if test "x${build_warnings}" != x -a "x$GCC" = xyes
--- 472,478 ----
esac
if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
echo "Setting warning flags = $build_warnings" 6>&1
! fi])dnl
WARN_CFLAGS=""
WERROR_CFLAGS=""
if test "x${build_warnings}" != x -a "x$GCC" = xyes
*************** then
*** 483,490 ****
*) WARN_CFLAGS="${WARN_CFLAGS} $w"
esac
done
! fi],[build_warnings=""])dnl
!
AC_SUBST(WARN_CFLAGS)
AC_SUBST(WERROR_CFLAGS)
--- 485,491 ----
*) WARN_CFLAGS="${WARN_CFLAGS} $w"
esac
done
! fi
AC_SUBST(WARN_CFLAGS)
AC_SUBST(WERROR_CFLAGS)