diff options
author | Jim Wilson <wilson@gcc.gnu.org> | 1993-07-28 11:06:21 -0700 |
---|---|---|
committer | Jim Wilson <wilson@gcc.gnu.org> | 1993-07-28 11:06:21 -0700 |
commit | 7f3d4b2f7586a5049a8dbb8a572ebf04ba58c92e (patch) | |
tree | 8e9647f38527a96e34cfff809f7505c5b63eb06a /gcc | |
parent | 2516bc12a8e08cc2aa172a7a5d8acd6b0bfdc9de (diff) | |
download | gcc-7f3d4b2f7586a5049a8dbb8a572ebf04ba58c92e.zip gcc-7f3d4b2f7586a5049a8dbb8a572ebf04ba58c92e.tar.gz gcc-7f3d4b2f7586a5049a8dbb8a572ebf04ba58c92e.tar.bz2 |
(simple_if, if_prefix, stmt): Undo Jul 7 change.
(if_prefix): Store stmt_count in $$ not $1.
(stmt): Add comment explaining why empty-if warning is here.
From-SVN: r5029
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/c-parse.in | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/gcc/c-parse.in b/gcc/c-parse.in index bae5736..7acce2a 100644 --- a/gcc/c-parse.in +++ b/gcc/c-parse.in @@ -1568,12 +1568,7 @@ compstmt: '{' '}' /* Value is number of statements counted as of the closeparen. */ simple_if: - if_prefix - { $<itype>1 = stmt_count; } - lineno_labeled_stmt - { if (extra_warnings && stmt_count == $<itype>1) - warning_with_file_and_line (if_stmt_file, if_stmt_line, - "empty body in an if-statement"); } + if_prefix lineno_labeled_stmt /* Make sure expand_end_cond is run once for each call to expand_start_cond. Otherwise a crash is likely. */ @@ -1584,6 +1579,7 @@ if_prefix: IF '(' expr ')' { emit_line_note ($<filename>-1, $<lineno>0); expand_start_cond (truthvalue_conversion ($3), 0); + $<itype>$ = stmt_count; if_stmt_file = $<filename>-1; if_stmt_line = $<lineno>0; position_after_white_space (); } @@ -1658,7 +1654,13 @@ stmt: if (extra_warnings && stmt_count == $<itype>1) warning ("empty body in an else-statement"); } | simple_if %prec IF - { expand_end_cond (); } + { 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) + 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 for each call to expand_start_cond. Otherwise a crash is likely. */ |