Commit 98803730 by Mike Stump Committed by Mike Stump

c-decl.c (lookup_name_two): Add.

	* c-decl.c (lookup_name_two): Add.
	* c-tree.h (lookup_name_two): Likewise.
	* c-common.c (handle_cleanup_attribute): Use lookup_name_two instead.
	* config/darwin-c.c (darwin_pragma_unused): Likewise.

cp:
	* name-lookup.c (lookup_name_two): Add.
	* name-lookup.h: Likewise.

testsuite:
	* g++.old-deja/g++.mike/unused.C: Add.

From-SVN: r107062
parent cb110f3d
2005-11-15 Mike Stump <mrs@apple.com>
* c-decl.c (lookup_name_two): Add.
* c-tree.h (lookup_name_two): Likewise.
* c-common.c (handle_cleanup_attribute): Use lookup_name_two instead.
* config/darwin-c.c (darwin_pragma_unused): Likewise.
2005-11-16 Alan Modra <amodra@bigpond.net.au> 2005-11-16 Alan Modra <amodra@bigpond.net.au>
PR rtl-optimization/23392 PR rtl-optimization/23392
......
...@@ -5464,7 +5464,7 @@ handle_cleanup_attribute (tree *node, tree name, tree args, ...@@ -5464,7 +5464,7 @@ handle_cleanup_attribute (tree *node, tree name, tree args,
*no_add_attrs = true; *no_add_attrs = true;
return NULL_TREE; return NULL_TREE;
} }
cleanup_decl = lookup_name (cleanup_id); cleanup_decl = lookup_name_two (cleanup_id, 0);
if (!cleanup_decl || TREE_CODE (cleanup_decl) != FUNCTION_DECL) if (!cleanup_decl || TREE_CODE (cleanup_decl) != FUNCTION_DECL)
{ {
error ("cleanup argument not a function"); error ("cleanup argument not a function");
......
...@@ -2671,6 +2671,15 @@ lookup_name (tree name) ...@@ -2671,6 +2671,15 @@ lookup_name (tree name)
return 0; 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. */ /* Similar to `lookup_name' but look only at the indicated scope. */
static tree static tree
......
...@@ -455,6 +455,7 @@ extern tree grokparm (const struct c_parm *); ...@@ -455,6 +455,7 @@ extern tree grokparm (const struct c_parm *);
extern tree implicitly_declare (tree); extern tree implicitly_declare (tree);
extern void keep_next_level (void); extern void keep_next_level (void);
extern tree lookup_name (tree); extern tree lookup_name (tree);
extern tree lookup_name_two (tree, int);
extern void pending_xref_error (void); extern void pending_xref_error (void);
extern void c_push_function_context (struct function *); extern void c_push_function_context (struct function *);
extern void c_pop_function_context (struct function *); extern void c_pop_function_context (struct function *);
......
...@@ -141,7 +141,7 @@ darwin_pragma_unused (cpp_reader *pfile ATTRIBUTE_UNUSED) ...@@ -141,7 +141,7 @@ darwin_pragma_unused (cpp_reader *pfile ATTRIBUTE_UNUSED)
tok = c_lex (&decl); tok = c_lex (&decl);
if (tok == CPP_NAME && decl) if (tok == CPP_NAME && decl)
{ {
tree local = lookup_name (decl); tree local = lookup_name_two (decl, 0);
if (local && (TREE_CODE (local) == PARM_DECL if (local && (TREE_CODE (local) == PARM_DECL
|| TREE_CODE (local) == VAR_DECL)) || TREE_CODE (local) == VAR_DECL))
TREE_USED (local) = 1; TREE_USED (local) = 1;
......
2005-11-15 Mike Stump <mrs@apple.com>
* name-lookup.c (lookup_name_two): Add.
* name-lookup.h: Likewise.
2005-11-15 Mark Mitchell <mark@codesourcery.com> 2005-11-15 Mark Mitchell <mark@codesourcery.com>
PR c++/24667 PR c++/24667
......
...@@ -4000,6 +4000,14 @@ lookup_name (tree name, int prefer_type) ...@@ -4000,6 +4000,14 @@ lookup_name (tree name, int prefer_type)
0, LOOKUP_COMPLAIN); 0, LOOKUP_COMPLAIN);
} }
/* Similar to `lookup_name' for the benefit of common code. */
tree
lookup_name_two (tree name, int prefer_type)
{
return lookup_name (name, prefer_type);
}
/* Look up NAME for type used in elaborated name specifier in /* Look up NAME for type used in elaborated name specifier in
the scopes given by SCOPE. SCOPE can be either TS_CURRENT or the scopes given by SCOPE. SCOPE can be either TS_CURRENT or
TS_WITHIN_ENCLOSING_NON_CLASS. Although not implied by the TS_WITHIN_ENCLOSING_NON_CLASS. Although not implied by the
......
...@@ -313,6 +313,7 @@ extern void pushlevel_class (void); ...@@ -313,6 +313,7 @@ extern void pushlevel_class (void);
extern void poplevel_class (void); extern void poplevel_class (void);
extern tree pushdecl_with_scope (tree, cxx_scope *, bool); extern tree pushdecl_with_scope (tree, cxx_scope *, bool);
extern tree lookup_name (tree, int); extern tree lookup_name (tree, int);
extern tree lookup_name_two (tree, int);
extern tree lookup_name_real (tree, int, int, bool, int, int); extern tree lookup_name_real (tree, int, int, bool, int, int);
extern tree lookup_type_scope (tree, tag_scope); extern tree lookup_type_scope (tree, tag_scope);
extern tree namespace_binding (tree, tree); extern tree namespace_binding (tree, tree);
......
2005-11-11 Mike Stump <mrs@apple.com>
* g++.old-deja/g++.mike/unused.C: Add.
2005-11-15 Mark Mitchell <mark@codesourcery.com> 2005-11-15 Mark Mitchell <mark@codesourcery.com>
PR c++/24667 PR c++/24667
// { dg-do compile { target *-*-darwin* } }
// { dg-options { -Wunused-parameter } }
// Radar 4125055
void foo(int x) {
#pragma unused ( x )
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment