]> gcc.gnu.org Git - gcc.git/commitdiff
c-common.c (handle_cleanup_attribute): Use a lang hook for lookup_name.
authorMike Stump <mrs@apple.com>
Fri, 18 Nov 2005 23:40:29 +0000 (23:40 +0000)
committerMike Stump <mrs@gcc.gnu.org>
Fri, 18 Nov 2005 23:40:29 +0000 (23:40 +0000)
* c-common.c (handle_cleanup_attribute): Use a lang hook for lookup_name.
* config/darwin-c.c (darwin_pragma_unused): Likewise.
* c-decl.c (lookup_name_two) Remove.
* c-tree.h (lookup_name_two): Remove.
* c-objc-common.h (LANG_HOOKS_LOOKUP_NAME): Add.
* langhooks-def.h (LANG_HOOKS_LOOKUP_NAME): Add.
(LANG_HOOKS_DECLS): Add initializer for LANG_HOOKS_LOOKUP_NAME.
* langhooks.h (lang_hooks_for_decls): Add lookup_name.

cp:
* cp-objcp-common.h (LANG_HOOKS_LOOKUP_NAME): Add.
* name-lookup.c (lookup_name_two): Remove.
(lookup_name_one): Add.
* name-lookup.h (lookup_name_two): Remove.
(lookup_name_one): Add.

From-SVN: r107196

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

index 031402b5d186e46dc0bf6b2af866735ed6516c48..c4f105fecd87918dedc0f7240154398c61d7da27 100644 (file)
@@ -1,3 +1,14 @@
+2005-11-18  Mike Stump  <mrs@apple.com>
+
+       * c-common.c (handle_cleanup_attribute): Use a lang hook for lookup_name.
+       * config/darwin-c.c (darwin_pragma_unused): Likewise.
+       * c-decl.c (lookup_name_two) Remove.
+       * c-tree.h (lookup_name_two): Remove.
+       * c-objc-common.h (LANG_HOOKS_LOOKUP_NAME): Add.
+       * langhooks-def.h (LANG_HOOKS_LOOKUP_NAME): Add.
+       (LANG_HOOKS_DECLS): Add initializer for LANG_HOOKS_LOOKUP_NAME.
+       * langhooks.h (lang_hooks_for_decls): Add lookup_name.
+       
 2005-11-18  Richard Earnshaw  <richard.earnshaw@arm.com>
 
        PR target/24914
index feb87ef523a2e31213a1a142961c49d622422e69..b54755da38b8ea191da3a2995c97fa4f23155210 100644 (file)
@@ -5464,7 +5464,7 @@ handle_cleanup_attribute (tree *node, tree name, tree args,
       *no_add_attrs = true;
       return NULL_TREE;
     }
-  cleanup_decl = lookup_name_two (cleanup_id, 0);
+  cleanup_decl = lang_hooks.decls.lookup_name (cleanup_id);
   if (!cleanup_decl || TREE_CODE (cleanup_decl) != FUNCTION_DECL)
     {
       error ("cleanup argument not a function");
index 99e91c04406616cb82253a1777607e13e01d66e3..003b813fc7d5f579d5156902eab4e8425bed7435 100644 (file)
@@ -2671,15 +2671,6 @@ lookup_name (tree name)
   return 0;
 }
 
-/* Similar to `lookup_name' for the benefit of common code and the C++
-   front end.  */
-
-tree
-lookup_name_two (tree name, int ARG_UNUSED (prefer_type))
-{
-  return lookup_name (name);
-}
-
 /* Similar to `lookup_name' but look only at the indicated scope.  */
 
 static tree
index 69212599612a8faf1bb4bbf580882854e5583139..706f12075af6ded813b52f29ebb20342cb9fe5aa 100644 (file)
@@ -127,6 +127,8 @@ 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 0399e893e3a8aafbb5f16a25fac5bd2629b31321..0894317e5741e4ec8c614224a8f13792490e0176 100644 (file)
@@ -455,7 +455,6 @@ extern tree grokparm (const struct c_parm *);
 extern tree implicitly_declare (tree);
 extern void keep_next_level (void);
 extern tree lookup_name (tree);
-extern tree lookup_name_two (tree, int);
 extern void pending_xref_error (void);
 extern void c_push_function_context (struct function *);
 extern void c_pop_function_context (struct function *);
index 893aaf7d7b8478ac73d1de517931a2906d25814d..13be8fab95d1149a40c6eefebef80ba71b8f0f79 100644 (file)
@@ -33,6 +33,7 @@ Boston, MA 02110-1301, USA.  */
 #include "tm_p.h"
 #include "cppdefault.h"
 #include "prefix.h"
+#include "langhooks.h"
 
 /* Pragmas.  */
 
@@ -141,7 +142,7 @@ darwin_pragma_unused (cpp_reader *pfile ATTRIBUTE_UNUSED)
       tok = c_lex (&decl);
       if (tok == CPP_NAME && decl)
        {
-         tree local = lookup_name_two (decl, 0);
+         tree local = lang_hooks.decls.lookup_name (decl);
          if (local && (TREE_CODE (local) == PARM_DECL
                        || TREE_CODE (local) == VAR_DECL))
            TREE_USED (local) = 1;
index 378c324909b7fbfe7196149ca5cb8d5ce337af0d..42e44da26ba07ef0f064735be21040d2ead76938 100644 (file)
@@ -1,3 +1,11 @@
+2005-11-18  Mike Stump  <mrs@apple.com>
+
+       * cp-objcp-common.h (LANG_HOOKS_LOOKUP_NAME): Add.
+       * name-lookup.c (lookup_name_two): Remove.
+       (lookup_name_one): Add.
+       * name-lookup.h (lookup_name_two): Remove.
+       (lookup_name_one): Add.
+
 2005-11-15  Jason Merrill  <jason@redhat.com>
 
        PR c++/24580
index 4a4d400cd6f648c50a7bc434c9db8108031b3987..bd7f4f7958c87bb1f3a803a3b5f5bf811eabebd9 100644 (file)
@@ -151,5 +151,7 @@ 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 ce27704f75feefed3981b7244d474d654a1be639..4302ca6194ee2572496cb1f8eb276aae6696a8d7 100644 (file)
@@ -4003,9 +4003,9 @@ lookup_name (tree name, int prefer_type)
 /* Similar to `lookup_name' for the benefit of common code.  */
 
 tree
-lookup_name_two (tree name, int prefer_type)
+lookup_name_one (tree name)
 {
-  return lookup_name (name, prefer_type);
+  return lookup_name (name, 0);
 }
 
 /* Look up NAME for type used in elaborated name specifier in
index a6466d3fb74142d980e0ca04c7db936411b9f0cd..11c1feca5625c59c922771d2fd0a0c0cb664451f 100644 (file)
@@ -313,7 +313,7 @@ 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_two (tree, int);
+extern tree lookup_name_one (tree);
 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 a17927a2eb26f09dd9e732959847c2527ec3d48f..ff5e73efb41cc15ac08ccfa5d62cbd614699702d 100644 (file)
@@ -234,6 +234,7 @@ 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
@@ -245,6 +246,7 @@ 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 cdb547c7cf3140078f9e95a2393cbc0d28b7e0f2..22346fe59059ef995bc811cf14fee2ec2dbb9fdc 100644 (file)
@@ -170,6 +170,12 @@ 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);
This page took 0.095099 seconds and 5 git commands to generate.