end ifc
%{
+#include "config.h"
+
#include <stdio.h>
#include <errno.h>
#include <setjmp.h>
-#include "config.h"
#include "tree.h"
#include "input.h"
#include "c-lex.h"
end ifobjc
\f
%{
-/* Number of statements (loosely speaking) seen so far. */
+/* Number of statements (loosely speaking) and compound statements
+ seen so far. */
static int stmt_count;
-
+static int compstmt_count;
+
/* Input file and line number of the end of the body of last simple_if;
used by the stmt-rule immediately after simple_if returns. */
static char *if_stmt_file;
| sizeof unary_expr %prec UNARY
{ skip_evaluation--;
if (TREE_CODE ($2) == COMPONENT_REF
- && DECL_BIT_FIELD (TREE_OPERAND ($2, 1)))
+ && DECL_C_BIT_FIELD (TREE_OPERAND ($2, 1)))
error ("`sizeof' applied to a bit-field");
$$ = c_sizeof (TREE_TYPE ($2)); }
| sizeof '(' typename ')' %prec HYPERUNARY
if (IDENTIFIER_GLOBAL_VALUE ($1) != error_mark_node
|| IDENTIFIER_ERROR_LOCUS ($1) != current_function_decl)
{
- error ("`%s' undeclared (first use this function)",
+ error ("`%s' undeclared (first use in this function)",
IDENTIFIER_POINTER ($1));
if (! undeclared_variable_notice)
| error compstmt
;
-compstmt: '{' '}'
+compstmt_start: '{' { compstmt_count++; }
+
+compstmt: compstmt_start '}'
{ $$ = convert (void_type_node, integer_zero_node); }
- | '{' pushlevel maybe_label_decls decls xstmts '}'
+ | compstmt_start pushlevel maybe_label_decls decls xstmts '}'
{ emit_line_note (input_filename, lineno);
expand_end_bindings (getdecls (), 1, 0);
$$ = poplevel (1, 1, 0);
pop_momentary_nofree ();
else
pop_momentary (); }
- | '{' pushlevel maybe_label_decls error '}'
+ | compstmt_start pushlevel maybe_label_decls error '}'
{ emit_line_note (input_filename, lineno);
expand_end_bindings (getdecls (), kept_level_p (), 0);
$$ = poplevel (kept_level_p (), 0, 0);
pop_momentary_nofree ();
else
pop_momentary (); }
- | '{' pushlevel maybe_label_decls stmts '}'
+ | compstmt_start pushlevel maybe_label_decls stmts '}'
{ emit_line_note (input_filename, lineno);
expand_end_bindings (getdecls (), kept_level_p (), 0);
$$ = poplevel (kept_level_p (), 0, 0);
/* Value is number of statements counted as of the closeparen. */
simple_if:
if_prefix lineno_labeled_stmt
-/* Make sure expand_end_cond is run once
- for each call to expand_start_cond.
+/* Make sure c_expand_end_cond is run once
+ for each call to c_expand_start_cond.
Otherwise a crash is likely. */
| if_prefix error
;
if_prefix:
IF '(' expr ')'
{ emit_line_note ($<filename>-1, $<lineno>0);
- expand_start_cond (truthvalue_conversion ($3), 0);
+ c_expand_start_cond (truthvalue_conversion ($3), 0,
+ compstmt_count);
$<itype>$ = stmt_count;
if_stmt_file = $<filename>-1;
if_stmt_line = $<lineno>0;
do_stmt_start:
DO
{ stmt_count++;
+ compstmt_count++;
emit_line_note ($<filename>-1, $<lineno>0);
/* See comment in `while' alternative, above. */
emit_nop ();
iterator_expand ($1);
clear_momentary (); }
| simple_if ELSE
- { expand_start_else ();
+ { c_expand_start_else ();
$<itype>1 = stmt_count;
position_after_white_space (); }
lineno_labeled_stmt
- { expand_end_cond ();
+ { c_expand_end_cond ();
if (extra_warnings && stmt_count == $<itype>1)
warning ("empty body in an else-statement"); }
| simple_if %prec IF
- { expand_end_cond ();
+ { c_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. Increment stmt_count so we don't
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.
+/* Make sure c_expand_end_cond is run once
+ for each call to c_expand_start_cond.
Otherwise a crash is likely. */
| simple_if ELSE error
- { expand_end_cond (); }
+ { c_expand_end_cond (); }
| WHILE
{ stmt_count++;
emit_line_note ($<filename>-1, $<lineno>0);