[cfe-commits] PATCH: Adds -Wself-assign to Clang, but defaults it to off

John McCall rjmccall at apple.com
Tue Jan 4 10:46:26 PST 2011


On Jan 4, 2011, at 10:32 AM, Douglas Gregor wrote:
> On Jan 4, 2011, at 10:28 AM, John McCall wrote:
>> I don't think this really solves the problem, as a parenthesized expression would clearly be a sub-expression and an initializer would be a full-expression.
>> 
>> Also, the optimal rewrite for "(a = a);" would probably be "(void) (a);", not "((void) a);".
> 
> In my scheme, we just wouldn't end up providing a rewrite for (a = a). I'm okay with that.

I'm just saying, this is a really invasive change that doesn't actually solve any real diagnostics problems very well.  That point's kindof irrelevant, though, because the initializer issue kills the concept.

>> We could have a queue of things to consider at the end of a full-expression.  I think there's even a SourceLocation passed in to MaybeCreateExprWithCleanups which should be invalid iff we're in a ignored context.  On the other hand, I think we don't always get a callback at the end of a broken full-expression.
> 
> Sure, that's possible too. I don't much care if we don't emit warnings about a broken full-expression, though.

The problem is not that we might not emit the warning, the problem is that whether we emit the warning will depend on random things about when/if we flush the queue.

John.



More information about the cfe-commits mailing list