* configure.ac (build_warnings): Use -Wall and
authorDaniel Jacobowitz <drow@false.org>
Thu, 4 Jan 2007 19:42:10 +0000 (19:42 +0000)
committerDaniel Jacobowitz <drow@false.org>
Thu, 4 Jan 2007 19:42:10 +0000 (19:42 +0000)
-Wdeclaration-after-statement.
* configure: Regenerated.

* gdbint.texinfo (Compiler Warnings): Update for -Wall use.

gdb/ChangeLog
gdb/configure
gdb/configure.ac
gdb/doc/ChangeLog
gdb/doc/gdbint.texinfo

index c884c96c8905f77e4c1dcd8bcef26fce06c4cbe6..96edccd1aa6f30b8623bb54dff1e1940b3bb6e2f 100644 (file)
@@ -1,3 +1,9 @@
+2007-01-04  Daniel Jacobowitz  <dan@codesourcery.com>
+
+       * configure.ac (build_warnings): Use -Wall and
+       -Wdeclaration-after-statement.
+       * configure: Regenerated.
+
 2007-01-04  Vladimir Prus  <vladimir@codesourcery.com>
 
        Simplify access to variours properties of child
index c2199f9d51cb3de53fc0c1c5fc9c141a00ea019d..7d4f298d0218a377b16b0768cf9f370e926a3e4d 100755 (executable)
@@ -21114,32 +21114,15 @@ if test "${ERROR_ON_WARNING}" = yes ; then
     WERROR_CFLAGS="-Werror"
 fi
 
-# 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
+# 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="-Wimplicit -Wreturn-type -Wcomment -Wtrigraphs \
--Wformat -Wparentheses -Wpointer-arith -Wformat-nonliteral \
--Wunused-label -Wunused-function -Wno-pointer-sign"
-
-# 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"
-fi
+build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
+-Wformat-nonliteral -Wno-pointer-sign \
+-Wno-unused -Wno-switch"
 
-# Up for debate: -Wswitch -Wcomment -trigraphs -Wtrigraphs
-# -Wunused-function -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"
 # Check whether --enable-build-warnings or --disable-build-warnings was given.
 if test "${enable_build_warnings+set}" = set; then
   enableval="$enable_build_warnings"
@@ -21230,8 +21213,8 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
            CFLAGS="$saved_CFLAGS"
        esac
     done
-    echo "$as_me:$LINENO: result: ${WARN_CFLAGS}${WERROR_CFLAGS}" >&5
-echo "${ECHO_T}${WARN_CFLAGS}${WERROR_CFLAGS}" >&6
+    echo "$as_me:$LINENO: result: ${WARN_CFLAGS} ${WERROR_CFLAGS}" >&5
+echo "${ECHO_T}${WARN_CFLAGS} ${WERROR_CFLAGS}" >&6
 fi
 
 
index 0f6a1c91b5fa5a65fcd234612d1dbbb2423fb6f6..7a6bd80b6f69c871ce1e66a5269730fe846852f5 100644 (file)
@@ -1138,32 +1138,15 @@ if test "${ERROR_ON_WARNING}" = yes ; then
     WERROR_CFLAGS="-Werror"
 fi
 
-# 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
+# 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="-Wimplicit -Wreturn-type -Wcomment -Wtrigraphs \
--Wformat -Wparentheses -Wpointer-arith -Wformat-nonliteral \
--Wunused-label -Wunused-function -Wno-pointer-sign"
-
-# 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"
-fi
+build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
+-Wformat-nonliteral -Wno-pointer-sign \
+-Wno-unused -Wno-switch"
 
-# Up for debate: -Wswitch -Wcomment -trigraphs -Wtrigraphs
-# -Wunused-function -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 Enable build-time compiler warnings if gcc is used],
 [case "${enableval}" in
@@ -1208,7 +1191,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)
 AC_SUBST(WERROR_CFLAGS)
index df32bc67cabf7ecb0a73c02f485612314d4957cd..7893d659a6ee26c6c2b7e6a17b6731f0bef316b6 100644 (file)
@@ -1,3 +1,7 @@
+2007-01-04  Daniel Jacobowitz  <dan@codesourcery.com>
+
+       * gdbint.texinfo (Compiler Warnings): Update for -Wall use.
+
 2007-01-01  Joel Brobecker  <brobecker@adacore.com>
 
        * gdbint.texinfo (Start of New Year Procedure): Add missing item.
