diff options
author | Hans Wennborg <hans@hanshq.net> | 2012-02-16 16:34:54 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2012-02-16 16:34:54 +0000 |
commit | 9bc9bcc2472373ab81a2106e5a04fc6037e19fcc (patch) | |
tree | d8dc986445c6c5448f4ba2996092abd3953ad20a /clang/test | |
parent | 96de9933fbd86bd83ebf43be85c1f606f298f374 (diff) | |
download | bcm5719-llvm-9bc9bcc2472373ab81a2106e5a04fc6037e19fcc.tar.gz bcm5719-llvm-9bc9bcc2472373ab81a2106e5a04fc6037e19fcc.zip |
Format string analysis: give 'q' its own enumerator.
This is in preparation for being able to warn about 'q' and other
non-standard format string features.
It also allows us to print its name correctly.
llvm-svn: 150697
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/Sema/format-strings-scanf.c | 4 | ||||
-rw-r--r-- | clang/test/Sema/format-strings.c | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/clang/test/Sema/format-strings-scanf.c b/clang/test/Sema/format-strings-scanf.c index c97da3fd921..e94af5acb11 100644 --- a/clang/test/Sema/format-strings-scanf.c +++ b/clang/test/Sema/format-strings-scanf.c @@ -117,3 +117,7 @@ void test_longlong(long long *x, unsigned long long *y) { scanf("%Ls", "hello"); // expected-warning {{length modifier 'L' results in undefined behavior or no effect with 's' conversion specifier}} } +void test_quad(int *x, long long *llx) { + scanf("%qd", x); // expected-warning{{format specifies type 'long long *' but the argument has type 'int *'}} + scanf("%qd", llx); // no-warning +} diff --git a/clang/test/Sema/format-strings.c b/clang/test/Sema/format-strings.c index a7b40f8a55f..e6ce6e3c4ab 100644 --- a/clang/test/Sema/format-strings.c +++ b/clang/test/Sema/format-strings.c @@ -167,7 +167,9 @@ void test10(int x, float f, int i, long long lli) { printf("%.d", x); // no-warning printf("%.", x); // expected-warning{{incomplete format specifier}} printf("%f", 4); // expected-warning{{format specifies type 'double' but the argument has type 'int'}} - printf("%qd", lli); + printf("%qd", lli); // no-warning + printf("%qd", x); // expected-warning{{format specifies type 'long long' but the argument has type 'int'}} + printf("%qp", (void *)0); // expected-warning{{length modifier 'q' results in undefined behavior or no effect with 'p' conversion specifier}} printf("hhX %hhX", (unsigned char)10); // no-warning printf("llX %llX", (long long) 10); // no-warning // This is fine, because there is an implicit conversion to an int. |