Commit a30efae8 by Gabriel Dos Reis Committed by Gabriel Dos Reis

parser.c (cp_parser_translation_unit): Simplify.

        * parser.c (cp_parser_translation_unit): Simplify.  The while-block
        was actually executed at most once.

From-SVN: r104115
parent 4f886942
2005-09-09 Gabriel Dos Reis <gdr@integrable-solutions.net>
* parser.c (cp_parser_translation_unit): Simplify. The while-block
was actually executed at most once.
2005-09-09 Richard Henderson <rth@redhat.com> 2005-09-09 Richard Henderson <rth@redhat.com>
PR debug/20998 PR debug/20998
......
...@@ -2656,39 +2656,34 @@ cp_parser_translation_unit (cp_parser* parser) ...@@ -2656,39 +2656,34 @@ cp_parser_translation_unit (cp_parser* parser)
declarator_obstack_base = obstack_next_free (&declarator_obstack); declarator_obstack_base = obstack_next_free (&declarator_obstack);
} }
while (true) cp_parser_declaration_seq_opt (parser);
/* If there are no tokens left then all went well. */
if (cp_lexer_next_token_is (parser->lexer, CPP_EOF))
{ {
cp_parser_declaration_seq_opt (parser); /* Get rid of the token array; we don't need it any more. */
cp_lexer_destroy (parser->lexer);
/* If there are no tokens left then all went well. */ parser->lexer = NULL;
if (cp_lexer_next_token_is (parser->lexer, CPP_EOF))
{ /* This file might have been a context that's implicitly extern
/* Get rid of the token array; we don't need it any more. */ "C". If so, pop the lang context. (Only relevant for PCH.) */
cp_lexer_destroy (parser->lexer); if (parser->implicit_extern_c)
parser->lexer = NULL; {
pop_lang_context ();
/* This file might have been a context that's implicitly extern parser->implicit_extern_c = false;
"C". If so, pop the lang context. (Only relevant for PCH.) */ }
if (parser->implicit_extern_c)
{ /* Finish up. */
pop_lang_context (); finish_translation_unit ();
parser->implicit_extern_c = false;
} success = true;
/* Finish up. */
finish_translation_unit ();
success = true;
break;
}
else
{
cp_parser_error (parser, "expected declaration");
success = false;
break;
}
} }
else
{
cp_parser_error (parser, "expected declaration");
success = false;
}
/* Make sure the declarator obstack was fully cleaned up. */ /* Make sure the declarator obstack was fully cleaned up. */
gcc_assert (obstack_next_free (&declarator_obstack) gcc_assert (obstack_next_free (&declarator_obstack)
== declarator_obstack_base); == declarator_obstack_base);
......
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