This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PR c++/17729 Duplicate __attribute__((deprecated)) warning
On 24/01/07, Mark Mitchell <mark@codesourcery.com> wrote:
Manuel López-Ibáñez wrote:
> :ADDPATCH c++:
> Index: gcc/cp/typeck.c
> ===================================================================
> --- gcc/cp/typeck.c (revision 120969)
> +++ gcc/cp/typeck.c (working copy)
> @@ -2242,9 +2242,6 @@ finish_class_member_access_expr (tree ob
> }
> }
>
> - if (TREE_DEPRECATED (member))
> - warn_deprecated_use (member);
> -
Where are the other deprecated warnings coming from in this case?
* typeck.c (finish_class_member_access_expr): Remove deprecated
warning since there is already another warning in
build_class_member_access_expr, which is always called by
finish_class_member_access_expr.
Or at least, that is what I understood from reading the code. The C++
front-end is a bit complex.
> Index: gcc/cp/call.c
> ===================================================================
> --- gcc/cp/call.c (revision 120969)
> +++ gcc/cp/call.c (working copy)
> @@ -315,8 +315,11 @@ build_call (tree function, tree parms)
> if (decl && TREE_THIS_VOLATILE (decl) && cfun)
> current_function_returns_abnormally = 1;
>
> - if (decl && TREE_DEPRECATED (decl))
> + if (decl && TREE_DEPRECATED (decl)
> + && (really_overloaded_fn (decl)
> + || TREE_CODE (fntype) == METHOD_TYPE))
> warn_deprecated_use (decl);
This doesn't make sense to me. We're never going to get an OVERLOAD
here; DECL is always going to be a simple function, or a pointer to a
function. So, why are you checking really_overloaded_fn?
Hum, I didn't know that. Following the analysis from here
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17729#c5
it kind of made sense to check whether the function was overloaded. I
guess it was not a good idea after all.
Thus, what stopped the duplicated warnings was TREE_CODE (fntype) ==
METHOD_TYPE, but I guess this will break something that we don't have
in our current testcases.
Well, I am out of ideas here. So I withdraw the patch then.
Sorry for the inconvenience,
Manuel.