[cfe-commits] r115713 - in /cfe/trunk: lib/Sema/SemaType.cpp test/Sema/typeof-use-deprecated.c
jahanian
fjahanian at apple.com
Tue Oct 5 17:03:53 PDT 2010
On Oct 5, 2010, at 4:52 PM, John McCall wrote:
> On Oct 5, 2010, at 4:24 PM, Fariborz Jahanian wrote:
>> Author: fjahanian
>> Date: Tue Oct 5 18:24:00 2010
>> New Revision: 115713
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=115713&view=rev
>> Log:
>> Issue deprecated warning when typeof uses an
>> expression of deprecated type.
>
> This seems strange to me; deprecation warnings are usually based on how something is spelled, not what it actually resolves to. For example, even if a record type is deprecated, you can still make variables of that type if you have a non-deprecated typedef for it. So if the variable itself isn't deprecated, I'm not sure why getting its type with typeof is more suspect than any other use. Is there a specific use case motivating this?
typeof is a gcc extension and I followed gcc's behavior. I guess it is because typeof is really a replacement for using
the deprecated type directly. But I don't know more than that.
>
> There are a lot of subsidiary questions here, like whether we should warn in the following test cases:
> deprecated_type *a; typeof(*a) b; // we now warn about this
> deprecated_type *a; typeof(a) b; // but not about this
> deprecated_typedef a; typeof(a) b; // or this
gcc issues warnings on these but not for this, for example:
> deprecated_type a[10]; typeof (a) b;
So, I would say gcc's behavior is not consistent (I have access to 4.2 only though).
But, I think we should warn in all cases (if we do for typeof ).
> etc.
>
> Also, you can just use getAs<TagType>() instead of testing for RecordType and EnumType separately.
Sounds good.
- fariborz
>
> John.
More information about the cfe-commits
mailing list