OSDN Git Service

(stmt): Don't give more than one error message if a nested `if' has an
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 11 Jul 1994 22:17:57 +0000 (22:17 +0000)
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 11 Jul 1994 22:17:57 +0000 (22:17 +0000)
empty body.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@7722 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/c-parse.in

index c6403e5..bf3183b 100644 (file)
@@ -1680,8 +1680,9 @@ stmt:
                { expand_end_cond ();
                  /* This warning is here instead of in simple_if, because we
                     do not want a warning if an empty if is followed by an
-                    else statement.  */
-                 if (extra_warnings && stmt_count == $<itype>1)
+                    else statement.  Increment stmt_count so we don't
+                    give a second error if this is a nested `if'.  */
+                 if (extra_warnings && stmt_count++ == $<itype>1)
                    warning_with_file_and_line (if_stmt_file, if_stmt_line,
                                                "empty body in an if-statement"); }
 /* Make sure expand_end_cond is run once