[cfe-commits] PATCH: Adds -Wself-assign to Clang, but defaults it to off
Douglas Gregor
dgregor at apple.com
Tue Jan 4 11:03:43 PST 2011
On Jan 4, 2011, at 10:46 AM, John McCall wrote:
> 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.
So we extend ActOnFinishFullExpr with some kind of context argument that says why we're finishing the full expression, and use that to distinguish cases where we can put in (void).
>>> 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.
I abandoned a queue-based approach and went with an ActOnSubExpr-based approach (for my experimental decltype hack) exactly because of this queue-flushing issue :)
- Doug
More information about the cfe-commits
mailing list