[cfe-commits] [patch] -Wformat fixup for vprintf (and friends)

Ted Kremenek kremenek at apple.com
Tue Feb 21 11:53:23 PST 2012


On Feb 21, 2012, at 10:32 AM, Jean-Daniel Dupas <devlists at shadowlab.org> wrote:

> Thanks,
> 
> What do you mean by "the right thing".
> 
> In the C test, the function check_string_literal2() test that the warning does not trigger when the user forward a format string argument.
> 
> In the C++ test, the "int Foo::printf(const char *fmt, …)" contains a case with vprintf() and no warning, and finally, the objc test case contains a similar test (+ [Bar log2:(NSString *)fmt] ) with NSLogv().
> 

Those are great tests.  I was just talking about the obvious case.  Here your patch introduces the following test change:

-  vprintf(s,ap); // // no-warning
+  vprintf(s,ap); // expected-warning {{format string is not a string literal}}

I'm just asking for a test case that shows vprintf being called with a string literal and the warning not firing, etc.  Yes I know this should work, but our tests should reflect that.  I did another scan of our tests, and it looks like we have such a test case.  So I think this patch is good as is.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120221/251fb25b/attachment.html>


More information about the cfe-commits mailing list