From 1decb32380b8eacf945595321f515d9035a01d6c Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Fri, 7 Apr 2000 08:57:39 +0000 Subject: [PATCH] When GCC always enable certain warnings. Allow configure to set CFLAGS (-g -O2) when GCC. --- gdb/ChangeLog | 7 +++ gdb/Makefile.in | 2 +- gdb/configure | 121 +++++++++++++++++++++++------------------------ gdb/configure.in | 15 +++--- 4 files changed, 76 insertions(+), 69 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 88392a9095a..f81970a76e9 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +Fri Apr 7 17:18:42 2000 Andrew Cagney + + * Makefile.in (CFLAGS): Set using configure. + + * configure.in (WARN_CFLAGS): Enable by default when GCC. + * configure: Re-generate. + Fri Apr 7 13:33:43 2000 Andrew Cagney From 2000-03-27 Peter Schauer : diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 5628234a427..2a78209d908 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -264,7 +264,7 @@ GLOBAL_CFLAGS = $(MT_CFLAGS) $(MH_CFLAGS) # CFLAGS is specifically reserved for setting from the command line # when running make. I.E. "make CFLAGS=-Wmissing-prototypes". -CFLAGS = -g +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 diff --git a/gdb/configure b/gdb/configure index 8c97487aa0d..8ca97a83e96 100755 --- a/gdb/configure +++ b/gdb/configure @@ -5421,13 +5421,15 @@ if test "${enable_netrom}" = "yes"; then 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 # Check whether --enable-build-warnings or --disable-build-warnings was given. if test "${enable_build_warnings+set}" = set; then enableval="$enable_build_warnings" - -# 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 + case "${enableval}" in yes) ;; no) build_warnings="-w";; ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` @@ -5439,6 +5441,7 @@ esac if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then echo "Setting warning flags = $build_warnings" 6>&1 fi +fi WARN_CFLAGS="" WERROR_CFLAGS="" if test "x${build_warnings}" != x -a "x$GCC" = xyes @@ -5452,10 +5455,6 @@ then esac done fi -else - build_warnings="" -fi - @@ -5505,12 +5504,12 @@ REGEX="gnu-regex.o" REGEX_CFLAGS="-DUSE_INCLUDED_REGEX" if test $want_included_regex = false; then echo $ac_n "checking for GNU regex""... $ac_c" 1>&6 -echo "configure:5509: checking for GNU regex" >&5 +echo "configure:5508: checking for GNU regex" >&5 if eval "test \"`echo '$''{'gdb_cv_have_gnu_regex'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -5522,7 +5521,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:5526: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5525: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_gnu_regex=yes else @@ -5545,12 +5544,12 @@ fi # In the Cygwin environment, we need some additional flags. echo $ac_n "checking for cygwin""... $ac_c" 1>&6 -echo "configure:5549: checking for cygwin" >&5 +echo "configure:5548: checking for cygwin" >&5 if eval "test \"`echo '$''{'gdb_cv_os_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 -echo "configure:5588: checking for tgetent in -lncurses" >&5 +echo "configure:5587: checking for tgetent in -lncurses" >&5 ac_lib_var=`echo ncurses'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5592,7 +5591,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lncurses $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5606: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5622,7 +5621,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for tgetent in -lHcurses""... $ac_c" 1>&6 -echo "configure:5626: checking for tgetent in -lHcurses" >&5 +echo "configure:5625: checking for tgetent in -lHcurses" >&5 ac_lib_var=`echo Hcurses'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5630,7 +5629,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lHcurses $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5644: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5660,7 +5659,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for tgetent in -ltermlib""... $ac_c" 1>&6 -echo "configure:5664: checking for tgetent in -ltermlib" >&5 +echo "configure:5663: checking for tgetent in -ltermlib" >&5 ac_lib_var=`echo termlib'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5668,7 +5667,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ltermlib $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5682: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5698,7 +5697,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6 -echo "configure:5702: checking for tgetent in -ltermcap" >&5 +echo "configure:5701: checking for tgetent in -ltermcap" >&5 ac_lib_var=`echo termcap'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5706,7 +5705,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ltermcap $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5720: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5736,7 +5735,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for tgetent in -lcurses""... $ac_c" 1>&6 -echo "configure:5740: checking for tgetent in -lcurses" >&5 +echo "configure:5739: checking for tgetent in -lcurses" >&5 ac_lib_var=`echo curses'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5744,7 +5743,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcurses $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5758: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5774,7 +5773,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for tgetent in -lterminfo""... $ac_c" 1>&6 -echo "configure:5778: checking for tgetent in -lterminfo" >&5 +echo "configure:5777: checking for tgetent in -lterminfo" >&5 ac_lib_var=`echo terminfo'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5782,7 +5781,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lterminfo $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5796: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5951,7 +5950,7 @@ if test "${with_tclconfig+set}" = set; then fi echo $ac_n "checking for Tcl configuration""... $ac_c" 1>&6 -echo "configure:5955: checking for Tcl configuration" >&5 +echo "configure:5954: checking for Tcl configuration" >&5 if eval "test \"`echo '$''{'ac_cv_c_tclconfig'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6059,7 +6058,7 @@ if test "${with_tkconfig+set}" = set; then fi echo $ac_n "checking for Tk configuration""... $ac_c" 1>&6 -echo "configure:6063: checking for Tk configuration" >&5 +echo "configure:6062: checking for Tk configuration" >&5 if eval "test \"`echo '$''{'ac_cv_c_tkconfig'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6155,7 +6154,7 @@ fi no_tcl=true echo $ac_n "checking for Tcl private headers. dir=${configdir}""... $ac_c" 1>&6 -echo "configure:6159: checking for Tcl private headers. dir=${configdir}" >&5 +echo "configure:6158: checking for Tcl private headers. dir=${configdir}" >&5 # Check whether --with-tclinclude or --without-tclinclude was given. if test "${with_tclinclude+set}" = set; then withval="$with_tclinclude" @@ -6221,17 +6220,17 @@ fi if test x"${ac_cv_c_tclh}" = x ; then ac_safe=`echo "tclInt.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for tclInt.h""... $ac_c" 1>&6 -echo "configure:6225: checking for tclInt.h" >&5 +echo "configure:6224: checking for tclInt.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6235: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6234: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6291,7 +6290,7 @@ fi # no_tk=true echo $ac_n "checking for Tk private headers""... $ac_c" 1>&6 -echo "configure:6295: checking for Tk private headers" >&5 +echo "configure:6294: checking for Tk private headers" >&5 # Check whether --with-tkinclude or --without-tkinclude was given. if test "${with_tkinclude+set}" = set; then withval="$with_tkinclude" @@ -6357,17 +6356,17 @@ fi if test x"${ac_cv_c_tkh}" = x ; then ac_safe=`echo "tk.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for tk.h""... $ac_c" 1>&6 -echo "configure:6361: checking for tk.h" >&5 +echo "configure:6360: checking for tk.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6371: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6370: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6413,7 +6412,7 @@ fi echo $ac_n "checking for Itcl private headers. srcdir=${srcdir}""... $ac_c" 1>&6 -echo "configure:6417: checking for Itcl private headers. srcdir=${srcdir}" >&5 +echo "configure:6416: checking for Itcl private headers. srcdir=${srcdir}" >&5 if test x"${ac_cv_c_itclh}" = x ; then for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ${srcdir}/../itcl/itcl; do if test -f $i/generic/itcl.h ; then @@ -6436,7 +6435,7 @@ fi echo $ac_n "checking for Itk private headers. srcdir=${srcdir}""... $ac_c" 1>&6 -echo "configure:6440: checking for Itk private headers. srcdir=${srcdir}" >&5 +echo "configure:6439: checking for Itk private headers. srcdir=${srcdir}" >&5 if test x"${ac_cv_c_itkh}" = x ; then for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ${srcdir}/../itcl/itk; do if test -f $i/generic/itk.h ; then @@ -6459,7 +6458,7 @@ fi echo $ac_n "checking for Tix private headers. srcdir=${srcdir}""... $ac_c" 1>&6 -echo "configure:6463: checking for Tix private headers. srcdir=${srcdir}" >&5 +echo "configure:6462: checking for Tix private headers. srcdir=${srcdir}" >&5 if test x"${ac_cv_c_tixh}" = x ; then for i in ${srcdir}/../tix ${srcdir}/../../tix ${srcdir}/../../../tix ; do if test -f $i/generic/tix.h ; then @@ -6497,7 +6496,7 @@ if test "${with_itclconfig+set}" = set; then fi echo $ac_n "checking for Itcl configuration""... $ac_c" 1>&6 -echo "configure:6501: checking for Itcl configuration" >&5 +echo "configure:6500: checking for Itcl configuration" >&5 if eval "test \"`echo '$''{'ac_cv_c_itclconfig'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6609,7 +6608,7 @@ if test "${with_itkconfig+set}" = set; then fi echo $ac_n "checking for Itk configuration""... $ac_c" 1>&6 -echo "configure:6613: checking for Itk configuration" >&5 +echo "configure:6612: checking for Itk configuration" >&5 if eval "test \"`echo '$''{'ac_cv_c_itkconfig'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6721,7 +6720,7 @@ if test "${with_tixconfig+set}" = set; then fi echo $ac_n "checking for Tix configuration""... $ac_c" 1>&6 -echo "configure:6725: checking for Tix configuration" >&5 +echo "configure:6724: checking for Tix configuration" >&5 if eval "test \"`echo '$''{'ac_cv_c_tixconfig'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6860,7 +6859,7 @@ fi # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:6864: checking for X" >&5 +echo "configure:6863: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -6922,12 +6921,12 @@ if test "$ac_x_includes" = NO; then # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6931: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6930: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6996,14 +6995,14 @@ if test "$ac_x_libraries" = NO; then ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7006: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -7285,7 +7284,7 @@ files="${files} config/nm-empty.h" links="${links} nm.h" fi echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:7289: checking whether ln -s works" >&5 +echo "configure:7288: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7309,12 +7308,12 @@ fi echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:7313: checking for Cygwin environment" >&5 +echo "configure:7312: checking for Cygwin environment" >&5 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7328: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cygwin=yes else @@ -7342,19 +7341,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6 CYGWIN= test "$ac_cv_cygwin" = yes && CYGWIN=yes echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:7346: checking for mingw32 environment" >&5 +echo "configure:7345: checking for mingw32 environment" >&5 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7357: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mingw32=yes else @@ -7373,7 +7372,7 @@ test "$ac_cv_mingw32" = yes && MINGW32=yes echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:7377: checking for executable suffix" >&5 +echo "configure:7376: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7383,7 +7382,7 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:7387: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:7386: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in *.c | *.o | *.obj | *.ilk | *.pdb) ;; diff --git a/gdb/configure.in b/gdb/configure.in index 48beb0b134c..025d8e33202 100644 --- a/gdb/configure.in +++ b/gdb/configure.in @@ -454,12 +454,14 @@ if test "${enable_netrom}" = "yes"; then 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], -[ -# 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 +[case "${enableval}" in yes) ;; no) build_warnings="-w";; ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` @@ -470,7 +472,7 @@ case "${enableval}" in esac if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then echo "Setting warning flags = $build_warnings" 6>&1 -fi +fi])dnl WARN_CFLAGS="" WERROR_CFLAGS="" if test "x${build_warnings}" != x -a "x$GCC" = xyes @@ -483,8 +485,7 @@ then *) WARN_CFLAGS="${WARN_CFLAGS} $w" esac done -fi],[build_warnings=""])dnl - +fi AC_SUBST(WARN_CFLAGS) AC_SUBST(WERROR_CFLAGS) -- 2.30.2