re PR c/39889 (Bogus -Wunused-value warning)

PR c/39889
	* stmt.c (warn_if_unused_value): Look through NON_LVALUE_EXPR.

	* gcc.dg/Wunused-value-3.c: New test.

From-SVN: r146812
This commit is contained in:
Jakub Jelinek 2009-04-26 20:53:41 +02:00 committed by Jakub Jelinek
parent 14ea0ed587
commit 78287916d5
4 changed files with 20 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2009-04-26 Jakub Jelinek <jakub@redhat.com>
PR c/39889
* stmt.c (warn_if_unused_value): Look through NON_LVALUE_EXPR.
2009-04-24 Andreas Krebbel <krebbel1@de.ibm.com>
* config/s390/constraints.md ('I', 'J'): Fix condition.

View File

@ -1418,6 +1418,7 @@ warn_if_unused_value (const_tree exp, location_t locus)
goto restart;
case SAVE_EXPR:
case NON_LVALUE_EXPR:
exp = TREE_OPERAND (exp, 0);
goto restart;

View File

@ -1,3 +1,8 @@
2009-04-26 Jakub Jelinek <jakub@redhat.com>
PR c/39889
* gcc.dg/Wunused-value-3.c: New test.
2009-04-24 Paolo Bonzini <bonzini@gnu.org>
PR middle-end/39867

View File

@ -0,0 +1,9 @@
/* PR c/39889 */
/* { dg-do compile } */
/* { dg-options "-Wunused-value" } */
int x;
int foo (void)
{
return (1 ? x = 0 : (void) 0), 0; /* { dg-bogus "value computed is not used" } */
}