Attachments for gcc bugzilla entry #39028

2009-01-29 Thread Stephan Springl

Hi,

I just wanted to upload the attached files to gcc bugzilla entry #39028, 
but I always hit a bugzilla bug.  Could you please attach these files to 
the bug for me?


Thank you.

Regards
Stephancommit a9f24d7b25568b3fde13ae406deb1aeeacf45e23
Author: Stephan Springl stephan-...@springl.homeip.net
Date:   Thu Jan 29 20:00:31 2009 +0100

fix

diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 5baf5f5..e5bc7f7 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -153,6 +153,13 @@ typedef struct cp_token_cache GTY(())
   cp_token * GTY ((skip)) last;
 } cp_token_cache;
 
+enum cp_scope_begin
+{
+  cp_scope_begin_do,
+  cp_scope_begin_try,
+  cp_scope_begin_dont
+};
+
 /* Prototypes.  */
 
 static cp_lexer *cp_lexer_new_main
@@ -1639,7 +1646,7 @@ static void cp_parser_label_for_labeled_statement
 static tree cp_parser_expression_statement
   (cp_parser *, tree);
 static tree cp_parser_compound_statement
-  (cp_parser *, tree, bool);
+  (cp_parser *, tree, enum cp_scope_begin);
 static void cp_parser_statement_seq_opt
   (cp_parser *, tree);
 static tree cp_parser_selection_statement
@@ -3243,7 +3250,7 @@ cp_parser_primary_expression (cp_parser *parser,
 		/* Start the statement-expression.  */
 		expr = begin_stmt_expr ();
 		/* Parse the compound-statement.  */
-		cp_parser_compound_statement (parser, expr, false);
+		cp_parser_compound_statement (parser, expr, cp_scope_begin_do);
 		/* Finish up.  */
 		expr = finish_stmt_expr (expr, false);
 	  }
@@ -6959,7 +6966,7 @@ cp_parser_statement (cp_parser* parser, tree in_statement_expr,
 }
   /* Anything that starts with a `{' must be a compound-statement.  */
   else if (token-type == CPP_OPEN_BRACE)
-statement = cp_parser_compound_statement (parser, NULL, false);
+statement = cp_parser_compound_statement (parser, NULL, cp_scope_begin_do);
   /* CPP_PRAGMA is a #pragma inside a function body, which constitutes
  a statement all its own.  */
   else if (token-type == CPP_PRAGMA)
@@ -7143,22 +7150,25 @@ cp_parser_expression_statement (cp_parser* parser, tree in_statement_expr)
 
 static tree
 cp_parser_compound_statement (cp_parser *parser, tree in_statement_expr,
-			  bool in_try)
+			  enum cp_scope_begin scope_begin)
 {
-  tree compound_stmt;
+  tree compound_stmt = NULL_TREE;
 
   /* Consume the `{'.  */
   if (!cp_parser_require (parser, CPP_OPEN_BRACE, %{%))
 return error_mark_node;
   /* Begin the compound-statement.  */
-  compound_stmt = begin_compound_stmt (in_try ? BCS_TRY_BLOCK : 0);
+  if (scope_begin != cp_scope_begin_dont)
+compound_stmt = begin_compound_stmt (scope_begin == cp_scope_begin_try ?
+	 BCS_TRY_BLOCK : 0);
   /* If the next keyword is `__label__' we have a label declaration.  */
   while (cp_lexer_next_token_is_keyword (parser-lexer, RID_LABEL))
 cp_parser_label_declaration (parser);
   /* Parse an (optional) statement-seq.  */
   cp_parser_statement_seq_opt (parser, in_statement_expr);
   /* Finish the compound-statement.  */
-  finish_compound_stmt (compound_stmt);
+  if (scope_begin != cp_scope_begin_dont)
+finish_compound_stmt (compound_stmt);
   /* Consume the `}'.  */
   cp_parser_require (parser, CPP_CLOSE_BRACE, %}%);
 
@@ -7812,7 +7822,7 @@ cp_parser_implicitly_scoped_statement (cp_parser* parser, bool *if_p)
 }
   /* if a compound is opened, we simply parse the statement directly.  */
   else if (cp_lexer_next_token_is (parser-lexer, CPP_OPEN_BRACE))
-statement = cp_parser_compound_statement (parser, NULL, false);
+statement = cp_parser_compound_statement (parser, NULL, cp_scope_begin_do);
   /* If the token is not a `{', then we must take special action.  */
   else
 {
@@ -7840,13 +7850,7 @@ cp_parser_already_scoped_statement (cp_parser* parser)
   if (cp_lexer_next_token_is_not (parser-lexer, CPP_OPEN_BRACE))
 cp_parser_statement (parser, NULL_TREE, false, NULL);
   else
-{
-  /* Avoid calling cp_parser_compound_statement, so that we
-	 don't create a new scope.  Do everything else by hand.  */
-  cp_parser_require (parser, CPP_OPEN_BRACE, %{%);
-  cp_parser_statement_seq_opt (parser, NULL_TREE);
-  cp_parser_require (parser, CPP_CLOSE_BRACE, %}%);
-}
+cp_parser_compound_statement (parser, NULL, cp_scope_begin_dont);
 }
 
 /* Declarations [gram.dcl.dcl] */
@@ -14464,7 +14468,7 @@ cp_parser_default_argument (cp_parser *parser, bool template_parm_p)
 static void
 cp_parser_function_body (cp_parser *parser)
 {
-  cp_parser_compound_statement (parser, NULL, false);
+  cp_parser_compound_statement (parser, NULL, cp_scope_begin_do);
 }
 
 /* Parse a ctor-initializer-opt followed by a function-body.  Return
@@ -16374,7 +16378,7 @@ cp_parser_try_block (cp_parser* parser)
 
   cp_parser_require_keyword (parser, RID_TRY, %try%);
   try_block = begin_try_block ();
-  cp_parser_compound_statement (parser, NULL, true);
+  cp_parser_compound_statement (parser, NULL, cp_scope_begin_try);
   finish_try_block (try_block);
   

Re: Attachments for gcc bugzilla entry #39028

2009-01-29 Thread Andrew Pinski
2009/1/29 Stephan Springl springl-...@bfw-online.de:
 Hi,

 I just wanted to upload the attached files to gcc bugzilla entry #39028, but
 I always hit a bugzilla bug.  Could you please attach these files to the bug
 for me?

Well first patches go to gcc-patches@ list with a changelog.  And then
you don't need to upload them.  Also try to login before attaching
them.

Thanks,
Andrew Pinski