summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Sema/format-strings-scanf.c4
-rw-r--r--clang/test/Sema/format-strings.c4
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.
OpenPOWER on IntegriCloud