diff options
author | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2009-04-21 07:47:13 +0000 |
---|---|---|
committer | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2009-04-21 07:47:13 +0000 |
commit | 1e4ae551ddb8ba1e02e3dd50bc55381d313fed8e (patch) | |
tree | 42ffdc85ff34751f35f4783c71117e6304c80f6b /gcc/cp/tree.c | |
parent | 6e9a9f9fed6b9a26fe8dda1a0a51713007c260a1 (diff) | |
download | gcc-1e4ae551ddb8ba1e02e3dd50bc55381d313fed8e.zip gcc-1e4ae551ddb8ba1e02e3dd50bc55381d313fed8e.tar.gz gcc-1e4ae551ddb8ba1e02e3dd50bc55381d313fed8e.tar.bz2 |
re PR c/16202 (The -Wsequence-point warning misses many important instances)
2009-04-21 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR 16202
* c-typeck.c (lvalue_p): Move declaration ...
* c-common.h (lvalue_p): ... to here.
* c-common.c (candidate_equal_p): New.
(add_tlist): Use it.
(merge_tlist): Use it.
(warn_for_collisions_1): Likewise.
(warning_candidate_p): Accept more candidates.
(verify_tree): A warning candidate can be an expression. Use
candidate_equal_p.
cp/
* tree.c (lvalue_p_1): Use const_tree.
Use CONST_CAST_TREE to avoid warning.
(lvalue_p): Returns bool, receives const_tree.
testsuite/
* gcc.dg/sequence-pt-1.c: Remove XFAILs.
* gcc.dg/sequence-pt-2.c: New.
* gcc.dg/sequence-pt-3.c: New.
* g++.dg/warn/sequence-pt-1.C: Remove XFAILs.
* g++.dg/warn/sequence-pt-2.c: New.
* g++.dg/warn/sequence-pt-3.c: New.
From-SVN: r146472
Diffstat (limited to 'gcc/cp/tree.c')
-rw-r--r-- | gcc/cp/tree.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index b4b977e..c95c11c 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -44,7 +44,7 @@ static tree build_cplus_array_type_1 (tree, tree); static int list_hash_eq (const void *, const void *); static hashval_t list_hash_pieces (tree, tree, tree); static hashval_t list_hash (const void *); -static cp_lvalue_kind lvalue_p_1 (tree, int); +static cp_lvalue_kind lvalue_p_1 (const_tree, int); static tree build_target_expr (tree, tree); static tree count_trees_r (tree *, int *, void *); static tree verify_stmt_tree_r (tree *, int *, void *); @@ -59,7 +59,7 @@ static tree handle_init_priority_attribute (tree *, tree, tree, int, bool *); nonzero, rvalues of class type are considered lvalues. */ static cp_lvalue_kind -lvalue_p_1 (tree ref, +lvalue_p_1 (const_tree ref, int treat_class_rvalues_as_lvalues) { cp_lvalue_kind op1_lvalue_kind = clk_none; @@ -207,7 +207,9 @@ lvalue_p_1 (tree ref, case BASELINK: /* We now represent a reference to a single static member function with a BASELINK. */ - return lvalue_p_1 (BASELINK_FUNCTIONS (ref), + /* This CONST_CAST is okay because BASELINK_FUNCTIONS returns + its argument unmodified and we assign it to a const_tree. */ + return lvalue_p_1 (BASELINK_FUNCTIONS (CONST_CAST_TREE (ref)), treat_class_rvalues_as_lvalues); case NON_DEPENDENT_EXPR: @@ -251,8 +253,8 @@ real_lvalue_p (tree ref) /* This differs from real_lvalue_p in that class rvalues are considered lvalues. */ -int -lvalue_p (tree ref) +bool +lvalue_p (const_tree ref) { return (lvalue_p_1 (ref, /*class rvalue ok*/ 1) != clk_none); |