From a0fb00f9837bd0d2e5948f16f6a6b82a7a628f51 Mon Sep 17 00:00:00 2001 From: dim Date: Sat, 26 Feb 2011 22:09:03 +0000 Subject: Vendor import of clang trunk r126547: http://llvm.org/svn/llvm-project/cfe/trunk@126547 --- test/Sema/format-strings.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test/Sema/format-strings.c') diff --git a/test/Sema/format-strings.c b/test/Sema/format-strings.c index be506d7..c78095a 100644 --- a/test/Sema/format-strings.c +++ b/test/Sema/format-strings.c @@ -340,3 +340,21 @@ void posix_extensions() { printf("%'f\n", (float) 1.0); // no-warning printf("%'p\n", (void*) 0); // expected-warning{{results in undefined behavior with 'p' conversion specifier}} } + +// PR8486 +// +// Test what happens when -Wformat is on, but -Wformat-security is off. +#pragma GCC diagnostic warning "-Wformat" +#pragma GCC diagnostic ignored "-Wformat-security" + +void pr8486() { + printf("%s", 1); // expected-warning{{conversion specifies type 'char *' but the argument has type 'int'}} +} + +// PR9314 +// Don't warn about string literals that are PreDefinedExprs, e.g. __func__. +void pr9314() { + printf(__PRETTY_FUNCTION__); // no-warning + printf(__func__); // no-warning +} + -- cgit v1.1