From fd950878fa902a9d5ec6f3accd96bad12ca8979f Mon Sep 17 00:00:00 2001 From: Hans Wennborg Date: Thu, 12 Jan 2012 15:07:16 +0000 Subject: scanf analysis: the 'a' length modifier is valid with a scanlist Before r148025 we (accidentally) didn't check whether a length modifier is appropriate for a scanlist, but now we do. llvm-svn: 148026 --- clang/test/Sema/format-strings-scanf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'clang/test/Sema/format-strings-scanf.c') diff --git a/clang/test/Sema/format-strings-scanf.c b/clang/test/Sema/format-strings-scanf.c index 2e32a26ac5c..7a2f278aebd 100644 --- a/clang/test/Sema/format-strings-scanf.c +++ b/clang/test/Sema/format-strings-scanf.c @@ -68,8 +68,9 @@ void test_variants(int *i, const char *s, ...) { vsscanf(buf, "%[abc", ap); // expected-warning{{no closing ']' for '%[' in scanf format string}} } -void test_scanlist(int *ip) { +void test_scanlist(int *ip, char *sp) { scanf("%[abc]", ip); // expected-warning{{conversion specifies type 'char *' but the argument has type 'int *'}} + scanf("%h[abc]", sp); // expected-warning{{length modifier 'h' results in undefined behavior or no effect with '[' conversion specifier}} } void test_alloc_extension(char **sp, wchar_t **lsp) { -- cgit v1.2.3