]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
parser.c (cp_parser_translation_unit): Simplify.
authorGabriel Dos Reis <gdr@integrable-solutions.net>
Fri, 9 Sep 2005 23:07:55 +0000 (23:07 +0000)
committerGabriel Dos Reis <gdr@gcc.gnu.org>
Fri, 9 Sep 2005 23:07:55 +0000 (23:07 +0000)
        * parser.c (cp_parser_translation_unit): Simplify.  The while-block
        was actually executed at most once.

From-SVN: r104115

gcc/cp/ChangeLog
gcc/cp/parser.c

index 7aa392f7464f220be18725b10fbede968419025d..012b6e20fcfade78d93da438387cd902a9719ed8 100644 (file)
@@ -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
index e979e939b10cf1901224ead14b10add1096947a5..a8a2c4963e7b6ecab8676343bc69003aedb609f4 100644 (file)
@@ -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);