MS format strings: allow the 'h' length modifier with C, C, s and S (PR20808)
llvm-svn: 217196
diff --git a/clang/test/Sema/format-strings-ms.c b/clang/test/Sema/format-strings-ms.c
index 3daa0e4..4a6f91b 100644
--- a/clang/test/Sema/format-strings-ms.c
+++ b/clang/test/Sema/format-strings-ms.c
@@ -63,4 +63,16 @@
}
+void h_test(char c, char* s) {
+ double bad;
+ printf("%hc", bad); // expected-warning{{format specifies type 'int' but the argument has type 'double'}}
+ printf("%hC", bad); // expected-warning{{format specifies type 'int' but the argument has type 'double'}}
+ printf("%hs", bad); // expected-warning{{format specifies type 'char *' but the argument has type 'double'}}
+ printf("%hS", bad); // expected-warning{{format specifies type 'char *' but the argument has type 'double'}}
+ scanf("%hc", &bad); // expected-warning{{format specifies type 'char *' but the argument has type 'double *'}}
+ scanf("%hC", &bad); // expected-warning{{format specifies type 'char *' but the argument has type 'double *'}}
+ scanf("%hs", &bad); // expected-warning{{format specifies type 'char *' but the argument has type 'double *'}}
+ scanf("%hS", &bad); // expected-warning{{format specifies type 'char *' but the argument has type 'double *'}}
+}
+
#endif