* configure.ac (build_warnings): Use -Wall and

-Wdeclaration-after-statement.
	* configure: Regenerated.

	* gdbint.texinfo (Compiler Warnings): Update for -Wall use.
This commit is contained in:
Daniel Jacobowitz 2007-01-04 19:42:10 +00:00
parent bbec2603e4
commit aa79a185c9
5 changed files with 53 additions and 106 deletions

View 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

35
gdb/configure vendored
View File

@ -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"
build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
-Wformat-nonliteral -Wno-pointer-sign \
-Wno-unused -Wno-switch"
# 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
# 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

View 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"
build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
-Wformat-nonliteral -Wno-pointer-sign \
-Wno-unused -Wno-switch"
# 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
# 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)

View 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.

View File

@ -5471,63 +5471,34 @@ 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
@item -Wtrigraphs
@item -Wformat
@itemx -Wformat-nonliteral
Since @value{GDBN} uses the @code{format printf} attribute on all
@code{printf} like functions these check 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.
@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 -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 -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 this checks not just @code{printf} calls
but also calls to functions such as @code{fprintf_unfiltered}.
@item -Wno-pointer-sign
In version 4.0, GCC began warning about pointer argument passing or
@ -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.
@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.}
@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}.
@end table
@subsection Formatting