]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c-common.c, [...]: Revert 2005-11-18 lookup_name patch.
authorRichard Henderson <rth@redhat.com>
Mon, 21 Nov 2005 21:27:29 +0000 (13:27 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Mon, 21 Nov 2005 21:27:29 +0000 (13:27 -0800)
gcc/
        * c-common.c, config/darwin-c.c, c-decl.c, c-tree.h, c-objc-common.h,
        langhooks-def.h, langhooks.h: Revert 2005-11-18 lookup_name patch.
        * c-tree.h (lookup_name): Move declaration ...
        * c-common.h (lookup_name): ... here.
        * config/darwin-c.c: Include c-common.h.
        * config/t-darwin: Update dependencies.
gcc/cp/
        * cp-objcp-common.h, name-lookup.c, name-lookup.h: Revert 11-18 patch.
        * name-lookup.c (lookup_name): Remove prefer_type argument.
        (lookup_name_prefer_type): New.
        * decl.c (lookup_and_check_tag): Use them.
        * pt.c (tsubst_friend_class): Likewise.
        (lookup_template_class): Likewise.
        (tsubst_copy_and_build): Likewise.
        * name-lookup.h (lookup_name_prefer_type): New.
        (lookup_name): Remove declaration.

From-SVN: r107325

15 files changed:
gcc/ChangeLog
gcc/c-common.c
gcc/c-common.h
gcc/c-objc-common.h
gcc/c-tree.h
gcc/config/darwin-c.c
gcc/config/t-darwin
gcc/cp/ChangeLog
gcc/cp/cp-objcp-common.h
gcc/cp/decl.c
gcc/cp/name-lookup.c
gcc/cp/name-lookup.h
gcc/cp/pt.c
gcc/langhooks-def.h
gcc/langhooks.h

index 528e7a86638434be025b63ca3a7516d43e4daf85..7bb017551134c187e935fd69f08987ac976cf24d 100644 (file)
@@ -1,3 +1,13 @@
+2005-11-21  Richard Henderson  <rth@redhat.com>
+
+       * c-common.c, config/darwin-c.c, c-decl.c, c-tree.h, c-objc-common.h,
+       langhooks-def.h, langhooks.h: Revert 2005-11-18 lookup_name patch.
+
+       * c-tree.h (lookup_name): Move declaration ...
+       * c-common.h (lookup_name): ... here.
+       * config/darwin-c.c: Include c-common.h.
+       * config/t-darwin: Update dependencies.
+
 2005-11-22  Ben Elliston  <bje@au.ibm.com>
 
        * optabs.c (expand_abs_nojump): Use SCALAR_FLOAT_MODE_P instead of
index bdaa9ccd460638297f95e1fee7f15a9f070ed4c8..7b27ba06e4e9d7795765f267fcfd9c33c48c400a 100644 (file)
@@ -5464,7 +5464,7 @@ handle_cleanup_attribute (tree *node, tree name, tree args,
       *no_add_attrs = true;
       return NULL_TREE;
     }
-  cleanup_decl = lang_hooks.decls.lookup_name (cleanup_id);
+  cleanup_decl = lookup_name (cleanup_id);
   if (!cleanup_decl || TREE_CODE (cleanup_decl) != FUNCTION_DECL)
     {
       error ("cleanup argument not a function");
index 4e8485a061af38fa25d4d84a88777cddb7c6b0eb..cf75ed9e82a1294671d14b37a1e020c168b2bf60 100644 (file)
@@ -776,6 +776,7 @@ extern tree finish_label_address_expr (tree);
 /* Same function prototype, but the C and C++ front ends have
    different implementations.  Used in c-common.c.  */
 extern tree lookup_label (tree);
+extern tree lookup_name (tree);
 
 extern int vector_types_convertible_p (tree t1, tree t2);
 
index 706f12075af6ded813b52f29ebb20342cb9fe5aa..69212599612a8faf1bb4bbf580882854e5583139 100644 (file)
@@ -127,8 +127,6 @@ extern void c_initialize_diagnostics (diagnostic_context *);
 
 #undef LANG_HOOKS_GETDECLS
 #define LANG_HOOKS_GETDECLS lhd_return_null_tree_v
-#undef LANG_HOOKS_LOOKUP_NAME
-#define LANG_HOOKS_LOOKUP_NAME lookup_name
 #undef LANG_HOOKS_WRITE_GLOBALS
 #define LANG_HOOKS_WRITE_GLOBALS c_write_global_declarations
 
index 0894317e5741e4ec8c614224a8f13792490e0176..6468ef27cc603a13bfa3f5a7eec3e11790c9c795 100644 (file)
@@ -454,7 +454,6 @@ extern tree groktypename (struct c_type_name *);
 extern tree grokparm (const struct c_parm *);
 extern tree implicitly_declare (tree);
 extern void keep_next_level (void);
-extern tree lookup_name (tree);
 extern void pending_xref_error (void);
 extern void c_push_function_context (struct function *);
 extern void c_pop_function_context (struct function *);
index 13be8fab95d1149a40c6eefebef80ba71b8f0f79..d044deb709c3a22792a6836219e1be4f40a67ae0 100644 (file)
@@ -28,12 +28,12 @@ Boston, MA 02110-1301, USA.  */
 #include "c-pragma.h"
 #include "c-tree.h"
 #include "c-incpath.h"
+#include "c-common.h"
 #include "toplev.h"
 #include "flags.h"
 #include "tm_p.h"
 #include "cppdefault.h"
 #include "prefix.h"
-#include "langhooks.h"
 
 /* Pragmas.  */
 
@@ -142,7 +142,7 @@ darwin_pragma_unused (cpp_reader *pfile ATTRIBUTE_UNUSED)
       tok = c_lex (&decl);
       if (tok == CPP_NAME && decl)
        {
-         tree local = lang_hooks.decls.lookup_name (decl);
+         tree local = lookup_name (decl);
          if (local && (TREE_CODE (local) == PARM_DECL
                        || TREE_CODE (local) == VAR_DECL))
            TREE_USED (local) = 1;
index df1b6320e5d270d9b1eb802ccdb9a29ead2771b4..d59f0b7a162e9b8463b662e179d3c8b7065144cb 100644 (file)
@@ -6,7 +6,7 @@ darwin.o: $(srcdir)/config/darwin.c $(CONFIG_H) $(SYSTEM_H) coretypes.h     \
 
 darwin-c.o: $(srcdir)/config/darwin-c.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
   $(TM_H) $(CPPLIB_H) tree.h c-pragma.h $(C_TREE_H) toplev.h $(TM_P_H) \
-  c-incpath.h flags.h
+  c-incpath.h flags.h $(C_COMMON_H)
        $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/config/darwin-c.c $(PREPROCESSOR_DEFINES)
 
 gt-darwin.h : s-gtype ; @true
index bd711f3aac12a875396788eadbc4beeed56d26f4..87e4598263bec8e24ecccb7cf08da75e1aef01c6 100644 (file)
@@ -1,3 +1,16 @@
+2005-11-21  Richard Henderson  <rth@redhat.com>
+
+       * cp-objcp-common.h, name-lookup.c, name-lookup.h: Revert 11-18 patch.
+
+       * name-lookup.c (lookup_name): Remove prefer_type argument.
+       (lookup_name_prefer_type): New.
+       * decl.c (lookup_and_check_tag): Use them.
+       * pt.c (tsubst_friend_class): Likewise.
+       (lookup_template_class): Likewise.
+       (tsubst_copy_and_build): Likewise.
+       * name-lookup.h (lookup_name_prefer_type): New.
+       (lookup_name): Remove declaration.
+
 2005-11-18  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/8355
index bd7f4f7958c87bb1f3a803a3b5f5bf811eabebd9..4a4d400cd6f648c50a7bc434c9db8108031b3987 100644 (file)
@@ -151,7 +151,5 @@ extern tree objcp_tsubst_copy_and_build (tree, tree, tsubst_flags_t,
 #define LANG_HOOKS_TO_TARGET_CHARSET c_common_to_target_charset
 #undef LANG_HOOKS_GIMPLIFY_EXPR
 #define LANG_HOOKS_GIMPLIFY_EXPR cp_gimplify_expr
-#undef LANG_HOOKS_LOOKUP_NAME
-#define LANG_HOOKS_LOOKUP_NAME lookup_name_one
 
 #endif /* GCC_CP_OBJCP_COMMON */
index 55e26b97ff65c2c6cb8a0e95f460e12093462257..d87983c1cb9fb05b039ee60e8ade89d42c839c5f 100644 (file)
@@ -9293,7 +9293,7 @@ lookup_and_check_tag (enum tag_types tag_code, tree name,
     {
       /* First try ordinary name lookup, ignoring hidden class name
         injected via friend declaration.  */
-      decl = lookup_name (name, 2);
+      decl = lookup_name_prefer_type (name, 2);
       /* If that fails, the name will be placed in the smallest
         non-class, non-function-prototype scope according to 3.3.1/5.
         We may already have a hidden name declared as friend in this
index 382a8a3a3ea432510f12ccf0450df6e509b7f49a..49830c619792b221d3920c9ce06836cfd49a00e9 100644 (file)
@@ -3998,18 +3998,16 @@ lookup_function_nonclass (tree name, tree args, bool block_p)
 }
 
 tree
-lookup_name (tree name, int prefer_type)
+lookup_name (tree name)
 {
-  return lookup_name_real (name, prefer_type, 0, /*block_p=*/true,
-                          0, LOOKUP_COMPLAIN);
+  return lookup_name_real (name, 0, 0, /*block_p=*/true, 0, LOOKUP_COMPLAIN);
 }
 
-/* Similar to `lookup_name' for the benefit of common code.  */
-
 tree
-lookup_name_one (tree name)
+lookup_name_prefer_type (tree name, int prefer_type)
 {
-  return lookup_name (name, 0);
+  return lookup_name_real (name, prefer_type, 0, /*block_p=*/true,
+                          0, LOOKUP_COMPLAIN);
 }
 
 /* Look up NAME for type used in elaborated name specifier in
index 11c1feca5625c59c922771d2fd0a0c0cb664451f..5a1dc8e34f5b9cee0d8632cabb25cf2e7997a4b5 100644 (file)
@@ -312,8 +312,7 @@ extern void pop_nested_namespace (tree);
 extern void pushlevel_class (void);
 extern void poplevel_class (void);
 extern tree pushdecl_with_scope (tree, cxx_scope *, bool);
-extern tree lookup_name        (tree, int);
-extern tree lookup_name_one (tree);
+extern tree lookup_name_prefer_type (tree, int);
 extern tree lookup_name_real (tree, int, int, bool, int, int);
 extern tree lookup_type_scope (tree, tag_scope);
 extern tree namespace_binding (tree, tree);
index 3e495643fd65506392055509c5e992025bf532ac..4f13a7d073e493f2457c49e7a1cb2512702225ac 100644 (file)
@@ -4352,7 +4352,7 @@ lookup_template_class (tree d1,
        {
          if (context)
            push_decl_namespace (context);
-         template = lookup_name (d1, /*prefer_type=*/0);
+         template = lookup_name (d1);
          template = maybe_get_template_decl_from_type_decl (template);
          if (context)
            pop_decl_namespace ();
@@ -5384,7 +5384,7 @@ tsubst_friend_class (tree friend_tmpl, tree args)
     }
 
   /* First, we look for a class template.  */
-  tmpl = lookup_name (DECL_NAME (friend_tmpl), /*prefer_type=*/0);
+  tmpl = lookup_name (DECL_NAME (friend_tmpl));
 
   /* But, if we don't find one, it might be because we're in a
      situation like this:
@@ -5399,7 +5399,7 @@ tsubst_friend_class (tree friend_tmpl, tree args)
      for `S<int>', not the TEMPLATE_DECL.  */
   if (!tmpl || !DECL_CLASS_TEMPLATE_P (tmpl))
     {
-      tmpl = lookup_name (DECL_NAME (friend_tmpl), /*prefer_type=*/1);
+      tmpl = lookup_name_prefer_type (DECL_NAME (friend_tmpl), 1);
       tmpl = maybe_get_template_decl_from_type_decl (tmpl);
     }
 
@@ -8516,7 +8516,7 @@ tsubst_copy_and_build (tree t,
          }
 
        /* Look up the name.  */
-       decl = lookup_name (t, 0);
+       decl = lookup_name (t);
 
        /* By convention, expressions use ERROR_MARK_NODE to indicate
           failure, not NULL_TREE.  */
index ff5e73efb41cc15ac08ccfa5d62cbd614699702d..a17927a2eb26f09dd9e732959847c2527ec3d48f 100644 (file)
@@ -234,7 +234,6 @@ extern tree lhd_make_node (enum tree_code);
 #define LANG_HOOKS_INSERT_BLOCK        insert_block
 #define LANG_HOOKS_PUSHDECL    pushdecl
 #define LANG_HOOKS_GETDECLS    getdecls
-#define LANG_HOOKS_LOOKUP_NAME lhd_return_null_tree
 #define LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL lhd_warn_unused_global_decl
 #define LANG_HOOKS_WRITE_GLOBALS write_global_declarations
 #define LANG_HOOKS_PREPARE_ASSEMBLE_VARIABLE NULL
@@ -246,7 +245,6 @@ extern tree lhd_make_node (enum tree_code);
   LANG_HOOKS_INSERT_BLOCK, \
   LANG_HOOKS_PUSHDECL, \
   LANG_HOOKS_GETDECLS, \
-  LANG_HOOKS_LOOKUP_NAME, \
   LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL, \
   LANG_HOOKS_WRITE_GLOBALS, \
   LANG_HOOKS_PREPARE_ASSEMBLE_VARIABLE, \
index 22346fe59059ef995bc811cf14fee2ec2dbb9fdc..cdb547c7cf3140078f9e95a2393cbc0d28b7e0f2 100644 (file)
@@ -170,12 +170,6 @@ struct lang_hooks_for_decls
   /* Returns the chain of decls so far in the current scope level.  */
   tree (*getdecls) (void);
 
-/* Look up NAME in the current scope and its superiors
-   in the namespace of variables, functions and typedefs.
-   Return a ..._DECL node of some kind representing its definition,
-   or return 0 if it is undefined.  */
-  tree (*lookup_name) (tree);
-
   /* Returns true when we should warn for an unused global DECL.
      We will already have checked that it has static binding.  */
   bool (*warn_unused_global) (tree);