aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/format-strings.c
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2012-05-11 00:36:07 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2012-05-11 00:36:07 +0000
commitbf9da1f8292bb66720ada94a050ede9dca17f60a (patch)
tree757f69354e83f6218807fe73995b622d07405946 /test/Sema/format-strings.c
parent7d9ae25d93554bdb238da83f9bb3e0b05475c16c (diff)
Fix a recent regression with the merging of format attributes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156597 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/format-strings.c')
-rw-r--r--test/Sema/format-strings.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/Sema/format-strings.c b/test/Sema/format-strings.c
index 1f9acd4ef8..a9a040fdc0 100644
--- a/test/Sema/format-strings.c
+++ b/test/Sema/format-strings.c
@@ -536,3 +536,20 @@ void pr12761(char c) {
// This should not warn even with -fno-signed-char.
printf("%hhx", c);
}
+
+
+// Test that we correctly merge the format in both orders.
+extern void test14_foo(const char *, const char *, ...)
+ __attribute__((__format__(__printf__, 1, 3)));
+extern void test14_foo(const char *, const char *, ...)
+ __attribute__((__format__(__scanf__, 2, 3)));
+
+extern void test14_bar(const char *, const char *, ...)
+ __attribute__((__format__(__scanf__, 2, 3)));
+extern void test14_bar(const char *, const char *, ...)
+ __attribute__((__format__(__printf__, 1, 3)));
+
+void test14_zed(int *p) {
+ test14_foo("%", "%d", p); // expected-warning{{incomplete format specifier}}
+ test14_bar("%", "%d", p); // expected-warning{{incomplete format specifier}}
+}