+2005-08-09 James A. Morrison <phython@gcc.gnu.org>
+
+ PR c/23161
+ PR c/23165
+ * c-typeck.c (c_finish_if_stmt): Look into STATEMENT_LISTs to see
+ if the if is really empty.
+
2005-08-09 Steven Bosscher <stevenb@suse.de>
PR tree-optimization/23234
/* Diagnose ";" via the special empty statement node that we create. */
if (extra_warnings)
{
- if (TREE_CODE (then_block) == NOP_EXPR && !TREE_TYPE (then_block))
+ tree *inner_then = &then_block, *inner_else = &else_block;
+
+ if (TREE_CODE (*inner_then) == STATEMENT_LIST
+ && STATEMENT_LIST_TAIL (*inner_then))
+ inner_then = &STATEMENT_LIST_TAIL (*inner_then)->stmt;
+ if (*inner_else && TREE_CODE (*inner_else) == STATEMENT_LIST
+ && STATEMENT_LIST_TAIL (*inner_else))
+ inner_else = &STATEMENT_LIST_TAIL (*inner_else)->stmt;
+
+ if (TREE_CODE (*inner_then) == NOP_EXPR && !TREE_TYPE (*inner_then))
{
- if (!else_block)
+ if (!*inner_else)
warning (0, "%Hempty body in an if-statement",
- EXPR_LOCUS (then_block));
- then_block = alloc_stmt_list ();
+ EXPR_LOCUS (*inner_then));
+
+ *inner_then = alloc_stmt_list ();
}
- if (else_block
- && TREE_CODE (else_block) == NOP_EXPR
- && !TREE_TYPE (else_block))
+ if (*inner_else
+ && TREE_CODE (*inner_else) == NOP_EXPR
+ && !TREE_TYPE (*inner_else))
{
warning (0, "%Hempty body in an else-statement",
- EXPR_LOCUS (else_block));
- else_block = alloc_stmt_list ();
+ EXPR_LOCUS (*inner_else));
+
+ *inner_else = alloc_stmt_list ();
}
}
-2005-08-09 Stevem Bosscher <stevenb@suse.de>
+2005-08-09 James A. Morrison <phython@gcc.gnu.org>
+
+ * gcc.dg/pr23165.c: New test.
+
+2005-08-09 Steven Bosscher <stevenb@suse.de>
PR tree-optimization/23234
* gcc.dg/tree-ssa/pr23234.c: New test.