diff options
author | mrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-11-18 23:40:29 +0000 |
---|---|---|
committer | mrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-11-18 23:40:29 +0000 |
commit | 0e10fb82d727003bc4986df38da739543aad986d (patch) | |
tree | 4485e94760f589adf0f27e512f1e74736da95b8d | |
parent | 92016de0fc06c09cfcfd3c7ff5009a9230050816 (diff) | |
download | gcc-0e10fb82d727003bc4986df38da739543aad986d.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@107196 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/c-common.c | 2 | ||||
-rw-r--r-- | gcc/c-decl.c | 9 | ||||
-rw-r--r-- | gcc/c-objc-common.h | 2 | ||||
-rw-r--r-- | gcc/c-tree.h | 1 | ||||
-rw-r--r-- | gcc/config/darwin-c.c | 3 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/cp-objcp-common.h | 2 | ||||
-rw-r--r-- | gcc/cp/name-lookup.c | 4 | ||||
-rw-r--r-- | gcc/cp/name-lookup.h | 2 | ||||
-rw-r--r-- | gcc/langhooks-def.h | 2 | ||||
-rw-r--r-- | gcc/langhooks.h | 6 |
12 files changed, 37 insertions, 15 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 031402b5d18..c4f105fecd8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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 diff --git a/gcc/c-common.c b/gcc/c-common.c index feb87ef523a..b54755da38b 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -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"); diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 99e91c04406..003b813fc7d 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -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 diff --git a/gcc/c-objc-common.h b/gcc/c-objc-common.h index 69212599612..706f12075af 100644 --- a/gcc/c-objc-common.h +++ b/gcc/c-objc-common.h @@ -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 diff --git a/gcc/c-tree.h b/gcc/c-tree.h index 0399e893e3a..0894317e574 100644 --- a/gcc/c-tree.h +++ b/gcc/c-tree.h @@ -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 *); diff --git a/gcc/config/darwin-c.c b/gcc/config/darwin-c.c index 893aaf7d7b8..13be8fab95d 100644 --- a/gcc/config/darwin-c.c +++ b/gcc/config/darwin-c.c @@ -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; diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 378c324909b..42e44da26ba 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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 diff --git a/gcc/cp/cp-objcp-common.h b/gcc/cp/cp-objcp-common.h index 4a4d400cd6f..bd7f4f7958c 100644 --- a/gcc/cp/cp-objcp-common.h +++ b/gcc/cp/cp-objcp-common.h @@ -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 */ diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index ce27704f75f..4302ca6194e 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -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 diff --git a/gcc/cp/name-lookup.h b/gcc/cp/name-lookup.h index a6466d3fb74..11c1feca562 100644 --- a/gcc/cp/name-lookup.h +++ b/gcc/cp/name-lookup.h @@ -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); diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h index a17927a2eb2..ff5e73efb41 100644 --- a/gcc/langhooks-def.h +++ b/gcc/langhooks-def.h @@ -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, \ diff --git a/gcc/langhooks.h b/gcc/langhooks.h index cdb547c7cf3..22346fe5905 100644 --- a/gcc/langhooks.h +++ b/gcc/langhooks.h @@ -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); |