This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/17729] [4.8/4.9/5 Regression] Duplicate __attribute__((deprecated)) warning
- From: "ktietz at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 20 Mar 2015 16:50:17 +0000
- Subject: [Bug c++/17729] [4.8/4.9/5 Regression] Duplicate __attribute__((deprecated)) warning
- Auto-submitted: auto-generated
- References: <bug-17729-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=17729
Kai Tietz <ktietz at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
CC| |ktietz at gcc dot gnu.org
--- Comment #32 from Kai Tietz <ktietz at gcc dot gnu.org> ---
We call function warn_deprecated_use twice within finish_id_expression. Once
indirectly via mark_used, and the second time directly. So by checking if
TREE_USED (t) is false this double-warning should be omitted.
Testing right now following patch:
Index: semantics.c
===================================================================
--- semantics.c (Revision 221533)
+++ semantics.c (Arbeitskopie)
@@ -3649,7 +3668,7 @@ finish_id_expression (tree id_expression,
/* Handle references (c++/56130). */
tree t = REFERENCE_REF_P (decl) ? TREE_OPERAND (decl, 0) : decl;
- if (TREE_DEPRECATED (t))
+ if (TREE_DEPRECATED (t) && !TREE_USED (t))
warn_deprecated_use (t, NULL_TREE);
return decl;