[cfe-commits] r171899 - in /cfe/trunk: lib/Sema/SemaDeclAttr.cpp test/Sema/attr-availability.c
Douglas Gregor
dgregor at apple.com
Wed Jan 16 09:55:40 PST 2013
On Jan 9, 2013, at 8:01 AM, Rafael EspĂndola <rafael.espindola at gmail.com> wrote:
>>> + NamedDecl *ND = dyn_cast<NamedDecl>(D);
>>> + if (!ND) {
>>> + S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName();
>>> + return;
>>> + }
>>
>> Rafael,
>>
>> I'm concerned by attribute abuse. We just warn on too many weird
>> cases instead of throwing an error. I can understand "legacy code"
>> reasons, but this particular case never compiled, so there's no reason
>> to be forgiving.
>>
>> Maybe I am misunderstanding something...
>
> I would be more than happy to make this an error, but
>
> * We are very forgiving with the availability attribute for some
> reason. We warn if it is declared to be available after 10.5 and 10.7
> for example.
> * This is used mostly (only?) by apple, so I it is probably best if
> they decide whether this should be an error or warning.
Unfortunately, we're forced into making this a warning for historical reasons. On Darwin, there are a pile of availability macros (eg, in <Availability.h>) that currently expand to unavailable or deprecated attributes. Those macros should switch to use the availability attribute, but that means we can't be too strict or we break existing code.
More information about the cfe-commits
mailing list