[PATCHv3] implement -Wold-style-cast

Alp Toker alp at nuanti.com
Tue Nov 26 19:22:54 PST 2013


On 26/11/2013 18:51, Ondřej Hošek wrote:
> Hi everyone,
>
> On Tue, Nov 26, 2013 at 9:37 AM, Alp Toker <alp at nuanti.com> wrote:
>> GCC doesn't warn on (void) casts.
>>
>> The patch should be fixed to handle these cases too:
>>
>> (void)x; // no warning
>> (long)x; // warning
>>
>> The necessary checks can be done in Parse, but might be slightly easier /
>> future-proof handle them in Sema.
> Thanks for the feedback; I have updated the patch accordingly.

Hi Ondra,

This one is pretty much what we want, except that the check needs to be 
moved up to ActOnCastExpr() to avoid diagnosing template instantiations 
or skipping diags due to early returns.

I've made that change, padded out the tests with a few more cases like 
(void**)x; and typedef void VOID; which we now get right and landed in 
r195808.

Thanks!

Alp.

>
> Cheers,
> ~~ Ondra

-- 
http://www.nuanti.com
the browser experts




More information about the cfe-commits mailing list