]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
parse.y (parse_scoped_id): New function.
authorMark Mitchell <mark@codesourcery.com>
Sun, 23 Jun 2002 20:10:09 +0000 (20:10 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Sun, 23 Jun 2002 20:10:09 +0000 (20:10 +0000)
* 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

gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/decl2.c
gcc/cp/lex.c
gcc/cp/parse.y
gcc/cp/typeck2.c

index 7df80c8f6b1ca71dab68132b571ceeb95b394560..6cbaf2a376f8b7ffff95640cb1b4fe796e4490d8 100644 (file)
@@ -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
index 04f0e1bb5e18d07f5422098b2c576807ee31b697..6b39adade388553a02f5b95d15464ab13c53842c 100644 (file)
@@ -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));
index 1188bb2acc89f377bf66af40002803a9fd880eae..72930c233b72b05f18a23c18d09cbc203e641198 100644 (file)
@@ -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);
 
index ae2cd326ac8f262eda77e2f23a8a4ee361512547..a5e0b1068279a62f93f6a11d29c5b324332e9640 100644 (file)
@@ -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)))
     {
index 4847b3f7a2231a54a6dc76888890c0ca5846b33b..31a9ee007cb7ec05550fdfdc7f6f13b8e4212918 100644 (file)
@@ -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"
index e034d50c09679c4d8b23287390bab387f4ffd4ab..2cb4cc3b01ef80ed0013c4c92ccdee197a892e35 100644 (file)
@@ -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);