This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch] Add "unavailable" attribute [ObjC V1 prerequisite].
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Paolo Bonzini <bonzini at gnu dot org>
- Cc: IainS <developer at sandoe-acoustics dot co dot uk>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Richard Henderson <rth at redhat dot com>, Mike Stump <mikestump at comcast dot net>, Jason Merrill <jason at redhat dot com>, Andrew Pinski <pinskia at gmail dot com>
- Date: Fri, 16 Apr 2010 15:27:36 -0700
- Subject: Re: [Patch] Add "unavailable" attribute [ObjC V1 prerequisite].
- References: <853E0A1D-E8B1-4E5E-BA84-83515E1ECF3F@sandoe-acoustics.co.uk> <4BC8E116.10900@gnu.org>
On Fri, Apr 16, 2010 at 3:13 PM, Paolo Bonzini <bonzini@gnu.org> wrote:
> On 04/16/2010 08:57 PM, IainS wrote:
>>
>> + ?if (TREE_UNAVAILABLE (member))
>> + ? ?error_unavailable_use (member, NULL_TREE);
>> + ?else if (TREE_DEPRECATED (member))
>> ? ? ?warn_deprecated_use (member, NULL_TREE);
>
> warn_deprecated_use is actually called only with the second parameter equal
> to NULL.
>
> So this means that you're effectively always looking up the attribute. You
> can then use just one flag bit, and in warn_deprecated_use (maybe renamed to
> diagnose_deprecated_use?) do either the deprecation warning or the
> unavailability error. ?(Maybe you can also pass the deprecated_state to it,
> or something like that).
>
> Effectively, TREE_DEPRECATED will mean "deprecated or unavailable". This
> should widely reduces the code duplication. ?(I haven't thought about
> type_is_unavailable and how to eliminate that duplication, but hey, I don't
> want to ruin the fun...)
>
> Paolo
>
Is that possible to combine unavailable_flag and deprecated_flag
into one flag?
--
H.J.