diff options
author | Joseph Myers <jsm@polyomino.org.uk> | 2004-07-19 09:38:52 +0100 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2004-07-19 09:38:52 +0100 |
commit | 487a92fed227132325f624811a4eb80c47da8aca (patch) | |
tree | 435cb0f3950c18eee6ce95cc4156e770e0aac344 /gcc/cp | |
parent | 2de7ffa72b74d7a9a20379a3f121962c6ee8077e (diff) | |
download | gcc-487a92fed227132325f624811a4eb80c47da8aca.zip gcc-487a92fed227132325f624811a4eb80c47da8aca.tar.gz gcc-487a92fed227132325f624811a4eb80c47da8aca.tar.bz2 |
c-tree.h (struct c_expr): Define.
* c-tree.h (struct c_expr): Define.
(C_SET_EXP_ORIGINAL_CODE): Remove.
(parser_build_binary_op, build_compound_expr): Update prototypes.
* c-parse.in (%union): Add exprtype.
(FUNC_NAME): Mark as ttype.
(expr, expr_no_commas, cast_expr, unary_expr, primary): Change to
exprtype.
(expr): Update. Define directly in terms of expr_no_commas
instead of using nonnull_exprlist.
(nonnull_exprlist, unary_expr, cast_expr, expr_no_commas, primary,
offsetof_member_designator, typespec_nonreserved_nonattr, init,
initval, designator, component_declarator,
component_notype_declarator, enumerator, array_declarator,
condition, exexpr, switch_statement, stmt_nocomp, stmt,
nonnull_asm_operands, ivar_declarator, receiver): Update. Don't
set C_EXP_ORIGINAL_CODE. Use TREE_NO_WARNING for assignments
where appropriate.
* c-common.h (C_EXP_ORIGINAL_CODE): Remove.
* c-common.c (c_common_truthvalue_conversion): Don't check
C_EXP_ORIGINAL_CODE.
* c-typeck.c (parser_build_binary_op): Use c_expr structures.
Don't use C_EXP_ORIGINAL_CODE.
(default_conversion, default_function_array_conversion): Don't use
C_EXP_ORIGINAL_CODE. Preserve TREE_NO_WARNING.
(internal_build_compound_expr): Merge into build_compound_expr.
(build_compound_expr): Take two operands instead of a TREE_LIST.
* objc/objc-act.c (get_super_receiver): Update calls to
build_compound_expr.
cp:
* typeck.c (build_modify_expr, build_x_modify_expr): Set
TREE_NO_WARNING on assignments with an operator other than '='.
testsuite:
* g++.dg/warn/Wparentheses-1.C, g++.dg/warn/Wparentheses-2.C,
gcc.dg/Wparentheses-10.c: New tests.
* gcc.dg/Wparentheses-5.c: Remove XFAILs.
From-SVN: r84911
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 8 |
2 files changed, 12 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 66c5480..00ef4b5 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2004-07-19 Joseph S. Myers <jsm@polyomino.org.uk> + + * typeck.c (build_modify_expr, build_x_modify_expr): Set + TREE_NO_WARNING on assignments with an operator other than '='. + 2004-07-10 Steven Bosscher <stevenb@suse.de> Joseph S. Myers <jsm@polyomino.org.uk> diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 21e7fe4..0e23e9a 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -4995,6 +4995,7 @@ build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs) tree lhstype = TREE_TYPE (lhs); tree olhstype = lhstype; tree olhs = NULL_TREE; + bool plain_assign = (modifycode == NOP_EXPR); /* Avoid duplicate error messages from operands that had errors. */ if (lhs == error_mark_node || rhs == error_mark_node) @@ -5254,6 +5255,8 @@ build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs) lhstype, lhs, newrhs); TREE_SIDE_EFFECTS (result) = 1; + if (!plain_assign) + TREE_NO_WARNING (result) = 1; /* If we got the LHS in a different type for storing in, convert the result back to the nominal type of LHS @@ -5285,7 +5288,10 @@ build_x_modify_expr (tree lhs, enum tree_code modifycode, tree rhs) make_node (modifycode), /*overloaded_p=*/NULL); if (rval) - return rval; + { + TREE_NO_WARNING (rval) = 1; + return rval; + } } return build_modify_expr (lhs, modifycode, rhs); } |