* c-parser.c (c_parser_expression): Mark LHS of a comma
expression as read if it is a decl, handled component or
COMPOUND_EXPR with that on the RHS.
* c-typeck.c (c_process_expr_stmt): Mark RHS of COMPOUND_EXPR
if it is a decl or handled component.
* semantics.c (finish_expr_stmt): Don't call mark_exp_read here...
* cvt.c (convert_to_void): ... but here. If expr is a COMPOUND_EXPR,
look at its second operand.
* c-c++-common/Wunused-var-7.c: New test.
* g++.dg/warn/Wunused-var-9.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159286
138bc75d-0d04-0410-961f-
82ee72b054a4
+2010-05-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/44062
+ * c-parser.c (c_parser_expression): Mark LHS of a comma
+ expression as read if it is a decl, handled component or
+ COMPOUND_EXPR with that on the RHS.
+ * c-typeck.c (c_process_expr_stmt): Mark RHS of COMPOUND_EXPR
+ if it is a decl or handled component.
+
2010-05-11 Jan Hubicka <jh@suse.cz>
* lto-symtab.c (lto_symtab_free): New function.
tree
c_process_expr_stmt (location_t loc, tree expr)
{
+ tree exprv;
+
if (!expr)
return NULL_TREE;
&& warn_unused_value)
emit_side_effect_warnings (loc, expr);
- if (DECL_P (expr) || handled_component_p (expr))
- mark_exp_read (expr);
+ exprv = expr;
+ while (TREE_CODE (exprv) == COMPOUND_EXPR)
+ exprv = TREE_OPERAND (exprv, 1);
+ if (DECL_P (exprv) || handled_component_p (exprv))
+ mark_exp_read (exprv);
/* If the expression is not of a type to which we cannot assign a line
number, wrap the thing in a no-op NOP_EXPR. */
+2010-05-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/44062
+ * semantics.c (finish_expr_stmt): Don't call mark_exp_read here...
+ * cvt.c (convert_to_void): ... but here. If expr is a COMPOUND_EXPR,
+ look at its second operand.
+
2010-05-10 Jason Merrill <jason@redhat.com>
PR c++/44017
/* Language-level data type conversion for GNU C++.
Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
tree
convert_to_void (tree expr, const char *implicit, tsubst_flags_t complain)
{
+ tree exprv;
+
if (expr == error_mark_node
|| TREE_TYPE (expr) == error_mark_node)
return error_mark_node;
+
+ exprv = expr;
+ while (TREE_CODE (exprv) == COMPOUND_EXPR)
+ exprv = TREE_OPERAND (exprv, 1);
+ if (DECL_P (exprv) || handled_component_p (exprv))
+ /* Expr is not being 'used' here, otherwise we whould have
+ called mark_{rl}value_use use here, which would have in turn
+ called mark_exp_read. Rather, we call mark_exp_read directly
+ to avoid some warnings when
+ -Wunused-but-set-{variable,parameter} is in effect. */
+ mark_exp_read (exprv);
+
if (!TREE_TYPE (expr))
return expr;
if (invalid_nonstatic_memfn_p (expr, complain))
and during the instantiation of template functions.
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
- 2008, 2009 Free Software Foundation, Inc.
+ 2008, 2009, 2010 Free Software Foundation, Inc.
Written by Mark Mitchell (mmitchell@usa.net) based on code found
formerly in parse.y and pt.c.
{
if (warn_sequence_point)
verify_sequence_points (expr);
- if (TREE_CODE (expr) != MODIFY_EXPR)
- /* Expr is not being 'used' here, otherwise we whould have
- called mark_{rl}value_use use here, which would have in turn
- called mark_exp_read. Rather, we call mark_exp_read directly
- to avoid some warnings when
- -Wunused-but-set-{variable,parameter} is in effect. */
- mark_exp_read (expr);
expr = convert_to_void (expr, "statement", tf_warning_or_error);
}
else if (!type_dependent_expression_p (expr))
+2010-05-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/44062
+ * c-c++-common/Wunused-var-7.c: New test.
+ * g++.dg/warn/Wunused-var-9.C: New test.
+
2010-05-11 Daniel Franke <franke.daniel@gmail.com>
PR fortran/43711