* 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
+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
*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");
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
#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
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 *);
#include "tm_p.h"
#include "cppdefault.h"
#include "prefix.h"
+#include "langhooks.h"
/* Pragmas. */
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;
+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
#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 */
/* 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
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);
#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
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, \
/* 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);