aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc
diff options
context:
space:
mode:
authorManuel Lopez-Ibanez <manu@gcc.gnu.org>2007-05-19 13:32:03 +0000
committerManuel Lopez-Ibanez <manu@gcc.gnu.org>2007-05-19 13:32:03 +0000
commitf276617dd020326a129d1ef27dd769ec19250f89 (patch)
tree98d10e457cbf659848ab680b6b1b3e192890e140 /gcc/doc
parent40850eab2873ef38a3d3dcb9f66a6a9613b11122 (diff)
2007-05-19 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
* doc/invoke.texi (Warning Options): Add -Wconversion-sign. (Wconversion): Update description. (Wconversion-sign): New. * c.opt (Wconversion-sign): New. * c-opts.c (c_common_post_options): Uninitialized Wconversion-sign means disabled for C++. Otherwise, take the status of Wconversion. * c-common.c (conversion_warning): Warn with either Wconversion or Wconversion-sign. (warnings_for_convert_and_check): Conditions are already checked by conversion_warning. (convert_and_check): Don't check warnings if the conversion failed. cp/ * cvt.c (cp_convert_and_check): Don't check warnings if the conversion failed. testsuite/ * gcc.dg/Wconversion-integer.c: Group testcases and add more. * gcc.dg/Wconversion-sign.c: New. * gcc.dg/Wconversion-integer-no-sign.c: New. * g++.dg/warn/Wconversion-integer.C: Move some warnings to Wconversion-sign.C * g++.dg/warn/Wconversion-sign.C: New. * g++.old-deja/g++.other/warn4.C: Update. * g++.dg/warn/Wconversion1.C: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@124856 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/doc')
-rw-r--r--gcc/doc/invoke.texi21
1 files changed, 17 insertions, 4 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 9b0d65ac709..7aef897f0f5 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -227,7 +227,7 @@ Objective-C and Objective-C++ Dialects}.
-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
+-Wconversion -Wcoverage-mismatch -Wno-deprecated-declarations @gol
-Wdisabled-optimization -Wno-div-by-zero @gol
-Wempty-body -Wno-endif-labels @gol
-Werror -Werror=* @gol
@@ -247,7 +247,7 @@ Objective-C and Objective-C++ Dialects}.
-Wparentheses -Wpointer-arith -Wno-pointer-to-int-cast @gol
-Wredundant-decls @gol
-Wreturn-type -Wsequence-point -Wshadow @gol
--Wsign-compare -Wstack-protector @gol
+-Wsign-compare -Wsign-conversion -Wstack-protector @gol
-Wstrict-aliasing -Wstrict-aliasing=n @gol
-Wstrict-overflow -Wstrict-overflow=@var{n} @gol
-Wswitch -Wswitch-default -Wswitch-enum @gol
@@ -3437,19 +3437,24 @@ Warn for variables that might be changed by @samp{longjmp} or
@item -Wconversion
@opindex Wconversion
+@opindex Wno-conversion
Warn for implicit conversions that may alter a value. This includes
conversions between real and integer, like @code{abs (x)} when
@code{x} is @code{double}; conversions between signed and unsigned,
like @code{unsigned ui = -1}; and conversions to smaller types, like
@code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
-changed by the conversion like in @code{abs (2.0)}.
+changed by the conversion like in @code{abs (2.0)}. Warnings about
+conversions between signed and unsigned integers can be disabled by
+using @option{-Wno-sign-conversion}.
For C++, also warn for conversions between @code{NULL} and non-pointer
types; confusing overload resolution for user-defined conversions; and
conversions that will never use a type conversion operator:
conversions to @code{void}, the same type, a base class or a reference
-to them.
+to them. Warnings about conversions between signed and unsigned
+integers are disabled by default in C++ unless
+@option{-Wsign-conversion} is explicitly enabled.
@item -Wempty-body
@opindex Wempty-body
@@ -3468,6 +3473,14 @@ an incorrect result when the signed value is converted to unsigned.
This warning is also enabled by @option{-Wextra}; to get the other warnings
of @option{-Wextra} without this warning, use @samp{-Wextra -Wno-sign-compare}.
+@item -Wsign-conversion
+@opindex Wsign-conversion
+@opindex Wno-sign-conversion
+Warn for implicit conversions that may change the sign of an integer
+value, like assigning a signed integer expression to an unsigned
+integer variable. An explicit cast silences the warning. In C, this
+option is enabled also by @option{-Wconversion}.
+
@item -Waddress
@opindex Waddress
@opindex Wno-address