[cfe-commits] r150260 - in /cfe/trunk: lib/Sema/SemaChecking.cpp test/SemaCXX/format-strings.cpp

Ted Kremenek kremenek at apple.com
Fri Feb 10 13:02:35 PST 2012


On Feb 10, 2012, at 12:49 PM, David Blaikie <dblaikie at gmail.com> wrote:

> [oops, missed a warning suppression/validation for 'false' as a null
> pointer literal - I used an expected-warning, but I'm actually
> undecided about whether we should do that in general (ad expected
> warnings for warnings we aren't trying to test) rather than just
> disable that warning in this test case (or, indeed, disable all
> warnings except the ones we plan to test in a given test case - though
> that might lose us a lot of fairly useful (if scattershot) accidental
> coverage)]

Sometimes I like having extra warnings there that cross-check that the checking isn't completely broken.  That way you can distinguish between a warning not firing because it's not meant to fire and warning not firing because things are completely broken (e.g., the test is wrong).

For this part of the test:

+++ b/test/SemaCXX/format-strings-0x.cpp
@@ -10,4 +10,5 @@ void f(char **sp, float *fp) {
 
   printf("%a", 1.0);
   scanf("%afoobar", fp);
+  printf(nullptr);
 }
diff --git

Let's add a case where the warning actually fires so that we validate that it isn't completely broken in this test file.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120210/7b32b8d7/attachment.html>


More information about the cfe-commits mailing list