[cfe-commits] [PATCH] -Wcast-qual

Jordan Rose jordan_rose at apple.com
Tue Jun 26 09:28:36 PDT 2012


Have you tested this with volatile at all? Mixing volatile and const? Sometimes in your patch you refer to const only, other times to "more qualified" in general.

I'm not such a fan of "in an unsafe way"; it implies there is a safe way. (I guess there is if the pointer itself is const.) But I don't have anything better; putting "unsafely" in the middle of the message sounds awkward.

Jordan


On Jun 25, 2012, at 6:28 , Igor Minin <i.minin.llvm at gmail.com> wrote:

> Hello!
> Thanks for review.
> 
> I fixed the message. Now it has two separate forms:
> 
> * "cast from T1 to T2 discards qualifiers from pointer target type"
> * "cast from T1 to T2 introduces qualifiers to pointer target type in an unsafe way"
> 
> Also I did some cosmetic fixes in comments, code etc.
> 
> Please see attached patch.
> 
> Best regards, 
> Igor
> 
> 
> On Fri, Jun 22, 2012 at 7:48 PM, Jordan Rose <jordan_rose at apple.com> wrote:
> I think Dmitri was specifically referring to the /message/, not the warning itself:
> 
> > +  char** x = 0;
> > +  const char** y = (const char**)x; // expected-warning {{cast
> > discards qualifiers from pointer target type}}
> 
> Qualifiers are being added, not discarded. Most people won't immediately see why this is a problem, though, so it might be worth being a bit more verbose anyway.
> 
> It's a good warning, thanks for putting it in.
> 
> Jordan
> 
> <warn_cast_qual.diff>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120626/f0497395/attachment.html>


More information about the cfe-commits mailing list