diff options
Diffstat (limited to 'contrib/gcc/cp/lex.c')
-rw-r--r-- | contrib/gcc/cp/lex.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/contrib/gcc/cp/lex.c b/contrib/gcc/cp/lex.c index 2239c76..66e45ed 100644 --- a/contrib/gcc/cp/lex.c +++ b/contrib/gcc/cp/lex.c @@ -627,26 +627,18 @@ unqualified_name_lookup_error (tree name) if (name != ansi_opname (ERROR_MARK)) error ("`%D' not defined", name); } - else if (current_function_decl == 0) - error ("`%D' was not declared in this scope", name); else { - if (IDENTIFIER_NAMESPACE_VALUE (name) != error_mark_node - || IDENTIFIER_ERROR_LOCUS (name) != current_function_decl) + error ("`%D' was not declared in this scope", name); + /* Prevent repeated error messages by creating a VAR_DECL with + this NAME in the innermost block scope. */ + if (current_function_decl) { - static int undeclared_variable_notice; - - error ("`%D' undeclared (first use this function)", name); - - if (! undeclared_variable_notice) - { - error ("(Each undeclared identifier is reported only once for each function it appears in.)"); - undeclared_variable_notice = 1; - } + tree decl; + decl = build_decl (VAR_DECL, name, error_mark_node); + DECL_CONTEXT (decl) = current_function_decl; + push_local_binding (name, decl, 0); } - /* Prevent repeated error messages. */ - SET_IDENTIFIER_NAMESPACE_VALUE (name, error_mark_node); - SET_IDENTIFIER_ERROR_LOCUS (name, current_function_decl); } return error_mark_node; |