Warn about unreachable empty compound statements.
authorChristoph Mallon <christoph.mallon@gmx.de>
Wed, 3 Sep 2008 20:16:08 +0000 (20:16 +0000)
committerChristoph Mallon <christoph.mallon@gmx.de>
Wed, 3 Sep 2008 20:16:08 +0000 (20:16 +0000)
[r21681]

parser.c

index 799fa7b..6ccb424 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -5065,9 +5065,9 @@ continue_for:;
 static void check_unreachable(statement_t const* const stmt)
 {
        if (!stmt->base.reachable            &&
-           stmt->kind != STATEMENT_COMPOUND &&
            stmt->kind != STATEMENT_DO_WHILE &&
-           stmt->kind != STATEMENT_FOR) {
+           stmt->kind != STATEMENT_FOR      &&
+           (stmt->kind != STATEMENT_COMPOUND || stmt->compound.statements == NULL)) {
                warningf(&stmt->base.source_position, "statement is unreachable");
        }