index 1565f24325b3cb429f2e0b6e868e4ffb69dd0e3f..cc4d591cf2987af71e4a36b2bd09b63da4939c40 100644 (file)
@@ -5471,64 +5471,35 @@ errors.}
 @subsection Compiler Warnings
 @cindex compiler warnings
 
-With few exceptions, developers should include the configuration option
-@samp{--enable-gdb-build-warnings=,-Werror} when building @value{GDBN}.
-The exceptions are listed in the file @file{gdb/MAINTAINERS}.
+With few exceptions, developers should avoid the configuration option
+@samp{--disable-werror} when building @value{GDBN}.  The exceptions
+are listed in the file @file{gdb/MAINTAINERS}.  The default, when
+building with @sc{gcc}, is @samp{--enable-werror}.
 
 This option causes @value{GDBN} (when built using GCC) to be compiled
 with a carefully selected list of compiler warning flags.  Any warnings
-from those flags being treated as errors.
+from those flags are treated as errors.
 
 The current list of warning flags includes:
 
 @table @samp
-@item -Wimplicit
-Since @value{GDBN} coding standard requires all functions to be declared
-using a prototype, the flag has the side effect of ensuring that
-prototyped functions are always visible with out resorting to
-@samp{-Wstrict-prototypes}.
+@item -Wall
+Recommended @sc{gcc} warnings.
 
-@item -Wreturn-type
-Such code often appears to work except on instruction set architectures
-that use register windows.
+@item -Wdeclaration-after-statement
 
-@item -Wcomment
+@sc{gcc} 3.x (and later) and @sc{c99} allow declarations mixed with
+code, but @sc{gcc} 2.x and @sc{c89} do not.
 
-@item -Wtrigraphs
+@item -Wpointer-arith
 
-@item -Wformat
-@itemx -Wformat-nonliteral
+@item -Wformat-nonliteral
+Non-literal format strings, with a few exceptions, are bugs - they
+might contain unintented user-supplied format specifiers.
 Since @value{GDBN} uses the @code{format printf} attribute on all
-@code{printf} like functions these check not just @code{printf} calls
+@code{printf} like functions this checks not just @code{printf} calls
 but also calls to functions such as @code{fprintf_unfiltered}.
 
-@item -Wparentheses
-This warning includes uses of the assignment operator within an
-@code{if} statement.
-
-@item -Wpointer-arith
-
-@item -Wuninitialized
-
-@item -Wunused-label
-This warning has the additional benefit of detecting the absence of the
-@code{case} reserved word in a switch statement:
-@smallexample
-enum @{ FD_SCHEDULED, NOTHING_SCHEDULED @} sched;
-@dots{}
-switch (sched)
-  @{
-  case FD_SCHEDULED:
-    @dots{};
-    break;
-  NOTHING_SCHEDULED:
-    @dots{};
-    break;
-  @}
-@end smallexample
-
-@item -Wunused-function
-
 @item -Wno-pointer-sign
 In version 4.0, GCC began warning about pointer argument passing or
 assignment even when the source and destination differed only in
@@ -5537,19 +5508,19 @@ carefully between @code{char} and @code{unsigned char}.  In early 2006
 the @value{GDBN} developers decided correcting these warnings wasn't
 worth the time it would take.
 
-@end table
-
-@emph{Pragmatics: Due to the way that @value{GDBN} is implemented most
-functions have unused parameters.  Consequently the warning
-@samp{-Wunused-parameter} is precluded from the list.  The macro
+@item -Wno-unused-parameter
+Due to the way that @value{GDBN} is implemented many functions have
+unused parameters.  Consequently this warning is avoided.  The macro
 @code{ATTRIBUTE_UNUSED} is not used as it leads to false negatives ---
 it is not an error to have @code{ATTRIBUTE_UNUSED} on a parameter that
-is being used.  The options @samp{-Wall} and @samp{-Wunused} are also
-precluded because they both include @samp{-Wunused-parameter}.}
+is being used.
+
+@item -Wno-unused
+@itemx -Wno-switch
+These are warnings which might be useful for @value{GDBN}, but are
+currently too noisy to enable with @samp{-Werror}.
 
-@emph{Pragmatics: @value{GDBN} has not simply accepted the warnings
-enabled by @samp{-Wall -Werror -W...}.  Instead it is selecting warnings
-when and where their benefits can be demonstrated.}
+@end table
 
 @subsection Formatting