[cfe-commits] r150260 - in /cfe/trunk: lib/Sema/SemaChecking.cpp test/SemaCXX/format-strings.cpp
David Blaikie
dblaikie at gmail.com
Fri Feb 10 13:13:31 PST 2012
On Fri, Feb 10, 2012 at 1:02 PM, Ted Kremenek <kremenek at apple.com> wrote:
>
> 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).
Yeah - it can be handy to use other diagnostics to check that the
semantics of the code are what you intended them to be.
> 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.
Added a case for that:
printf(*sp); // expected-warning {{not a string literal}}
And committed as r150276 (assuming you were generally OK with the
change with that exception).
Thanks,
- David
More information about the cfe-commits
mailing list