summaryrefslogtreecommitdiff
path: root/gcc/cp/parse.y
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/parse.y')
-rw-r--r--gcc/cp/parse.y65
1 files changed, 29 insertions, 36 deletions
diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y
index b6abd0bfe7a..e815addccee 100644
--- a/gcc/cp/parse.y
+++ b/gcc/cp/parse.y
@@ -103,21 +103,21 @@ int have_extern_spec;
int used_extern_spec;
/* List of types and structure classes of the current declaration. */
-static tree current_declspecs;
+static GTY(()) tree current_declspecs;
/* List of prefix attributes in effect.
Prefix attributes are parsed by the reserved_declspecs and declmods
rules. They create a list that contains *both* declspecs and attrs. */
/* ??? It is not clear yet that all cases where an attribute can now appear in
a declspec list have been updated. */
-static tree prefix_attributes;
+static GTY(()) tree prefix_attributes;
/* When defining an enumeration, this is the type of the enumeration. */
-static tree current_enum_type;
+static GTY(()) tree current_enum_type;
/* When parsing a conversion operator name, this is the scope of the
operator itself. */
-static tree saved_scopes;
+static GTY(()) tree saved_scopes;
static tree empty_parms PARAMS ((void));
static tree parse_decl0 PARAMS ((tree, tree, tree, tree, int));
@@ -263,19 +263,11 @@ check_class_key (key, aggr)
: key == record_type_node ? "struct" : "class", aggr);
}
-void
-cp_parse_init ()
-{
- ggc_add_tree_root (&current_declspecs, 1);
- ggc_add_tree_root (&prefix_attributes, 1);
- ggc_add_tree_root (&current_enum_type, 1);
- ggc_add_tree_root (&saved_scopes, 1);
-}
%}
%start program
-%union {
+%union { GTY(())
long itype;
tree ttype;
char *strtype;
@@ -388,7 +380,7 @@ cp_parse_init ()
%type <ttype> paren_expr_or_null nontrivial_exprlist SELFNAME
%type <ttype> expr_no_commas expr_no_comma_rangle
%type <ttype> cast_expr unary_expr primary STRING
-%type <ttype> reserved_declspecs boolean.literal
+%type <ttype> reserved_declspecs boolean_literal
%type <ttype> reserved_typespecquals
%type <ttype> SCSPEC TYPESPEC CV_QUALIFIER maybe_cv_qualifier
%type <ttype> init initlist maybeasm maybe_init defarg defarg1
@@ -436,13 +428,13 @@ cp_parse_init ()
%token <ttype> PRE_PARSED_CLASS_DECL DEFARG DEFARG_MARKER
%token <pi> PRE_PARSED_FUNCTION_DECL
%type <ttype> component_constructor_declarator
-%type <ttype> fn.def2 return_id constructor_declarator
-%type <ttype> .begin_function_body
+%type <ttype> fn_def2 return_id constructor_declarator
+%type <ttype> begin_function_body_
%type <ttype> class_head class_head_apparent_template
%type <ftype> class_head_decl class_head_defn
%type <ttype> base_class_list
%type <ttype> base_class_access_list
-%type <ttype> base_class maybe_base_class_list base_class.1
+%type <ttype> base_class maybe_base_class_list base_class_1
%type <ttype> exception_specification_opt ansi_raise_identifier ansi_raise_identifiers
%type <ttype> operator_name
%type <ttype> object aggr
@@ -470,7 +462,7 @@ cp_parse_init ()
%token TYPENAME_DEFN IDENTIFIER_DEFN PTYPENAME_DEFN
%type <ttype> identifier_defn IDENTIFIER_DEFN TYPENAME_DEFN PTYPENAME_DEFN
%type <ttype> handler_args
-%type <ttype> self_template_type .finish_template_type
+%type <ttype> self_template_type finish_template_type_
%token NSNAME
%type <ttype> NSNAME
@@ -815,7 +807,7 @@ eat_saved_input:
mem-initializer-list, so we open one there and suppress the one that
actually corresponds to the curly braces. */
function_body:
- .begin_function_body ctor_initializer_opt save_lineno '{'
+ begin_function_body_ ctor_initializer_opt save_lineno '{'
{ $<ttype>$ = begin_compound_stmt (/*has_no_scope=*/1); }
compstmtend
{
@@ -909,7 +901,7 @@ component_constructor_declarator:
/* more C++ complexity. See component_decl for a comment on the
reduce/reduce conflict introduced by these rules. */
-fn.def2:
+fn_def2:
declmods component_constructor_declarator
{ $$ = parse_method ($2, $1.t, $1.lookups);
rest_of_mdef:
@@ -963,7 +955,7 @@ base_init:
}
;
-.begin_function_body:
+begin_function_body_:
/* empty */
{
$$ = begin_function_body ();
@@ -1095,10 +1087,10 @@ end_explicit_instantiation:
template_type:
PTYPENAME '<' template_arg_list_opt template_close_bracket
- .finish_template_type
+ finish_template_type_
{ $$ = $5; }
| TYPENAME '<' template_arg_list_opt template_close_bracket
- .finish_template_type
+ finish_template_type_
{ $$ = $5; }
| self_template_type
;
@@ -1106,17 +1098,17 @@ template_type:
apparent_template_type:
template_type
| identifier '<' template_arg_list_opt '>'
- .finish_template_type
+ finish_template_type_
{ $$ = $5; }
;
self_template_type:
SELFNAME '<' template_arg_list_opt template_close_bracket
- .finish_template_type
+ finish_template_type_
{ $$ = $5; }
;
-.finish_template_type:
+finish_template_type_:
{
if (yychar == YYEMPTY)
yychar = YYLEX;
@@ -1615,7 +1607,7 @@ primary:
$$ = finish_id_expr ($1);
}
| CONSTANT
- | boolean.literal
+ | boolean_literal
| STRING
{
$$ = fix_string_type ($$);
@@ -1813,7 +1805,7 @@ delete:
{ got_scope = NULL_TREE; $$ = 1; }
;
-boolean.literal:
+boolean_literal:
CXX_TRUE
{ $$ = boolean_true_node; }
| CXX_FALSE
@@ -2372,7 +2364,6 @@ structsp:
}
pending_inlines
{
- finish_inline_definitions ();
$$.t = $<ttype>8;
$$.new_type_flag = 1;
}
@@ -2550,13 +2541,13 @@ base_class_list:
;
base_class:
- base_class.1
+ base_class_1
{ $$ = finish_base_specifier (access_default_node, $1); }
- | base_class_access_list see_typename base_class.1
+ | base_class_access_list see_typename base_class_1
{ $$ = finish_base_specifier ($1, $3); }
;
-base_class.1:
+base_class_1:
typename_sub
{ if (!TYPE_P ($$))
$$ = error_mark_node; }
@@ -2632,13 +2623,13 @@ component_decl:
yyungetc ('}', 0); }
/* C++: handle constructors, destructors and inline functions */
/* note that INLINE is like a TYPESPEC */
- | fn.def2 ':' /* base_init compstmt */
+ | fn_def2 ':' /* base_init compstmt */
{ $$ = finish_method ($$); }
- | fn.def2 TRY /* base_init compstmt */
+ | fn_def2 TRY /* base_init compstmt */
{ $$ = finish_method ($$); }
- | fn.def2 RETURN_KEYWORD /* base_init compstmt */
+ | fn_def2 RETURN_KEYWORD /* base_init compstmt */
{ $$ = finish_method ($$); }
- | fn.def2 '{' /* nodecls compstmt */
+ | fn_def2 '{' /* nodecls compstmt */
{ $$ = finish_method ($$); }
| ';'
{ $$ = NULL_TREE; }
@@ -4026,3 +4017,5 @@ free_parser_stacks ()
free (malloced_yyvs);
}
}
+
+#include "gt-cp-parse.h"