diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/Sema/format-strings-scanf.c | 10 | ||||
-rw-r--r-- | test/Sema/format-strings.c | 11 |
2 files changed, 21 insertions, 0 deletions
diff --git a/test/Sema/format-strings-scanf.c b/test/Sema/format-strings-scanf.c index 6962a97611..d89dbc494b 100644 --- a/test/Sema/format-strings-scanf.c +++ b/test/Sema/format-strings-scanf.c @@ -103,3 +103,13 @@ void test_alloc_extension(char **sp, wchar_t **lsp, float *fp) { scanf("%m[abc]", fp); // expected-warning{{format specifies type 'char **' but the argument has type 'float *'}} } +void test_longlong(long long *x, unsigned long long *y) { + scanf("%Ld", y); // no-warning + scanf("%Lu", y); // no-warning + scanf("%Lx", y); // no-warning + scanf("%Ld", x); // no-warning + scanf("%Lu", x); // no-warning + scanf("%Lx", x); // no-warning + scanf("%Ls", "hello"); // expected-warning {{length modifier 'L' results in undefined behavior or no effect with 's' conversion specifier}} +} + diff --git a/test/Sema/format-strings.c b/test/Sema/format-strings.c index e32ad245e3..9daaf3b0a5 100644 --- a/test/Sema/format-strings.c +++ b/test/Sema/format-strings.c @@ -469,3 +469,14 @@ void pr9751() { // when the original string is within the argument expression. printf(1 ? "yes %d" : "no %d"); // expected-warning 2{{more '%' conversions than data arguments}} } + +// PR 9466: clang: doesn't know about %Lu, %Ld, and %Lx +void printf_longlong(long long x, unsigned long long y) { + printf("%Ld", y); // no-warning + printf("%Lu", y); // no-warning + printf("%Lx", y); // no-warning + printf("%Ld", x); // no-warning + printf("%Lu", x); // no-warning + printf("%Lx", x); // no-warning + printf("%Ls", "hello"); // expected-warning {{length modifier 'L' results in undefined behavior or no effect with 's' conversion specifier}} +} |