diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-09-09 04:33:05 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-09-09 04:33:05 +0000 |
commit | b8176da3144eeee9177b00ac68598254dc6413a7 (patch) | |
tree | 1e6f581d9ca39c7afaa9b83c73bf9015211e2bd9 /clang/test/Sema | |
parent | 1520dae606e95a6343e293fb794d3cef31419b01 (diff) | |
download | bcm5719-llvm-b8176da3144eeee9177b00ac68598254dc6413a7.tar.gz bcm5719-llvm-b8176da3144eeee9177b00ac68598254dc6413a7.zip |
Check format strings when a called function has more than one FormatAttr (one for 'scanf' and one for 'printf'). Fixes <rdar://problem/8409437>.
llvm-svn: 113472
Diffstat (limited to 'clang/test/Sema')
-rw-r--r-- | clang/test/Sema/format-strings.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/clang/test/Sema/format-strings.c b/clang/test/Sema/format-strings.c index 9e8007b9b02..1bfab255313 100644 --- a/clang/test/Sema/format-strings.c +++ b/clang/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}} +} + |