[cfe-commits] [Patch] -Wformat: properly handle length modifiers used with %n (Was: -Wformat: warn about using length modifiers with %n)

Hans Wennborg hans at chromium.org
Sat Aug 4 12:09:58 PDT 2012


On Thu, Aug 2, 2012 at 6:31 PM, Ted Kremenek <kremenek at apple.com> wrote:
> C99 says you can use %n with the length modifiers 'hh', 'h', 'l', 'j', 'z', and 't'.

Here is a new attempt :) Fixing this made me want to do a little
refactoring, so I've attached three patches:

1) Rename Rename analyze_format_string::ArgTypeResult to ArgType and
remove redundant constructors and unused functions.

2) Remove ScanfArgTypeResult, and move the logic for expecting a
"pointer to some ArgType" into ArgType itself, so it can be used for
printf as well as for scanf.

3) Use the functionality of ArgType to properly check the arguments for %n.

Please take a look.

Thanks,
Hans
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1_rename_argtyperesult.patch
Type: application/octet-stream
Size: 28471 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120804/d5f531a0/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2_remove_scanfargtype.patch
Type: application/octet-stream
Size: 18510 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120804/d5f531a0/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 3_handle_n_length_modifiers.patch
Type: application/octet-stream
Size: 8153 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120804/d5f531a0/attachment-0002.obj>


More information about the cfe-commits mailing list