This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

(C++) prefix attribute patch


Alastair's October change to support prefix attributes didn't handle
abstract declarators.  Fixes g++.ext/attrib1.C.

1999-04-12  Jason Merrill  <jason@yorick.cygnus.com>

	* parse.y (absdcl_intern): New nonterminal.
	(absdcl, direct_abstract_declarator): Use it.

Index: parse.y
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/parse.y,v
retrieving revision 1.114
diff -c -p -r1.114 parse.y
*** parse.y	1999/04/02 15:36:21	1.114
--- parse.y	1999/04/13 06:47:12
*************** empty_parms ()
*** 204,210 ****
  %type <ttype> compstmt implicitly_scoped_stmt
  
  %type <ttype> declarator notype_declarator after_type_declarator
! %type <ttype> notype_declarator_intern
  %type <ttype> direct_notype_declarator direct_after_type_declarator
  %type <itype> components notype_components
  %type <ttype> component_decl component_decl_1 
--- 204,210 ----
  %type <ttype> compstmt implicitly_scoped_stmt
  
  %type <ttype> declarator notype_declarator after_type_declarator
! %type <ttype> notype_declarator_intern absdcl_intern
  %type <ttype> direct_notype_declarator direct_after_type_declarator
  %type <itype> components notype_components
  %type <ttype> component_decl component_decl_1 
*************** direct_new_declarator:
*** 3090,3108 ****
  		{ $$ = build_parse_node (ARRAY_REF, $$, $3); }
  	;
  
  /* ANSI abstract-declarator (8.1) */
  absdcl:
! 	  '*' nonempty_cv_qualifiers absdcl
  		{ $$ = make_pointer_declarator ($2.t, $3); }
! 	| '*' absdcl
  		{ $$ = make_pointer_declarator (NULL_TREE, $2); }
  	| '*' nonempty_cv_qualifiers  %prec EMPTY
  		{ $$ = make_pointer_declarator ($2.t, NULL_TREE); }
  	| '*'  %prec EMPTY
  		{ $$ = make_pointer_declarator (NULL_TREE, NULL_TREE); }
! 	| '&' nonempty_cv_qualifiers absdcl
  		{ $$ = make_reference_declarator ($2.t, $3); }
! 	| '&' absdcl
  		{ $$ = make_reference_declarator (NULL_TREE, $2); }
  	| '&' nonempty_cv_qualifiers  %prec EMPTY
  		{ $$ = make_reference_declarator ($2.t, NULL_TREE); }
--- 3090,3118 ----
  		{ $$ = build_parse_node (ARRAY_REF, $$, $3); }
  	;
  
+ absdcl_intern:
+ 	  absdcl
+ 	| attributes absdcl
+                 {
+ 		  /* Provide support for '(' attributes '*' declarator ')'
+ 		     etc */
+ 		  $$ = decl_tree_cons ($1, $2, NULL_TREE);
+ 		}
+ 	;
+ 	
  /* ANSI abstract-declarator (8.1) */
  absdcl:
! 	  '*' nonempty_cv_qualifiers absdcl_intern
  		{ $$ = make_pointer_declarator ($2.t, $3); }
! 	| '*' absdcl_intern
  		{ $$ = make_pointer_declarator (NULL_TREE, $2); }
  	| '*' nonempty_cv_qualifiers  %prec EMPTY
  		{ $$ = make_pointer_declarator ($2.t, NULL_TREE); }
  	| '*'  %prec EMPTY
  		{ $$ = make_pointer_declarator (NULL_TREE, NULL_TREE); }
! 	| '&' nonempty_cv_qualifiers absdcl_intern
  		{ $$ = make_reference_declarator ($2.t, $3); }
! 	| '&' absdcl_intern
  		{ $$ = make_reference_declarator (NULL_TREE, $2); }
  	| '&' nonempty_cv_qualifiers  %prec EMPTY
  		{ $$ = make_reference_declarator ($2.t, NULL_TREE); }
*************** absdcl:
*** 3112,3118 ****
  		{ tree arg = make_pointer_declarator ($2, NULL_TREE);
  		  $$ = build_parse_node (SCOPE_REF, $1, arg);
  		}
! 	| ptr_to_mem cv_qualifiers absdcl
  		{ tree arg = make_pointer_declarator ($2, $3);
  		  $$ = build_parse_node (SCOPE_REF, $1, arg);
  		}
--- 3122,3128 ----
  		{ tree arg = make_pointer_declarator ($2, NULL_TREE);
  		  $$ = build_parse_node (SCOPE_REF, $1, arg);
  		}
! 	| ptr_to_mem cv_qualifiers absdcl_intern
  		{ tree arg = make_pointer_declarator ($2, $3);
  		  $$ = build_parse_node (SCOPE_REF, $1, arg);
  		}
*************** absdcl:
*** 3121,3127 ****
  
  /* ANSI direct-abstract-declarator (8.1) */
  direct_abstract_declarator:
! 	  '(' absdcl ')'
  		{ $$ = $2; }
  	  /* `(typedef)1' is `int'.  */
  	| PAREN_STAR_PAREN
--- 3131,3137 ----
  
  /* ANSI direct-abstract-declarator (8.1) */
  direct_abstract_declarator:
! 	  '(' absdcl_intern ')'
  		{ $$ = $2; }
  	  /* `(typedef)1' is `int'.  */
  	| PAREN_STAR_PAREN


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]