summaryrefslogtreecommitdiffstats
path: root/test/Sema/format-strings-scanf.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/Sema/format-strings-scanf.c')
-rw-r--r--test/Sema/format-strings-scanf.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/test/Sema/format-strings-scanf.c b/test/Sema/format-strings-scanf.c
index d66bed5..d3a03ad 100644
--- a/test/Sema/format-strings-scanf.c
+++ b/test/Sema/format-strings-scanf.c
@@ -86,6 +86,11 @@ void test_scanlist(int *ip, char *sp, wchar_t *ls) {
scanf("%h[abc]", sp); // expected-warning{{length modifier 'h' results in undefined behavior or no effect with '[' conversion specifier}}
scanf("%l[xyx]", ls); // no-warning
scanf("%ll[xyx]", ls); // expected-warning {{length modifier 'll' results in undefined behavior or no effect with '[' conversion specifier}}
+
+ // PR19559
+ scanf("%[]% ]", sp); // no-warning
+ scanf("%[^]% ]", sp); // no-warning
+ scanf("%[a^]% ]", sp); // expected-warning {{invalid conversion specifier ' '}}
}
void test_alloc_extension(char **sp, wchar_t **lsp, float *fp) {
@@ -107,9 +112,9 @@ void test_alloc_extension(char **sp, wchar_t **lsp, float *fp) {
// Test argument type check for the 'm' length modifier.
scanf("%ms", fp); // expected-warning{{format specifies type 'char **' but the argument has type 'float *'}}
- scanf("%mS", fp); // expected-warning-re{{format specifies type 'wchar_t \*\*' \(aka '[^']+'\) but the argument has type 'float \*'}}
+ scanf("%mS", fp); // expected-warning-re{{format specifies type 'wchar_t **' (aka '{{[^']+}}') but the argument has type 'float *'}}
scanf("%mc", fp); // expected-warning{{format specifies type 'char **' but the argument has type 'float *'}}
- scanf("%mC", fp); // expected-warning-re{{format specifies type 'wchar_t \*\*' \(aka '[^']+'\) but the argument has type 'float \*'}}
+ scanf("%mC", fp); // expected-warning-re{{format specifies type 'wchar_t **' (aka '{{[^']+}}') but the argument has type 'float *'}}
scanf("%m[abc]", fp); // expected-warning{{format specifies type 'char **' but the argument has type 'float *'}}
}
OpenPOWER on IntegriCloud