[cfe-commits] PATCH: Adds -Wself-assign to Clang, but defaults it to off
Chandler Carruth
chandlerc at google.com
Mon Jan 3 22:57:34 PST 2011
Thanks for the feedback! First cut checked in as r122804 with most of your
comments addressed.
On Mon, Jan 3, 2011 at 6:28 PM, Douglas Gregor <dgregor at apple.com> wrote:
> Turn this on with -Wall, perhaps? I'd eventually like to have this on by
> default, but starting with -Wall seems best.
>
Sure, I'll be bold. =] Easy enough to turn off if needed.
> Hrm, should you check whether the type of the declaration is a volatile (or
> a reference to volatile)?
>
Yea, this is a good catch. Feel free to take a look at the submit, I tested
the obvious patterns.
It would be really nice if we could follow up this warning with a note +
> Fix-It, e.g.,
>
Why, yes it would. ;] I was already headed here but...
>
> note: cast 'thevariablename' to 'void' to silence this warning
>
> with a Fix-It that replaces the expression with
>
> (void)thevariablename
>
> Perhaps we could add this note as a follow-on when an expression statement
> consists of just a self-assignment?
>
This is a good idea about how to key the fix-it hint. I'll submit this as a
follow-up, and then run it over LLVM and Clang, as it seems we aren't immune
to this code pattern. =D
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110103/cfd3f824/attachment.html>
More information about the cfe-commits
mailing list