]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c-decl.c (lookup_name_two): Add.
authorMike Stump <mrs@apple.com>
Wed, 16 Nov 2005 02:08:11 +0000 (02:08 +0000)
committerMike Stump <mrs@gcc.gnu.org>
Wed, 16 Nov 2005 02:08:11 +0000 (02:08 +0000)
* 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

gcc/ChangeLog
gcc/c-common.c
gcc/c-decl.c
gcc/c-tree.h
gcc/config/darwin-c.c
gcc/cp/ChangeLog
gcc/cp/name-lookup.c
gcc/cp/name-lookup.h
gcc/testsuite/ChangeLog
gcc/testsuite/g++.old-deja/g++.mike/unused.C [new file with mode: 0644]

index 1ffb83f1d8ca96765afc0d37634069e1b473daaf..16b1dfc60e2905c851138669e6c55a15a2593aab 100644 (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
index 450184110969651d91bbc547018ec60576238597..feb87ef523a2e31213a1a142961c49d622422e69 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 (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");
index 003b813fc7d5f579d5156902eab4e8425bed7435..99e91c04406616cb82253a1777607e13e01d66e3 100644 (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
index 0894317e5741e4ec8c614224a8f13792490e0176..0399e893e3a8aafbb5f16a25fac5bd2629b31321 100644 (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 *);
index 738f07c81a730c9821348b534e6dd03bfc277c2c..893aaf7d7b8478ac73d1de517931a2906d25814d 100644 (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;
index c42ef5ca769ecb884df40fdf992fcae95f03e597..6d354d9d16464a3646fdbfd8b7f9fe295218730f 100644 (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
index 20ea311196fa25bbb8816c78b422e6442021ce73..ce27704f75feefed3981b7244d474d654a1be639 100644 (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
index fa2a760bd94e73cf67fb37de790f93592924dfe3..a6466d3fb74142d980e0ca04c7db936411b9f0cd 100644 (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);
index 26d56c3cbdaa6b8dff6d174334eb72d2e10ab3ad..8b43fc896855a7de0f1163be8725c40fbb412311 100644 (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
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/unused.C b/gcc/testsuite/g++.old-deja/g++.mike/unused.C
new file mode 100644 (file)
index 0000000..b441a77
--- /dev/null
@@ -0,0 +1,7 @@
+// { dg-do compile { target *-*-darwin* } }
+// { dg-options { -Wunused-parameter } }
+// Radar 4125055
+
+void foo(int x) {
+#pragma unused ( x )
+}