[cfe-commits] [Patch] -Wformat: better handling of qualifiers on pointer arguments

Hans Wennborg hans at chromium.org
Tue Jul 31 08:57:42 PDT 2012


Thanks, Jordan!

I've added some tests for the "const volatile" case. Yes, the types
have already been canonicalized, but I've added a couple of tests for
that anyway.

New patch attached. OK to commit?

 - Hans

On Tue, Jul 31, 2012 at 4:23 PM, Jordan Rose <jordan_rose at apple.com> wrote:
> Wow, nice idea. I would add "const volatile" to your test cases as well, even though I'm pretty sure "removeLocalVolatile" does the right thing.
>
> (Also, typedefs? Or have we already canonicalized the type by this point?)
>
>
> On Jul 31, 2012, at 3:25 AM, Hans Wennborg <hans at chromium.org> wrote:
>
>> Hi all,
>>
>> The attached patch makes Clang warn about passing in pointers to
>> const-qualified types to scanf, such as passing in "const int*" for a
>> "%d" format string.
>>
>> It also ignores the volatile-qualifier, allowing to pass in a
>> "volatile int*" pointer for a "%n" format string.
>>
>> Please take a look!
>>
>> Thanks,
>> Hans
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wformat_type_qualifiers2.patch
Type: application/octet-stream
Size: 4363 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120731/b70ea474/attachment.obj>


More information about the cfe-commits mailing list