8sa1-gcc/gcc/testsuite/gcc.dg/20020104-1.c
Jakub Jelinek b0832fe1f3 tree.h (expand_expr_stmt_value): Add maybe_last argument.
* tree.h (expand_expr_stmt_value): Add maybe_last argument.
	* c-common.h (genrtl_expr_stmt_value): Likewise.
	* stmt.c (expand_expr_stmt): Pass 1 as maybe_last.
	(expand_expr_stmt_value): Add maybe_last argument.
	Don't warn about statement with no effect if it is the last statement
	in expression statement.
	* c-semantics.c (genrtl_expr_stmt): Pass 1 as maybe_last.
	(genrtl_expr_stmt_value): Add maybe_last argument, pass it down to
	expand_expr_stmt_value.
	(expand_stmt) [EXPR_STMT]: Pass 1 as maybe_last to
	genrtl_expr_stmt_value if t is the last EXPR_STMT in its scope.
	* expr.c (expand_expr) [LABELED_BLOCK_EXPR, LOOP_EXPR]: Pass 1
	as maybe_last to expand_expr_stmt_value.

	* gcc.dg/20020104-1.c: New test.

From-SVN: r48541
2002-01-04 22:03:20 +01:00

23 lines
593 B
C

/* Test whether statement with no effect warnings are not given for last
statements inside of statement expression. */
/* { dg-do compile } */
/* { dg-options "-O -Wall" } */
void bar (char *p, char *q);
int main()
{
char foo [32], *p;
({
void *s = (foo);
__builtin_memset (s, '\0', sizeof (foo));
s; /* { dg-warning "no effect" "statement with no effect warning" } */
s; /* { dg-bogus "no effect" "bogus statement with no effect warning" } */
});
p = foo;
p; /* { dg-warning "no effect" "statement with no effect warning" } */
bar (foo, p);
return 0;
}