[PATCH] PR12214 - warn on suspicious self-compound-assignments
Richard Smith
richard at metafoo.co.uk
Fri May 30 14:59:52 PDT 2014
On Thu, May 29, 2014 at 7:35 PM, Arthur O'Dwyer <arthur.j.odwyer at gmail.com>
wrote:
> FWIW, I don't understand what it means to "assign a value to itself".
>
The actual message talks about "assigning value of variable to itself"
where the "itself" refers to the variable, not the value. I'm not really
worried about this, but I wouldn't object to a change either.
> (And if you want to make it something like "assignment does not change
> the value of variable %0"
This diagnostic text also looks fine to me.
> , notice that a^=a actually does change the
> value.) Perhaps "lvalue %0 appears on both sides of (compound)
> assignment" would be more accurate.
>
> I assume this diagnostic is automatically suppressed in the case that
> we're really calling an overloaded operator|= or something, right?
>
>
> On Thu, May 29, 2014 at 4:25 PM, Richard Smith <richard at metafoo.co.uk>
> wrote:
> > Maybe tweak the diagnostic (for both this case and the normal
> self-assignment case) to:
> >
> > explicitly assigning value of variable of type %0 to itself
> >
> > (Adding the 'value of' makes this message work better for the
> compound-assignment case.)
> >
> > Other than that, LGTM
> >
> > http://reviews.llvm.org/D3753
> >
> >
> >
> > _______________________________________________
> > cfe-commits mailing list
> > cfe-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140530/27a97088/attachment.html>
More information about the cfe-commits
mailing list