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
This commit is contained in:
Mike Stump 2005-11-16 02:08:11 +00:00 committed by Mike Stump
parent cb110f3d8e
commit 988037306d
10 changed files with 44 additions and 2 deletions

View file

@ -1,3 +1,10 @@
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>
PR rtl-optimization/23392

View 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 (cleanup_id);
cleanup_decl = lookup_name_two (cleanup_id, 0);
if (!cleanup_decl || TREE_CODE (cleanup_decl) != FUNCTION_DECL)
{
error ("cleanup argument not a function");

View file

@ -2671,6 +2671,15 @@ 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

View file

@ -455,6 +455,7 @@ 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 *);

View file

@ -141,7 +141,7 @@ darwin_pragma_unused (cpp_reader *pfile ATTRIBUTE_UNUSED)
tok = c_lex (&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
|| TREE_CODE (local) == VAR_DECL))
TREE_USED (local) = 1;

View file

@ -1,3 +1,8 @@
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>
PR c++/24667

View file

@ -4000,6 +4000,14 @@ lookup_name (tree name, int prefer_type)
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
the scopes given by SCOPE. SCOPE can be either TS_CURRENT or
TS_WITHIN_ENCLOSING_NON_CLASS. Although not implied by the

View file

@ -313,6 +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_real (tree, int, int, bool, int, int);
extern tree lookup_type_scope (tree, tag_scope);
extern tree namespace_binding (tree, tree);

View file

@ -1,3 +1,7 @@
2005-11-11 Mike Stump <mrs@apple.com>
* g++.old-deja/g++.mike/unused.C: Add.
2005-11-15 Mark Mitchell <mark@codesourcery.com>
PR c++/24667

View file

@ -0,0 +1,7 @@
// { dg-do compile { target *-*-darwin* } }
// { dg-options { -Wunused-parameter } }
// Radar 4125055
void foo(int x) {
#pragma unused ( x )
}