diff options
author | Joseph Myers <joseph@codesourcery.com> | 2005-04-28 00:45:48 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2005-04-28 00:45:48 +0000 |
commit | a314840341fc1f4f10d693092b982898678c8a2e (patch) | |
tree | e075ef044741bf5e950cddca77ae2825b21e0291 /gcc/c-typeck.c | |
parent | c454705d5d7171cb704a6fc25d6bfe95448c7ab4 (diff) |
* c-typeck.c (build_compound_expr): Correct logic in last change.
testsuite:
* gcc.dg/void-cast-2.c: New test.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@98901 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-typeck.c')
-rw-r--r-- | gcc/c-typeck.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 281d2b0cf14..3a5d11d1f42 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -3108,12 +3108,13 @@ build_compound_expr (tree expr1, tree expr2) /* The left-hand operand of a comma expression is like an expression statement: with -Wextra or -Wunused, we should warn if it doesn't have any side-effects, unless it was explicitly cast to (void). */ - if (warn_unused_value - && !VOID_TYPE_P (TREE_TYPE (expr1))) + if (warn_unused_value) { - if (TREE_CODE (expr1) == CONVERT_EXPR) + if (VOID_TYPE_P (TREE_TYPE (expr1)) + && TREE_CODE (expr1) == CONVERT_EXPR) ; /* (void) a, b */ - else if (TREE_CODE (expr1) == COMPOUND_EXPR + else if (VOID_TYPE_P (TREE_TYPE (expr1)) + && TREE_CODE (expr1) == COMPOUND_EXPR && TREE_CODE (TREE_OPERAND (expr1, 1)) == CONVERT_EXPR) ; /* (void) a, (void) b, c */ else |