parse.y (fn.def2): Fix 'attrs' format.
* parse.y (fn.def2): Fix 'attrs' format. * Makefile.in (CONFLICTS): Update. * parse.y (expr_or_declarator_intern): New rule. (expr_or_declarator, direct_notype_declarator, primary, functional_cast): Use it. (notype_declarator_intern): New rule. (notype_declarator, complex_notype_declarator): Use it. From-SVN: r23159
This commit is contained in:
parent
176b6042f7
commit
52fbc84763
6 changed files with 4557 additions and 4450 deletions
|
@ -1,3 +1,16 @@
|
|||
1998-10-18 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* parse.y (fn.def2): Fix 'attrs' format.
|
||||
|
||||
1998-10-18 Alastair J. Houghton <ajh8@doc.ic.ac.uk>
|
||||
|
||||
* Makefile.in (CONFLICTS): Update.
|
||||
* parse.y (expr_or_declarator_intern): New rule.
|
||||
(expr_or_declarator, direct_notype_declarator, primary,
|
||||
functional_cast): Use it.
|
||||
(notype_declarator_intern): New rule.
|
||||
(notype_declarator, complex_notype_declarator): Use it.
|
||||
|
||||
1998-10-17 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* decl.c (grokfndecl): Set DECL_CONTEXT to namespace if appropriate.
|
||||
|
|
|
@ -219,7 +219,7 @@ parse.o : $(PARSE_C) $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h lex.h \
|
|||
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(BIG_SWITCHFLAG) \
|
||||
`echo $(PARSE_C) | sed 's,^\./,,'`
|
||||
|
||||
CONFLICTS = expect 25 shift/reduce conflicts and 42 reduce/reduce conflicts.
|
||||
CONFLICTS = expect 35 shift/reduce conflicts and 42 reduce/reduce conflicts.
|
||||
$(PARSE_H) : $(PARSE_C)
|
||||
$(PARSE_C) : $(srcdir)/parse.y
|
||||
@echo $(CONFLICTS)
|
||||
|
|
|
@ -8555,6 +8555,11 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
|
|||
decl = *next;
|
||||
switch (TREE_CODE (decl))
|
||||
{
|
||||
case TREE_LIST:
|
||||
/* For attributes. */
|
||||
next = &TREE_VALUE (decl);
|
||||
break;
|
||||
|
||||
case COND_EXPR:
|
||||
ctype = NULL_TREE;
|
||||
next = &TREE_OPERAND (decl, 0);
|
||||
|
@ -9432,6 +9437,16 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
|
|||
}
|
||||
switch (TREE_CODE (declarator))
|
||||
{
|
||||
case TREE_LIST:
|
||||
{
|
||||
/* We encode a declarator with embedded attributes using
|
||||
a TREE_LIST. */
|
||||
tree attrs = TREE_PURPOSE (declarator);
|
||||
declarator = TREE_VALUE (declarator);
|
||||
decl_attributes (type, attrs, NULL_TREE);
|
||||
}
|
||||
break;
|
||||
|
||||
case ARRAY_REF:
|
||||
{
|
||||
register tree itype = NULL_TREE;
|
||||
|
|
|
@ -3939,6 +3939,10 @@ finish_decl_parsing (decl)
|
|||
case ARRAY_REF:
|
||||
TREE_OPERAND (decl, 0) = finish_decl_parsing (TREE_OPERAND (decl, 0));
|
||||
return decl;
|
||||
case TREE_LIST:
|
||||
/* For attribute handling. */
|
||||
TREE_VALUE (decl) = finish_decl_parsing (TREE_VALUE (decl));
|
||||
return decl;
|
||||
default:
|
||||
my_friendly_abort (5);
|
||||
return NULL_TREE;
|
||||
|
|
8916
gcc/cp/parse.c
8916
gcc/cp/parse.c
File diff suppressed because it is too large
Load diff
|
@ -203,6 +203,7 @@ empty_parms ()
|
|||
%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
|
||||
|
@ -216,7 +217,8 @@ empty_parms ()
|
|||
%type <ttype> xexpr parmlist parms bad_parm
|
||||
%type <ttype> identifiers_or_typenames
|
||||
%type <ttype> fcast_or_absdcl regcast_or_absdcl
|
||||
%type <ttype> expr_or_declarator complex_notype_declarator
|
||||
%type <ttype> expr_or_declarator expr_or_declarator_intern
|
||||
%type <ttype> complex_notype_declarator
|
||||
%type <ttype> notype_unqualified_id unqualified_id qualified_id
|
||||
%type <ttype> template_id do_id object_template_id notype_template_declarator
|
||||
%type <ttype> overqualified_id notype_qualified_id any_id
|
||||
|
@ -725,10 +727,12 @@ fn.def2:
|
|||
| typed_declspecs declarator
|
||||
{ tree specs, attrs;
|
||||
split_specs_attrs ($1.t, &specs, &attrs);
|
||||
attrs = build_tree_list (attrs, NULL_TREE);
|
||||
$$ = start_method (specs, $2, attrs); goto rest_of_mdef; }
|
||||
| declmods notype_declarator
|
||||
{ tree specs, attrs;
|
||||
split_specs_attrs ($1, &specs, &attrs);
|
||||
attrs = build_tree_list (attrs, NULL_TREE);
|
||||
$$ = start_method (specs, $2, attrs); goto rest_of_mdef; }
|
||||
| notype_declarator
|
||||
{ $$ = start_method (NULL_TREE, $$, NULL_TREE);
|
||||
|
@ -736,6 +740,7 @@ fn.def2:
|
|||
| declmods constructor_declarator
|
||||
{ tree specs, attrs;
|
||||
split_specs_attrs ($1, &specs, &attrs);
|
||||
attrs = build_tree_list (attrs, NULL_TREE);
|
||||
$$ = start_method (specs, $2, attrs); goto rest_of_mdef; }
|
||||
| constructor_declarator
|
||||
{ $$ = start_method (NULL_TREE, $$, NULL_TREE);
|
||||
|
@ -1325,13 +1330,23 @@ unqualified_id:
|
|||
| SELFNAME
|
||||
;
|
||||
|
||||
expr_or_declarator_intern:
|
||||
expr_or_declarator
|
||||
| attributes expr_or_declarator
|
||||
{
|
||||
/* Provide support for '(' attributes '*' declarator ')'
|
||||
etc */
|
||||
$$ = decl_tree_cons ($1, $2, NULL_TREE);
|
||||
}
|
||||
;
|
||||
|
||||
expr_or_declarator:
|
||||
notype_unqualified_id
|
||||
| '*' expr_or_declarator %prec UNARY
|
||||
| '*' expr_or_declarator_intern %prec UNARY
|
||||
{ $$ = build_parse_node (INDIRECT_REF, $2); }
|
||||
| '&' expr_or_declarator %prec UNARY
|
||||
| '&' expr_or_declarator_intern %prec UNARY
|
||||
{ $$ = build_parse_node (ADDR_EXPR, $2); }
|
||||
| '(' expr_or_declarator ')'
|
||||
| '(' expr_or_declarator_intern ')'
|
||||
{ $$ = $2; }
|
||||
;
|
||||
|
||||
|
@ -1348,8 +1363,8 @@ direct_notype_declarator:
|
|||
to the Koenig lookup shift in primary, below. I hate yacc. */
|
||||
| notype_unqualified_id %prec '('
|
||||
| notype_template_declarator
|
||||
| '(' expr_or_declarator ')'
|
||||
{ $$ = finish_decl_parsing ($2); }
|
||||
| '(' expr_or_declarator_intern ')'
|
||||
{ $$ = finish_decl_parsing ($2); }
|
||||
;
|
||||
|
||||
primary:
|
||||
|
@ -1378,7 +1393,7 @@ primary:
|
|||
}
|
||||
| '(' expr ')'
|
||||
{ $$ = finish_parenthesized_expr ($2); }
|
||||
| '(' expr_or_declarator ')'
|
||||
| '(' expr_or_declarator_intern ')'
|
||||
{ $2 = reparse_decl_as_expr (NULL_TREE, $2);
|
||||
$$ = finish_parenthesized_expr ($2); }
|
||||
| '(' error ')'
|
||||
|
@ -2774,16 +2789,26 @@ direct_after_type_declarator:
|
|||
/* A declarator allowed whether or not there has been
|
||||
an explicit typespec. These cannot redeclare a typedef-name. */
|
||||
|
||||
notype_declarator_intern:
|
||||
notype_declarator
|
||||
| attributes notype_declarator
|
||||
{
|
||||
/* Provide support for '(' attributes '*' declarator ')'
|
||||
etc */
|
||||
$$ = decl_tree_cons ($1, $2, NULL_TREE);
|
||||
}
|
||||
;
|
||||
|
||||
notype_declarator:
|
||||
'*' nonempty_cv_qualifiers notype_declarator %prec UNARY
|
||||
'*' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
|
||||
{ $$ = make_pointer_declarator ($2.t, $3); }
|
||||
| '&' nonempty_cv_qualifiers notype_declarator %prec UNARY
|
||||
| '&' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
|
||||
{ $$ = make_reference_declarator ($2.t, $3); }
|
||||
| '*' notype_declarator %prec UNARY
|
||||
| '*' notype_declarator_intern %prec UNARY
|
||||
{ $$ = make_pointer_declarator (NULL_TREE, $2); }
|
||||
| '&' notype_declarator %prec UNARY
|
||||
| '&' notype_declarator_intern %prec UNARY
|
||||
{ $$ = make_reference_declarator (NULL_TREE, $2); }
|
||||
| ptr_to_mem cv_qualifiers notype_declarator
|
||||
| ptr_to_mem cv_qualifiers notype_declarator_intern
|
||||
{ tree arg = make_pointer_declarator ($2, $3);
|
||||
$$ = build_parse_node (SCOPE_REF, $1, arg);
|
||||
}
|
||||
|
@ -2791,15 +2816,15 @@ notype_declarator:
|
|||
;
|
||||
|
||||
complex_notype_declarator:
|
||||
'*' nonempty_cv_qualifiers notype_declarator %prec UNARY
|
||||
'*' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
|
||||
{ $$ = make_pointer_declarator ($2.t, $3); }
|
||||
| '&' nonempty_cv_qualifiers notype_declarator %prec UNARY
|
||||
| '&' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
|
||||
{ $$ = make_reference_declarator ($2.t, $3); }
|
||||
| '*' complex_notype_declarator %prec UNARY
|
||||
{ $$ = make_pointer_declarator (NULL_TREE, $2); }
|
||||
| '&' complex_notype_declarator %prec UNARY
|
||||
{ $$ = make_reference_declarator (NULL_TREE, $2); }
|
||||
| ptr_to_mem cv_qualifiers notype_declarator
|
||||
| ptr_to_mem cv_qualifiers notype_declarator_intern
|
||||
{ tree arg = make_pointer_declarator ($2, $3);
|
||||
$$ = build_parse_node (SCOPE_REF, $1, arg);
|
||||
}
|
||||
|
@ -2851,7 +2876,7 @@ overqualified_id:
|
|||
functional_cast:
|
||||
typespec '(' nonnull_exprlist ')'
|
||||
{ $$ = build_functional_cast ($1.t, $3); }
|
||||
| typespec '(' expr_or_declarator ')'
|
||||
| typespec '(' expr_or_declarator_intern ')'
|
||||
{ $$ = reparse_decl_as_expr ($1.t, $3); }
|
||||
| typespec fcast_or_absdcl %prec EMPTY
|
||||
{ $$ = reparse_absdcl_as_expr ($1.t, $2); }
|
||||
|
|
Loading…
Add table
Reference in a new issue