aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel López-Ibáñez <manu@gcc.gnu.org>2007-02-12 09:32:08 +0000
committerManuel López-Ibáñez <manu@gcc.gnu.org>2007-02-12 09:32:08 +0000
commit27f33b1531f5e59660355565e056a6630eafd762 (patch)
treef1b274125c0152bf665584f0c63ddbf388817016
parented41063ab48a701f02fb4389f538d4264b9fc868 (diff)
downloadgcc-27f33b1531f5e59660355565e056a6630eafd762.zip
gcc-27f33b1531f5e59660355565e056a6630eafd762.tar.gz
gcc-27f33b1531f5e59660355565e056a6630eafd762.tar.bz2
re PR middle-end/7651 (Define -Wextra strictly in terms of other warning flags)
2007-02-12 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR middle-end/7651 * doc/invoke.texi (Wunused-value): Update description. (Wextra): Delete item. * opts.c (set_Wextra): Don't use the value of Wextra to set the value of Wunused-value. * c-typeck.c (c_process_expr_stmt): Don't check extra_warnings. (c_finish_stmt_expr): Don't check extra_warnings. (emit_side_effect_warnings): The caller is responsible to check warn_unused_value. cp/ * cp-gimplify.c (gimplify_expr_stmt): Don't check extra_warnings. Check warn_unused_value just once. From-SVN: r121843
-rw-r--r--gcc/ChangeLog12
-rw-r--r--gcc/c-typeck.c8
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/cp-gimplify.c6
-rw-r--r--gcc/doc/invoke.texi17
-rw-r--r--gcc/opts.c1
6 files changed, 32 insertions, 18 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ace8eed..c21e25f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,15 @@
+2007-02-12 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR middle-end/7651
+ * doc/invoke.texi (Wunused-value): Update description.
+ (Wextra): Delete item.
+ * opts.c (set_Wextra): Don't use the value of Wextra to set the
+ value of Wunused-value.
+ * c-typeck.c (c_process_expr_stmt): Don't check extra_warnings.
+ (c_finish_stmt_expr): Don't check extra_warnings.
+ (emit_side_effect_warnings): The caller is responsible to check
+ warn_unused_value.
+
2007-02-11 Roger Sayle <roger@eyesopen.com>
Matt Thomas <matt@3am-software.com>
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 66b109e..013a206 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -7353,10 +7353,10 @@ emit_side_effect_warnings (tree expr)
else if (!TREE_SIDE_EFFECTS (expr))
{
if (!VOID_TYPE_P (TREE_TYPE (expr)) && !TREE_NO_WARNING (expr))
- warning (0, "%Hstatement with no effect",
+ warning (OPT_Wunused_value, "%Hstatement with no effect",
EXPR_HAS_LOCATION (expr) ? EXPR_LOCUS (expr) : &input_location);
}
- else if (warn_unused_value)
+ else
warn_if_unused_value (expr, input_location);
}
@@ -7381,7 +7381,7 @@ c_process_expr_stmt (tree expr)
Warnings for statement expressions will be emitted later, once we figure
out which is the result. */
if (!STATEMENT_LIST_STMT_EXPR (cur_stmt_list)
- && (extra_warnings || warn_unused_value))
+ && warn_unused_value)
emit_side_effect_warnings (expr);
/* If the expression is not of a type to which we cannot assign a line
@@ -7497,7 +7497,7 @@ c_finish_stmt_expr (tree body)
/* If we're supposed to generate side effects warnings, process
all of the statements except the last. */
- if (extra_warnings || warn_unused_value)
+ if (warn_unused_value)
{
for (i = tsi_start (last); !tsi_one_before_end_p (i); tsi_next (&i))
emit_side_effect_warnings (tsi_stmt (i));
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index b7aaff1..95bcd26 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2007-02-12 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR middle-end/7651
+ * cp-gimplify.c (gimplify_expr_stmt): Don't check extra_warnings.
+ Check warn_unused_value just once.
+
2007-02-11 Mark Mitchell <mark@codesourcery.com>
PR c++/26988
diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c
index 5ee1931..6a427c6 100644
--- a/gcc/cp/cp-gimplify.c
+++ b/gcc/cp/cp-gimplify.c
@@ -363,16 +363,16 @@ gimplify_expr_stmt (tree *stmt_p)
In this case we will not want to emit the gimplified statement.
However, we may still want to emit a warning, so we do that before
gimplification. */
- if (stmt && (extra_warnings || warn_unused_value))
+ if (stmt && warn_unused_value)
{
if (!TREE_SIDE_EFFECTS (stmt))
{
if (!IS_EMPTY_STMT (stmt)
&& !VOID_TYPE_P (TREE_TYPE (stmt))
&& !TREE_NO_WARNING (stmt))
- warning (OPT_Wextra, "statement with no effect");
+ warning (OPT_Wunused_value, "statement with no effect");
}
- else if (warn_unused_value)
+ else
warn_if_unused_value (stmt, input_location);
}
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index ad5b31d..b435781 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -2730,10 +2730,14 @@ To suppress this warning use the @samp{unused} attribute
@item -Wunused-value
@opindex Wunused-value
-Warn whenever a statement computes a result that is explicitly not used.
-This warning is enabled by @option{-Wall}.
+Warn whenever a statement computes a result that is explicitly not
+used. To suppress this warning cast the unused expression to
+@samp{void}. This includes an expression-statement or the left-hand
+side of a comma expression that contains no side effects. For example,
+an expression such as @samp{x[i,j]} will cause a warning, while
+@samp{x[(void)i,j]} will not.
-To suppress this warning cast the expression to @samp{void}.
+This warning is enabled by @option{-Wall}.
@item -Wunused
@opindex Wunused
@@ -2909,13 +2913,6 @@ foo (a)
@end smallexample
@item
-An expression-statement or the left-hand side of a comma expression
-contains no side effects.
-To suppress the warning, cast the unused expression to void.
-For example, an expression such as @samp{x[i,j]} will cause a warning,
-but @samp{x[(void)i,j]} will not.
-
-@item
An unsigned value is compared against zero with @samp{<} or @samp{>=}.
@item @r{(C only)}
diff --git a/gcc/opts.c b/gcc/opts.c
index aacc1a3..0fa9814 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -1042,7 +1042,6 @@ static void
set_Wextra (int setting)
{
extra_warnings = setting;
- warn_unused_value = setting;
warn_unused_parameter = (setting && maybe_warn_unused_parameter);
/* We save the value of warn_uninitialized, since if they put