[cfe-commits] r83907 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/Sema.h lib/Sema/SemaExpr.cpp lib/Sema/SemaStmt.cpp test/SemaCXX/warn-assignment-condition.cpp

John McCall rjmccall at apple.com
Tue Oct 13 10:52:34 PDT 2009


Chris Lattner wrote:
>
> On Oct 13, 2009, at 10:32 AM, John McCall wrote:
>
>> Chris Lattner wrote:
>>> On Oct 12, 2009, at 2:59 PM, John McCall wrote:
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=83907&view=rev
>>>> Log:
>>>> Implement -Wparentheses: warn about using assignments in contexts 
>>>> that require
>>>> conditions. Add a fixit to insert the parentheses. Also fix a very 
>>>> minor
>>>> possible memory leak in 'for' conditions.
>>>>
>>>> Fixes PR 4876 and rdar://problem/7289172
>>>
>>> Awesome, thanks John. Random question: should this warning default 
>>> to on? I know that GCC doesn't default it to on, but perhaps clang 
>>> should?
>>
>> Hmm, probably. I'll do that.
>
> Thanks, if there is too much screaming, we can always turn it back off 
> by default :)

That's not a bad general policy for warnings — if it's likely to catch 
real bugs (i.e. is not just a suggestion), and it doesn't have 
significant false positive problems (as measured by developer 
screaming), turn it on by default. Maybe with an exception for 
low-benefit high-cost warnings.

John.



More information about the cfe-commits mailing list