diff options
author | Mark Mitchell <mark@codesourcery.com> | 2002-06-23 20:10:09 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2002-06-23 20:10:09 +0000 |
commit | 80b1331c3edd4d2b88c59165061e404e04f854a9 (patch) | |
tree | 7cc2358a9229ff7a7f7a326aac644a117e0561c0 | |
parent | 08c7ae5a5103100df7b61e27d7e03452c01af9f7 (diff) | |
download | gcc-80b1331c3edd4d2b88c59165061e404e04f854a9.zip gcc-80b1331c3edd4d2b88c59165061e404e04f854a9.tar.gz gcc-80b1331c3edd4d2b88c59165061e404e04f854a9.tar.bz2 |
parse.y (parse_scoped_id): New function.
* parse.y (parse_scoped_id): New function.
(primary): Use it.
* cp-tree.h (do_scoped_id): Adjust declaration.
* lex.c (do_scoped_id): Remove call to yylex.
* decl2.c (build_expr_from_tree): Adjust use of do_scoped_id.
* typeck2.c (add_exception_specifier): Use tree_cons, rather than
expanding it inline.
From-SVN: r54930
-rw-r--r-- | gcc/cp/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 2 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 5 | ||||
-rw-r--r-- | gcc/cp/lex.c | 18 | ||||
-rw-r--r-- | gcc/cp/parse.y | 24 | ||||
-rw-r--r-- | gcc/cp/typeck2.c | 6 |
6 files changed, 40 insertions, 25 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7df80c8..6cbaf2a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,13 @@ +2002-06-23 Mark Mitchell <mark@codesourcery.com> + + * parse.y (parse_scoped_id): New function. + (primary): Use it. + * cp-tree.h (do_scoped_id): Adjust declaration. + * lex.c (do_scoped_id): Remove call to yylex. + * decl2.c (build_expr_from_tree): Adjust use of do_scoped_id. + * typeck2.c (add_exception_specifier): Use tree_cons, rather than + expanding it inline. + 2002-06-23 Matt Thomas <matt@3am-software.com> * decl.c (finish_function): Change "#ifdef VMS_TARGET" to diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 04f0e1b..6b39ada 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -4044,7 +4044,7 @@ extern void note_list_got_semicolon PARAMS ((tree)); extern void do_pending_lang_change PARAMS ((void)); extern void see_typename PARAMS ((void)); extern tree do_identifier PARAMS ((tree, int, tree)); -extern tree do_scoped_id PARAMS ((tree, int)); +extern tree do_scoped_id PARAMS ((tree, tree)); extern tree identifier_typedecl_value PARAMS ((tree)); extern tree build_lang_decl PARAMS ((enum tree_code, tree, tree)); extern void retrofit_lang_decl PARAMS ((tree)); diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 1188bb2..72930c2 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -3652,7 +3652,10 @@ build_expr_from_tree (t) case LOOKUP_EXPR: if (LOOKUP_EXPR_GLOBAL (t)) - return do_scoped_id (TREE_OPERAND (t, 0), 0); + { + tree token = TREE_OPERAND (t, 0); + return do_scoped_id (token, IDENTIFIER_GLOBAL_VALUE (token)); + } else return do_identifier (TREE_OPERAND (t, 0), 0, NULL_TREE); diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index ae2cd32..a5e0b10 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -1281,24 +1281,10 @@ do_identifier (token, parsing, args) } tree -do_scoped_id (token, parsing) +do_scoped_id (token, id) tree token; - int parsing; + tree id; { - tree id; - /* during parsing, this is ::name. Otherwise, it is black magic. */ - if (parsing) - { - id = make_node (CPLUS_BINDING); - if (!qualified_lookup_using_namespace (token, global_namespace, id, 0)) - id = NULL_TREE; - else - id = BINDING_VALUE (id); - } - else - id = IDENTIFIER_GLOBAL_VALUE (token); - if (parsing && yychar == YYEMPTY) - yychar = yylex (); if (!id || (TREE_CODE (id) == FUNCTION_DECL && DECL_ANTICIPATED (id))) { diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y index 4847b3f..31a9ee0 100644 --- a/gcc/cp/parse.y +++ b/gcc/cp/parse.y @@ -130,6 +130,7 @@ static tree parse_bitfield PARAMS ((tree, tree, tree)); static tree parse_method PARAMS ((tree, tree, tree)); static void frob_specs PARAMS ((tree, tree)); static void check_class_key PARAMS ((tree, tree)); +static tree parse_scoped_id PARAMS ((tree)); /* Cons up an empty parameter list. */ static inline tree @@ -1706,14 +1707,14 @@ primary: check_for_new_type ("typeid", $3); $$ = get_typeid (type); } | global_scope IDENTIFIER - { $$ = do_scoped_id ($2, 1); } + { $$ = parse_scoped_id ($2); } | global_scope template_id { $$ = $2; } | global_scope operator_name { got_scope = NULL_TREE; if (TREE_CODE ($2) == IDENTIFIER_NODE) - $$ = do_scoped_id ($2, 1); + $$ = parse_scoped_id ($2); else $$ = $2; } @@ -4022,4 +4023,23 @@ free_parser_stacks () } } +/* Return the value corresponding to TOKEN in the global scope. */ + +static tree +parse_scoped_id (token) + tree token; +{ + tree id; + + id = make_node (CPLUS_BINDING); + if (!qualified_lookup_using_namespace (token, global_namespace, id, 0)) + id = NULL_TREE; + else + id = BINDING_VALUE (id); + if (yychar == YYEMPTY) + yychar = yylex(); + + return do_scoped_id (token, id); +} + #include "gt-cp-parse.h" diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index e034d50..2cb4cc3 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -1372,11 +1372,7 @@ add_exception_specifier (list, spec, complain) if (same_type_p (TREE_VALUE (probe), spec)) break; if (!probe) - { - spec = build_tree_list (NULL_TREE, spec); - TREE_CHAIN (spec) = list; - list = spec; - } + list = tree_cons (NULL_TREE, spec, list); } else if (complain) cxx_incomplete_type_error (NULL_TREE, core); |