+2006-04-30 Roger Sayle <roger@eyesopen.com>
+
+ * common.opt (Woverflow): New command line option.
+ * c-common.c (constant_expression_warning): Check warn_overflow.
+ (overflow_waring): Pass OPT_Woverflow to warning.
+ (unsigned_conversion_warning): Likewise.
+ (convert_and_check): Likewise.
+ * doc/invoke.texi: Document new command line option.
+
2006-04-30 David Edelsohn <edelsohn@gnu.org>
* config/rs6000/rs6000.c (rs6000_override_options): Enable
if ((TREE_CODE (value) == INTEGER_CST || TREE_CODE (value) == REAL_CST
|| TREE_CODE (value) == VECTOR_CST
|| TREE_CODE (value) == COMPLEX_CST)
- && TREE_CONSTANT_OVERFLOW (value) && pedantic)
+ && TREE_CONSTANT_OVERFLOW (value)
+ && warn_overflow
+ && pedantic)
pedwarn ("overflow in constant expression");
}
{
TREE_OVERFLOW (value) = 0;
if (skip_evaluation == 0)
- warning (0, "integer overflow in expression");
+ warning (OPT_Woverflow, "integer overflow in expression");
}
else if ((TREE_CODE (value) == REAL_CST
|| (TREE_CODE (value) == COMPLEX_CST
{
TREE_OVERFLOW (value) = 0;
if (skip_evaluation == 0)
- warning (0, "floating point overflow in expression");
+ warning (OPT_Woverflow, "floating point overflow in expression");
}
else if (TREE_CODE (value) == VECTOR_CST && TREE_OVERFLOW (value))
{
TREE_OVERFLOW (value) = 0;
if (skip_evaluation == 0)
- warning (0, "vector overflow in expression");
+ warning (OPT_Woverflow, "vector overflow in expression");
}
}
{
if (!int_fits_type_p (operand, c_common_signed_type (type)))
/* This detects cases like converting -129 or 256 to unsigned char. */
- warning (0, "large integer implicitly truncated to unsigned type");
+ warning (OPT_Woverflow,
+ "large integer implicitly truncated to unsigned type");
else
warning (OPT_Wconversion,
"negative integer implicitly converted to unsigned type");
|| !constant_fits_type_p (expr,
c_common_unsigned_type (type)))
&& skip_evaluation == 0)
- warning (0, "overflow in implicit constant conversion");
+ warning (OPT_Woverflow,
+ "overflow in implicit constant conversion");
}
else
unsigned_conversion_warning (t, expr);
-Wmain -Wmissing-braces -Wmissing-field-initializers @gol
-Wmissing-format-attribute -Wmissing-include-dirs @gol
-Wmissing-noreturn @gol
--Wno-multichar -Wnonnull -Woverlength-strings -Wpacked -Wpadded @gol
+-Wno-multichar -Wnonnull -Wno-overflow @gol
+-Woverlength-strings -Wpacked -Wpadded @gol
-Wparentheses -Wpointer-arith -Wno-pointer-to-int-cast @gol
-Wredundant-decls @gol
-Wreturn-type -Wsequence-point -Wshadow @gol
(@pxref{Function Attributes}, @pxref{Variable Attributes},
@pxref{Type Attributes}.)
+@item -Wno-overflow
+@opindex Wno-overflow
+Do not warn about compile-time overflow in constant expressions.
+
@item -Wpacked
@opindex Wpacked
Warn if a structure is given the packed attribute, but the packed