aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc
diff options
context:
space:
mode:
authorManuel López-Ibáñez <manu@gcc.gnu.org>2007-05-20 20:29:55 +0000
committerManuel López-Ibáñez <manu@gcc.gnu.org>2007-05-20 20:29:55 +0000
commitf6aa72dd497916b60e7a3c29e235241dadba3274 (patch)
tree90312ab1a9121fa6e7864a7b15bdaf3260ab1b8b /gcc/doc
parentda5a2efd39b67a36c4e70f059ffbbb6103606f3e (diff)
downloadgcc-f6aa72dd497916b60e7a3c29e235241dadba3274.zip
gcc-f6aa72dd497916b60e7a3c29e235241dadba3274.tar.gz
gcc-f6aa72dd497916b60e7a3c29e235241dadba3274.tar.bz2
re PR middle-end/7651 (Define -Wextra strictly in terms of other warning flags)
2007-05-20 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR middle-end/7651 PR c++/11856 PR c/12963 PR c/23587 PR other/29694 * c.opt (Wtype-limits): New. * doc/invoke.texi (Wtype-limits): Document it. (Wextra): Enabled by -Wextra. * c-opts.c (c_common_post_options): Enabled by -Wextra. * c-common.c (shorten_compare): Warn with Wtype-limits. testsuite/ * gcc.dg/compare6.c: Replace Wall with Wtype-limits. * gcc.dg/Wtype-limits.c: New. * gcc.dg/Wtype-limits-Wextra.c: New. * gcc.dg/Wtype-limits-no.c: New. * g++.dg/warn/Wtype-limits.C: New. * g++.dg/warn/Wtype-limits-Wextra.C: New. * g++.dg/warn/Wtype-limits-no.C: New. From-SVN: r124875
Diffstat (limited to 'gcc/doc')
-rw-r--r--gcc/doc/invoke.texi19
1 files changed, 16 insertions, 3 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 7be8167..d8260ba 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -224,7 +224,7 @@ Objective-C and Objective-C++ Dialects}.
@item Warning Options
@xref{Warning Options,,Options to Request or Suppress Warnings}.
@gccoptlist{-fsyntax-only -pedantic -pedantic-errors @gol
--w -Wextra -Wall -Waddress -Waggregate-return -Warray-bounds @gol
+-w -Wextra -Wall -Waddress -Waggregate-return -Warray-bounds @gol
-Wno-attributes -Wc++-compat -Wc++0x-compat -Wcast-align -Wcast-qual @gol
-Wchar-subscripts -Wclobbered -Wcomment @gol
-Wconversion -Wcoverage-mismatch -Wno-deprecated-declarations @gol
@@ -251,7 +251,7 @@ Objective-C and Objective-C++ Dialects}.
-Wstrict-aliasing -Wstrict-aliasing=n @gol
-Wstrict-overflow -Wstrict-overflow=@var{n} @gol
-Wswitch -Wswitch-default -Wswitch-enum @gol
--Wsystem-headers -Wtrigraphs -Wundef -Wuninitialized @gol
+-Wsystem-headers -Wtrigraphs -Wtype-limits -Wundef -Wuninitialized @gol
-Wunknown-pragmas -Wno-pragmas -Wunreachable-code @gol
-Wunused -Wunused-function -Wunused-label -Wunused-parameter @gol
-Wunused-value -Wunused-variable @gol
@@ -3134,7 +3134,11 @@ messages for these events:
@itemize @bullet
@item
-An unsigned value is compared against zero with @samp{<} or @samp{>=}.
+Warn if a comparison is always true or always false due to the limited
+range of the data type, but do not warn for constant expressions. For
+example, warn if an unsigned variable is compared against zero with
+@samp{<} or @samp{>=}. This warning can be independently controlled
+by @option{-Wtype-limits}.
@item @r{(C only)}
Storage-class specifiers like @code{static} are not the first things
@@ -3376,6 +3380,15 @@ convenience in calculations with @code{void *} pointers and pointers
to functions. In C++, warn also when an arithmetic operation involves
@code{NULL}. This warning is also enabled by @option{-pedantic}.
+@item -Wtype-limits
+@opindex Wtype-limits
+@opindex Wno-type-limits
+Warn if a comparison is always true or always false due to the limited
+range of the data type, but do not warn for constant expressions. For
+example, warn if an unsigned variable is compared against zero with
+@samp{<} or @samp{>=}. This warning is also enabled by
+@option{-Wextra}.
+
@item -Wbad-function-cast @r{(C only)}
@opindex Wbad-function-cast
Warn whenever a function call is cast to a non-matching type.