diff options
author | Jim Wilson <wilson@gcc.gnu.org> | 1993-07-07 15:59:22 -0700 |
---|---|---|
committer | Jim Wilson <wilson@gcc.gnu.org> | 1993-07-07 15:59:22 -0700 |
commit | f5a1436b0118ee3e64439cd5e3d3f3d88cb31c9e (patch) | |
tree | ef96f83bc45b6798be6e91bcd5bca65688f91bc8 | |
parent | ea961c18aaf6bc5c94acb1d756641c7b0ae0511e (diff) | |
download | gcc-f5a1436b0118ee3e64439cd5e3d3f3d88cb31c9e.zip gcc-f5a1436b0118ee3e64439cd5e3d3f3d88cb31c9e.tar.gz gcc-f5a1436b0118ee3e64439cd5e3d3f3d88cb31c9e.tar.bz2 |
(simple_if): Save stmt_count, and print empty body warning here.
(simple_if): Save stmt_count, and print empty body
warning here.
(if_prefix): Don't save stmt_count here.
(stmt): Don't print empty body warning here.
From-SVN: r4880
-rw-r--r-- | gcc/c-parse.in | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/gcc/c-parse.in b/gcc/c-parse.in index 81450fb..a62e292 100644 --- a/gcc/c-parse.in +++ b/gcc/c-parse.in @@ -1543,7 +1543,12 @@ compstmt: '{' '}' /* Value is number of statements counted as of the closeparen. */ simple_if: - if_prefix lineno_labeled_stmt + 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"); } /* Make sure expand_end_cond is run once for each call to expand_start_cond. Otherwise a crash is likely. */ @@ -1554,7 +1559,6 @@ if_prefix: IF '(' expr ')' { emit_line_note ($<filename>-1, $<lineno>0); expand_start_cond (truthvalue_conversion ($3), 0); - $<itype>1 = stmt_count; if_stmt_file = $<filename>-1; if_stmt_line = $<lineno>0; position_after_white_space (); } @@ -1629,10 +1633,7 @@ stmt: if (extra_warnings && stmt_count == $<itype>1) warning ("empty body in an else-statement"); } | simple_if %prec IF - { expand_end_cond (); - if (extra_warnings && stmt_count == $<itype>1) - warning_with_file_and_line (if_stmt_file, if_stmt_line, - "empty body in an if-statement"); } + { expand_end_cond (); } /* Make sure expand_end_cond is run once for each call to expand_start_cond. Otherwise a crash is likely. */ |