aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/format-strings.c
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-09-09 04:33:05 +0000
committerTed Kremenek <kremenek@apple.com>2010-09-09 04:33:05 +0000
commitc82faca0be59b072b38bed375e21bd24f1f72647 (patch)
tree2dcbce593fa64f1a59b3e06c7d134d302f30994e /test/Sema/format-strings.c
parent95355bb53ef3145e463b98c6fd26f8f95e26e26c (diff)
Check format strings when a called function has more than one FormatAttr (one for 'scanf' and one for 'printf'). Fixes <rdar://problem/8409437>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113472 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/format-strings.c')
-rw-r--r--test/Sema/format-strings.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/test/Sema/format-strings.c b/test/Sema/format-strings.c
index 9e8007b9b0..1bfab25531 100644
--- a/test/Sema/format-strings.c
+++ b/test/Sema/format-strings.c
@@ -302,9 +302,18 @@ void pr7981(wint_t c, wchar_t c2) {
}
// <rdar://problem/8269537> -Wformat-security says NULL is not a string literal
-void r8269537() {
+void rdar8269537() {
// This is likely to crash in most cases, but -Wformat-nonliteral technically
// doesn't warn in this case.
printf(0); // no-warning
}
+// Handle functions with multiple format attributes.
+extern void rdar8332221_vprintf_scanf(const char *, va_list, const char *, ...)
+ __attribute__((__format__(__printf__, 1, 0)))
+ __attribute__((__format__(__scanf__, 3, 4)));
+
+void rdar8332221(va_list ap, int *x, long *y) {
+ rdar8332221_vprintf_scanf("%", ap, "%d", x); // expected-warning{{incomplete format specifier}}
+}
+