[RFC v1 3/5] gcc/c/c-parser.cc: Refactor code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Move {push,pop}_scope() out of c_parser_parms_declarator().
This is in preparation for the following commit.

Signed-off-by: Alejandro Colomar <alx@xxxxxxxxxx>
---
 gcc/c/c-parser.cc | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc
index 8a63dc54c79..f2ce8e54353 100644
--- a/gcc/c/c-parser.cc
+++ b/gcc/c/c-parser.cc
@@ -4904,9 +4904,11 @@ c_parser_direct_declarator (c_parser *parser, bool type_seen_p, c_dtr_syn kind,
 		      || c_parser_next_token_is (parser, CPP_ELLIPSIS)))
 	      || c_parser_next_token_is (parser, CPP_CLOSE_PAREN)))
 	{
+	  push_scope ();
 	  struct c_arg_info *args
 	    = c_parser_parms_declarator (parser, kind == C_DTR_NORMAL,
 					 attrs, have_gnu_attrs);
+	  pop_scope ();
 	  if (args == NULL)
 	    return NULL;
 	  else
@@ -5055,8 +5057,10 @@ c_parser_direct_declarator_inner (c_parser *parser, bool id_present,
       bool have_gnu_attrs = c_parser_next_token_is_keyword (parser,
 							    RID_ATTRIBUTE);
       attrs = c_parser_gnu_attributes (parser);
+      push_scope ();
       args = c_parser_parms_declarator (parser, id_present, attrs,
 					have_gnu_attrs);
+      pop_scope ();
       if (args == NULL)
 	return NULL;
       else
@@ -5090,7 +5094,6 @@ static struct c_arg_info *
 c_parser_parms_declarator (c_parser *parser, bool id_list_ok, tree attrs,
 			   bool have_gnu_attrs)
 {
-  push_scope ();
   declare_parm_level ();
   /* If the list starts with an identifier, it is an identifier list.
      Otherwise, it is either a prototype list or an empty list.  */
@@ -5128,14 +5131,12 @@ c_parser_parms_declarator (c_parser *parser, bool id_list_ok, tree attrs,
 	  struct c_arg_info *ret = build_arg_info ();
 	  ret->types = list;
 	  c_parser_consume_token (parser);
-	  pop_scope ();
 	  return ret;
 	}
       else
 	{
 	  c_parser_skip_until_found (parser, CPP_CLOSE_PAREN,
 				     "expected %<)%>");
-	  pop_scope ();
 	  return NULL;
 	}
     }
@@ -5143,7 +5144,6 @@ c_parser_parms_declarator (c_parser *parser, bool id_list_ok, tree attrs,
     {
       struct c_arg_info *ret
 	= c_parser_parms_list_declarator (parser, attrs, NULL, have_gnu_attrs);
-      pop_scope ();
       return ret;
     }
 }
-- 
2.49.0




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux