[cfe-commits] r146326 - in /cfe/trunk: include/clang/Analysis/Analyses/FormatString.h lib/Analysis/ScanfFormatString.cpp lib/Sema/SemaChecking.cpp test/Analysis/taint-generic.c test/Analysis/taint-tester.c test/Sema/format-strings-fixit.c test/Se

Hans Wennborg hans at chromium.org
Tue Dec 13 04:13:40 PST 2011

On Tue, Dec 13, 2011 at 6:47 AM, Ted Kremenek <kremenek at apple.com> wrote:
> It is also possible that those tests need to be modified if Clang's behavior
> ends up being more desirable than what is reflected in those tests.  I
> haven't looked at them, so I don't know off hand.

The failing tests use the 'a' length modifier, a GNU extension
available for C90 which can be used with strings and scanlists, that I
didn't know about before.

Clang would mis-parse this as the 'a' conversion specifier, and after
my commit it would warn, incorrectly, that it expected a float*

The attached patch makes Clang parse this extension correctly, which
should fix the test. We can revisit this later to teach it what type
to expect, warn about it being an extension, not available in C99,
etc. There's also a similar 'm' modifier which me may wish to support.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: scanf-alloc-modifier.diff
Type: text/x-patch
Size: 4879 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20111213/19a3c503/attachment.bin>

More information about the cfe-commits mailing list