diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2005-10-14 16:36:49 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2005-10-14 16:36:49 +0000 |
commit | b8ad8c93effa24b68de1287428844f5b6025d593 (patch) | |
tree | bd89fe14baea44bc1be6e47a3864aa646430f170 /gcc/cp/optimize.c | |
parent | d2c979efb7a2638849609b7a4ce48ea9f12dc9e8 (diff) | |
download | gcc-b8ad8c93effa24b68de1287428844f5b6025d593.zip gcc-b8ad8c93effa24b68de1287428844f5b6025d593.tar.gz gcc-b8ad8c93effa24b68de1287428844f5b6025d593.tar.bz2 |
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
Diffstat (limited to 'gcc/cp/optimize.c')
-rw-r--r-- | gcc/cp/optimize.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c index 7bca77d..7ac2437 100644 --- a/gcc/cp/optimize.c +++ b/gcc/cp/optimize.c @@ -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 (); |