aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2009-03-04 15:54:14 +0000
committerIan Lance Taylor <iant@google.com>2009-03-04 15:54:14 +0000
commit6c6b1e664f6e07e9fdcffa98d3c52d4ef7c1a547 (patch)
tree7d05a494017484710ce8bf12ad9749be71e3778d
parent075fca3bb0b4c1f5df9ef2a13bb4d4b7d70e6619 (diff)
* cp/cvt.c (convert_to_void): Only warn about ?: operator with
no effect if neither side has an effect. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-in-cxx@144608 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog.cxx3
-rw-r--r--gcc/cp/cvt.c5
2 files changed, 6 insertions, 2 deletions
diff --git a/gcc/ChangeLog.cxx b/gcc/ChangeLog.cxx
index 91413bf7d3d..859e6b5c8d9 100644
--- a/gcc/ChangeLog.cxx
+++ b/gcc/ChangeLog.cxx
@@ -1,5 +1,8 @@
2009-03-04 Ian Lance Taylor <iant@google.com>
+ * cp/cvt.c (convert_to_void): Only warn about ?: operator with
+ no effect if neither side has an effect.
+
* objc/Make-lang.in (cc1obj-dummy$(exeext)): Link with $(CXX).
(cc1obj$(exeext)): Likewise.
* objc/objc-act.c (objc_rewrite_function_call): Change params to
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index 79f96a4791b..f9f47c81684 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -807,11 +807,12 @@ convert_to_void (tree expr, const char *implicit, int complain)
/* The two parts of a cond expr might be separate lvalues. */
tree op1 = TREE_OPERAND (expr,1);
tree op2 = TREE_OPERAND (expr,2);
+ bool side_effects = TREE_SIDE_EFFECTS (op1) || TREE_SIDE_EFFECTS (op2);
tree new_op1 = convert_to_void
- (op1, (implicit && !TREE_SIDE_EFFECTS (op2)
+ (op1, (implicit && !side_effects
? "second operand of conditional" : NULL), complain);
tree new_op2 = convert_to_void
- (op2, (implicit && !TREE_SIDE_EFFECTS (op1)
+ (op2, (implicit && !side_effects
? "third operand of conditional" : NULL), complain);
expr = build3 (COND_EXPR, TREE_TYPE (new_op1),