tree.c (equal_functions): Fix name in prototype.
authorJason Merrill <jason@yorick.cygnus.com>
Tue, 26 Jan 1999 02:33:46 +0000 (02:33 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 26 Jan 1999 02:33:46 +0000 (21:33 -0500)
* tree.c (equal_functions): Fix name in prototype.
* decl.c (push_local_binding): Add FLAGS argument.
(pushdecl, push_overloaded_decl): Pass it.
* decl2.c (do_local_using_decl): Likewise.
* cp-tree.h: Adjust prototype.
* decl.c (poplevel): Fix logic.

From-SVN: r24869

gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/decl2.c
gcc/cp/tree.c

index 8015d38f2ca438e970e82b702e9010199898c1c5..edffd63980d09804126afc1f7a61dec0b12639ae 100644 (file)
@@ -1,5 +1,13 @@
 1999-01-26  Jason Merrill  <jason@yorick.cygnus.com>
 
+       * tree.c (equal_functions): Fix name in prototype.
+
+       * decl.c (push_local_binding): Add FLAGS argument.
+       (pushdecl, push_overloaded_decl): Pass it.
+       * decl2.c (do_local_using_decl): Likewise.
+       * cp-tree.h: Adjust prototype.
+       * decl.c (poplevel): Fix logic.
+
        * decl.c (push_local_binding): Also wrap used decls in a TREE_LIST.
        (poplevel): Handle that.  Fix logic for removing TREE_LISTs.
        (cat_namespace_levels): Don't loop forever.
index e26a910cc67b97aab9ca5839bf0148a0dfb11e85..534fadc06087c68b6888c602de9a2bc519e9d29a 100644 (file)
@@ -2822,7 +2822,7 @@ extern void revert_static_member_fn             PROTO((tree*, tree*, tree*));
 extern void cat_namespace_levels                PROTO((void));
 extern void fixup_anonymous_union               PROTO((tree));
 extern int check_static_variable_definition     PROTO((tree, tree));
-extern void push_local_binding                  PROTO((tree, tree));
+extern void push_local_binding                  PROTO((tree, tree, int));
 extern void push_class_binding                  PROTO((tree, tree));
 extern tree check_default_argument              PROTO((tree, tree));
 extern tree push_overloaded_decl               PROTO((tree, int));
index e3ed11635d44b4a11869f7ceb8460d343c4ea944..401158192879d765b251c9de1fde18b7493df393 100644 (file)
@@ -1117,12 +1117,15 @@ add_binding (id, decl)
     }
 }
 
-/* Bind DECL to ID in the current_binding_level.  */
+/* Bind DECL to ID in the current_binding_level.
+   If PUSH_USING is set in FLAGS, we know that DECL doesn't really belong
+   to this binding level, that it got here through a using-declaration.  */
 
 void
-push_local_binding (id, decl)
+push_local_binding (id, decl, flags)
      tree id;
      tree decl;
+     int flags;
 {
   tree d = decl;
 
@@ -1133,8 +1136,7 @@ push_local_binding (id, decl)
     /* Create a new binding.  */
     push_binding (id, d, current_binding_level);
 
-  if (TREE_CODE (decl) == OVERLOAD
-      || (DECL_P (decl) && DECL_NAMESPACE_SCOPE_P (decl)))
+  if (TREE_CODE (decl) == OVERLOAD || (flags & PUSH_USING))
     /* We must put the OVERLOAD into a TREE_LIST since the
        TREE_CHAIN of an OVERLOAD is already used.  Similarly for
        decls that got here through a using-declaration.  */
@@ -1425,12 +1427,13 @@ poplevel (keep, reverse, functionbody)
       else 
        {
          /* Remove the binding.  */
-         if (TREE_CODE (link) == TREE_LIST)
-           link = TREE_VALUE (link);
-         if (TREE_CODE_CLASS (TREE_CODE (link)) == 'd')
-           pop_binding (DECL_NAME (link), link);
-         else if (TREE_CODE (link) == OVERLOAD)
-           pop_binding (DECL_NAME (OVL_FUNCTION (link)), link);
+         decl = link;
+         if (TREE_CODE (decl) == TREE_LIST)
+           decl = TREE_VALUE (decl);
+         if (TREE_CODE_CLASS (TREE_CODE (decl)) == 'd')
+           pop_binding (DECL_NAME (decl), decl);
+         else if (TREE_CODE (decl) == OVERLOAD)
+           pop_binding (DECL_NAME (OVL_FUNCTION (decl)), decl);
          else 
            my_friendly_abort (0);
        }
@@ -3798,7 +3801,7 @@ pushdecl (x)
 
          if (need_new_binding)
            {
-             push_local_binding (name, x);
+             push_local_binding (name, x, 0);
              /* Because push_local_binding will hook X on to the
                 current_binding_level's name list, we don't want to
                 do that again below.  */
@@ -4296,7 +4299,7 @@ push_overloaded_decl (decl, flags)
        }
 
       /* Install the new binding.  */
-      push_local_binding (name, new_binding);
+      push_local_binding (name, new_binding, flags);
     }
 
   return decl;
index 867cf96c653f80083194ab6eadb168c6948cf711..5c1cb4c26de59f6a202f3a3d8d2cadcf2b71eed3 100644 (file)
@@ -4900,7 +4900,7 @@ do_local_using_decl (decl)
                                  PUSH_LOCAL | PUSH_USING);
        }
       else
-       push_local_binding (name, newval);
+       push_local_binding (name, newval, PUSH_USING);
     }
   if (newtype)
     set_identifier_type_value (name, newtype);
index d318d1be988a23c9fd34b4cb9ec5c0e49c1e2e1d..3e5048f9f10b33ed74911f2305f4c30076b2ebf7 100644 (file)
@@ -41,7 +41,7 @@ static tree list_hash_lookup PROTO((int, int, int, int, tree, tree,
 static void propagate_binfo_offsets PROTO((tree, tree));
 static int avoid_overlap PROTO((tree, tree));
 static int lvalue_p_1 PROTO((tree, int));
-static int equal_function PROTO((tree, tree));
+static int equal_functions PROTO((tree, tree));
 
 #define CEIL(x,y) (((x) + (y) - 1) / (y))