summaryrefslogtreecommitdiff
path: root/test/Sema/format-strings.c
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2011-02-26 22:09:03 +0000
committerDimitry Andric <dim@FreeBSD.org>2011-02-26 22:09:03 +0000
commitc3b054d250cdca485c71845089c316e10610ebad (patch)
treeabae0246ec9156cc1a7cbb947b2b0dfe95fa3189 /test/Sema/format-strings.c
parentbca07a4524feb4edec581062d631a13116320a24 (diff)
Diffstat (limited to 'test/Sema/format-strings.c')
-rw-r--r--test/Sema/format-strings.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/Sema/format-strings.c b/test/Sema/format-strings.c
index be506d7c6b191..c78095a04d7b5 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
+}
+