re PR c++/17796 (Too many unused parameter warnings emitted.)

PR c++/17796
	* optimize.c (update_cloned_parm): Add FIRST parameter. Use it.
	(maybe_clone_body): Track the first clone.

From-SVN: r105415
This commit is contained in:
Nathan Sidwell 2005-10-14 16:36:49 +00:00 committed by Nathan Sidwell
parent d2c979efb7
commit b8ad8c93ef
2 changed files with 13 additions and 5 deletions

View File

@ -1,3 +1,9 @@
2005-10-14 Nathan Sidwell <nathan@codesourcery.com>
PR c++/17796
* optimize.c (update_cloned_parm): Add FIRST parameter. Use it.
(maybe_clone_body): Track the first clone.
2005-10-13 Nathan Sidwell <nathan@codesourcery.com>
PR c++/23984

View File

@ -45,7 +45,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
/* Prototypes. */
static void update_cloned_parm (tree, tree);
static void update_cloned_parm (tree, tree, bool);
/* CLONED_PARM is a copy of CLONE, generated for a cloned constructor
or destructor. Update it to ensure that the source-position for
@ -53,7 +53,7 @@ static void update_cloned_parm (tree, tree);
debugging generation code will be able to find the original PARM. */
static void
update_cloned_parm (tree parm, tree cloned_parm)
update_cloned_parm (tree parm, tree cloned_parm, bool first)
{
DECL_ABSTRACT_ORIGIN (cloned_parm) = parm;
@ -63,7 +63,7 @@ update_cloned_parm (tree parm, tree cloned_parm)
/* The definition might have different constness. */
TREE_READONLY (cloned_parm) = TREE_READONLY (parm);
TREE_USED (cloned_parm) = TREE_USED (parm);
TREE_USED (cloned_parm) = !first || TREE_USED (parm);
/* The name may have changed from the declaration. */
DECL_NAME (cloned_parm) = DECL_NAME (parm);
@ -79,6 +79,7 @@ bool
maybe_clone_body (tree fn)
{
tree clone;
bool first = true;
/* We only clone constructors and destructors. */
if (!DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (fn)
@ -118,7 +119,7 @@ maybe_clone_body (tree fn)
parm = DECL_ARGUMENTS (fn);
clone_parm = DECL_ARGUMENTS (clone);
/* Update the `this' parameter, which is always first. */
update_cloned_parm (parm, clone_parm);
update_cloned_parm (parm, clone_parm, first);
parm = TREE_CHAIN (parm);
clone_parm = TREE_CHAIN (clone_parm);
if (DECL_HAS_IN_CHARGE_PARM_P (fn))
@ -130,7 +131,7 @@ maybe_clone_body (tree fn)
for (; parm;
parm = TREE_CHAIN (parm), clone_parm = TREE_CHAIN (clone_parm))
/* Update this parameter. */
update_cloned_parm (parm, clone_parm);
update_cloned_parm (parm, clone_parm, first);
/* Start processing the function. */
start_preparsed_function (clone, NULL_TREE, SF_PRE_PARSED);
@ -206,6 +207,7 @@ maybe_clone_body (tree fn)
finish_function (0);
BLOCK_ABSTRACT_ORIGIN (DECL_INITIAL (clone)) = DECL_INITIAL (fn);
expand_or_defer_fn (clone);
first = false;
}
pop_from_top_level ();