[PATCH] Add warnings for undefined behaviors with pointers

Richard Trieu rtrieu at google.com
Fri Jun 6 16:51:47 PDT 2014


On Fri, Jun 6, 2014 at 3:58 PM, Richard Smith <richard at metafoo.co.uk> wrote:

> On Thu, Jun 5, 2014 at 5:01 PM, Richard Smith <richard at metafoo.co.uk>
> wrote:
>
>> LGTM with some minor diagnostic tweaks.
>>
>> ================
>> Comment at: include/clang/Basic/DiagnosticSemaKinds.td:2393
>> @@ +2392,3 @@
>> +  "'this' pointer cannot be null in well-defined C++ code; pointer may
>> be "
>> +  "assumed always converted to a true value">,
>> InGroup<UndefinedBoolConversion>;
>> +def warn_address_of_reference_bool_conversion : Warning<
>> ----------------
>> "assumed to always convert to" would sound better to me.
>>
>
> Looks like you didn't make this change prior to checkin?
>

I'll go fix it.

>
> Also,
>>
>>   assumed to always convert to 'true'
>>
>> rather than
>>
>>   assumed to always convert to a true value
>>
>> to avoid people wondering what "a true value" is (cf. "a true Scotsman").
>>
>> Likewise I'd suggest putting the %select's below into single quotes.
>>
>
> Likewise this one.
>

Currently, there's only one place in the file that uses single quotes while
there are several that don't use quotes.  For consistency, I left the
quotes off.

>
>
>> ================
>> Comment at: include/clang/Basic/DiagnosticSemaKinds.td:2409
>> @@ +2408,3 @@
>> +  "reference cannot be bound to dereferenced null pointer in
>> well-defined C++ "
>> +  "code; comparison maybe be assumed to always evaluate to "
>> +  "%select{true|false}0">,
>> ----------------
>> Typo "maybe be" should be "may be"
>>
>> http://reviews.llvm.org/D3999
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140606/61343bdc/attachment.html>


More information about the cfe-commits mailing list