aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorGabriel Dos Reis <gdr@integrable-solutions.net>2005-09-09 23:07:55 +0000
committerGabriel Dos Reis <gdr@gcc.gnu.org>2005-09-09 23:07:55 +0000
commita30efae8b9de7699ea70dbf48291466ab2dcd5c6 (patch)
treeedfb2dc71e2310da21d1d4daba3107a5e31168d9 /gcc
parent4f886942ff4d6b10308fd9ad0337bc9459788eb0 (diff)
downloadgcc-a30efae8b9de7699ea70dbf48291466ab2dcd5c6.zip
gcc-a30efae8b9de7699ea70dbf48291466ab2dcd5c6.tar.gz
gcc-a30efae8b9de7699ea70dbf48291466ab2dcd5c6.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/parser.c57
2 files changed, 31 insertions, 31 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 7aa392f..012b6e2 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+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>
PR debug/20998
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index e979e93..a8a2c49 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -2656,39 +2656,34 @@ cp_parser_translation_unit (cp_parser* parser)
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);
-
- /* If there are no tokens left then all went well. */
- if (cp_lexer_next_token_is (parser->lexer, CPP_EOF))
- {
- /* Get rid of the token array; we don't need it any more. */
- cp_lexer_destroy (parser->lexer);
- parser->lexer = NULL;
-
- /* This file might have been a context that's implicitly extern
- "C". If so, pop the lang context. (Only relevant for PCH.) */
- if (parser->implicit_extern_c)
- {
- pop_lang_context ();
- parser->implicit_extern_c = false;
- }
-
- /* Finish up. */
- finish_translation_unit ();
-
- success = true;
- break;
- }
- else
- {
- cp_parser_error (parser, "expected declaration");
- success = false;
- break;
- }
+ /* Get rid of the token array; we don't need it any more. */
+ cp_lexer_destroy (parser->lexer);
+ parser->lexer = NULL;
+
+ /* This file might have been a context that's implicitly extern
+ "C". If so, pop the lang context. (Only relevant for PCH.) */
+ if (parser->implicit_extern_c)
+ {
+ pop_lang_context ();
+ parser->implicit_extern_c = false;
+ }
+
+ /* Finish up. */
+ finish_translation_unit ();
+
+ success = true;
}
-
+ else
+ {
+ cp_parser_error (parser, "expected declaration");
+ success = false;
+ }
+
/* Make sure the declarator obstack was fully cleaned up. */
gcc_assert (obstack_next_free (&declarator_obstack)
== declarator_obstack_base);