Commit 818e50a5 by Jeffrey A Law Committed by Jeff Law

c-parse.in (undeclared variable error): Tweak error message to be clearer.

        * c-parse.in (undeclared variable error): Tweak error message to
        be clearer.

From-SVN: r18341
parent c93dc3ac
Sun Mar 1 17:48:46 1998 Jeffrey A Law (law@cygnus.com)
* c-parse.in (undeclared variable error): Tweak error message to
be clearer.
Sun Mar 1 10:22:36 PST 1998 Jeff Law (law@cygnus.com) Sun Mar 1 10:22:36 PST 1998 Jeff Law (law@cygnus.com)
* version.c: Bump for snapshot. * version.c: Bump for snapshot.
......
...@@ -58,11 +58,12 @@ State 434 contains 2 shift/reduce conflicts. (Four ways to parse this.) */ ...@@ -58,11 +58,12 @@ State 434 contains 2 shift/reduce conflicts. (Four ways to parse this.) */
end ifc end ifc
%{ %{
#include "config.h"
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#include <setjmp.h> #include <setjmp.h>
#include "config.h"
#include "tree.h" #include "tree.h"
#include "input.h" #include "input.h"
#include "c-lex.h" #include "c-lex.h"
...@@ -232,8 +233,10 @@ ifobjc ...@@ -232,8 +233,10 @@ ifobjc
end ifobjc end ifobjc
%{ %{
/* 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 stmt_count;
static int compstmt_count;
/* Input file and line number of the end of the body of last simple_if; /* 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. */ used by the stmt-rule immediately after simple_if returns. */
...@@ -487,7 +490,7 @@ unary_expr: ...@@ -487,7 +490,7 @@ unary_expr:
| sizeof unary_expr %prec UNARY | sizeof unary_expr %prec UNARY
{ skip_evaluation--; { skip_evaluation--;
if (TREE_CODE ($2) == COMPONENT_REF 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"); error ("`sizeof' applied to a bit-field");
$$ = c_sizeof (TREE_TYPE ($2)); } $$ = c_sizeof (TREE_TYPE ($2)); }
| sizeof '(' typename ')' %prec HYPERUNARY | sizeof '(' typename ')' %prec HYPERUNARY
...@@ -679,7 +682,7 @@ end ifobjc ...@@ -679,7 +682,7 @@ end ifobjc
if (IDENTIFIER_GLOBAL_VALUE ($1) != error_mark_node if (IDENTIFIER_GLOBAL_VALUE ($1) != error_mark_node
|| IDENTIFIER_ERROR_LOCUS ($1) != current_function_decl) || 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)); IDENTIFIER_POINTER ($1));
if (! undeclared_variable_notice) if (! undeclared_variable_notice)
...@@ -1735,9 +1738,11 @@ compstmt_or_error: ...@@ -1735,9 +1738,11 @@ compstmt_or_error:
| error compstmt | error compstmt
; ;
compstmt: '{' '}' compstmt_start: '{' { compstmt_count++; }
compstmt: compstmt_start '}'
{ $$ = convert (void_type_node, integer_zero_node); } { $$ = 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); { emit_line_note (input_filename, lineno);
expand_end_bindings (getdecls (), 1, 0); expand_end_bindings (getdecls (), 1, 0);
$$ = poplevel (1, 1, 0); $$ = poplevel (1, 1, 0);
...@@ -1745,7 +1750,7 @@ compstmt: '{' '}' ...@@ -1745,7 +1750,7 @@ compstmt: '{' '}'
pop_momentary_nofree (); pop_momentary_nofree ();
else else
pop_momentary (); } pop_momentary (); }
| '{' pushlevel maybe_label_decls error '}' | compstmt_start pushlevel maybe_label_decls error '}'
{ emit_line_note (input_filename, lineno); { emit_line_note (input_filename, lineno);
expand_end_bindings (getdecls (), kept_level_p (), 0); expand_end_bindings (getdecls (), kept_level_p (), 0);
$$ = poplevel (kept_level_p (), 0, 0); $$ = poplevel (kept_level_p (), 0, 0);
...@@ -1753,7 +1758,7 @@ compstmt: '{' '}' ...@@ -1753,7 +1758,7 @@ compstmt: '{' '}'
pop_momentary_nofree (); pop_momentary_nofree ();
else else
pop_momentary (); } pop_momentary (); }
| '{' pushlevel maybe_label_decls stmts '}' | compstmt_start pushlevel maybe_label_decls stmts '}'
{ emit_line_note (input_filename, lineno); { emit_line_note (input_filename, lineno);
expand_end_bindings (getdecls (), kept_level_p (), 0); expand_end_bindings (getdecls (), kept_level_p (), 0);
$$ = poplevel (kept_level_p (), 0, 0); $$ = poplevel (kept_level_p (), 0, 0);
...@@ -1766,8 +1771,8 @@ compstmt: '{' '}' ...@@ -1766,8 +1771,8 @@ compstmt: '{' '}'
/* Value is number of statements counted as of the closeparen. */ /* Value is number of statements counted as of the closeparen. */
simple_if: simple_if:
if_prefix lineno_labeled_stmt if_prefix lineno_labeled_stmt
/* Make sure expand_end_cond is run once /* Make sure c_expand_end_cond is run once
for each call to expand_start_cond. for each call to c_expand_start_cond.
Otherwise a crash is likely. */ Otherwise a crash is likely. */
| if_prefix error | if_prefix error
; ;
...@@ -1775,7 +1780,8 @@ simple_if: ...@@ -1775,7 +1780,8 @@ simple_if:
if_prefix: if_prefix:
IF '(' expr ')' IF '(' expr ')'
{ emit_line_note ($<filename>-1, $<lineno>0); { 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; $<itype>$ = stmt_count;
if_stmt_file = $<filename>-1; if_stmt_file = $<filename>-1;
if_stmt_line = $<lineno>0; if_stmt_line = $<lineno>0;
...@@ -1788,6 +1794,7 @@ if_prefix: ...@@ -1788,6 +1794,7 @@ if_prefix:
do_stmt_start: do_stmt_start:
DO DO
{ stmt_count++; { stmt_count++;
compstmt_count++;
emit_line_note ($<filename>-1, $<lineno>0); emit_line_note ($<filename>-1, $<lineno>0);
/* See comment in `while' alternative, above. */ /* See comment in `while' alternative, above. */
emit_nop (); emit_nop ();
...@@ -1850,15 +1857,15 @@ stmt: ...@@ -1850,15 +1857,15 @@ stmt:
iterator_expand ($1); iterator_expand ($1);
clear_momentary (); } clear_momentary (); }
| simple_if ELSE | simple_if ELSE
{ expand_start_else (); { c_expand_start_else ();
$<itype>1 = stmt_count; $<itype>1 = stmt_count;
position_after_white_space (); } position_after_white_space (); }
lineno_labeled_stmt lineno_labeled_stmt
{ expand_end_cond (); { c_expand_end_cond ();
if (extra_warnings && stmt_count == $<itype>1) if (extra_warnings && stmt_count == $<itype>1)
warning ("empty body in an else-statement"); } warning ("empty body in an else-statement"); }
| simple_if %prec IF | simple_if %prec IF
{ expand_end_cond (); { c_expand_end_cond ();
/* This warning is here instead of in simple_if, because we /* This warning is here instead of in simple_if, because we
do not want a warning if an empty if is followed by an do not want a warning if an empty if is followed by an
else statement. Increment stmt_count so we don't else statement. Increment stmt_count so we don't
...@@ -1866,11 +1873,11 @@ stmt: ...@@ -1866,11 +1873,11 @@ stmt:
if (extra_warnings && stmt_count++ == $<itype>1) if (extra_warnings && stmt_count++ == $<itype>1)
warning_with_file_and_line (if_stmt_file, if_stmt_line, warning_with_file_and_line (if_stmt_file, if_stmt_line,
"empty body in an if-statement"); } "empty body in an if-statement"); }
/* Make sure expand_end_cond is run once /* Make sure c_expand_end_cond is run once
for each call to expand_start_cond. for each call to c_expand_start_cond.
Otherwise a crash is likely. */ Otherwise a crash is likely. */
| simple_if ELSE error | simple_if ELSE error
{ expand_end_cond (); } { c_expand_end_cond (); }
| WHILE | WHILE
{ stmt_count++; { stmt_count++;
emit_line_note ($<filename>-1, $<lineno>0); emit_line_note ($<filename>-1, $<lineno>0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment