diff options
| author | Hans Wennborg <hans@hanshq.net> | 2014-09-04 21:39:52 +0000 |
|---|---|---|
| committer | Hans Wennborg <hans@hanshq.net> | 2014-09-04 21:39:52 +0000 |
| commit | 1b23158ce419a1c67a27aa45ec9f2a5b26b6b9a9 (patch) | |
| tree | 21cc72d241d1e4270f3751643c9fcede5dac50af /clang/test/Sema/format-strings-ms.c | |
| parent | 68f42b95150281a6b8f031a8ec4c820aec8fd163 (diff) | |
| download | bcm5719-llvm-1b23158ce419a1c67a27aa45ec9f2a5b26b6b9a9.tar.gz bcm5719-llvm-1b23158ce419a1c67a27aa45ec9f2a5b26b6b9a9.zip | |
MS format strings: allow the 'h' length modifier with C, C, s and S (PR20808)
llvm-svn: 217196
Diffstat (limited to 'clang/test/Sema/format-strings-ms.c')
| -rw-r--r-- | clang/test/Sema/format-strings-ms.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/test/Sema/format-strings-ms.c b/clang/test/Sema/format-strings-ms.c index 3daa0e4f1d5..4a6f91b5598 100644 --- a/clang/test/Sema/format-strings-ms.c +++ b/clang/test/Sema/format-strings-ms.c @@ -63,4 +63,16 @@ void w_test(wchar_t c, wchar_t *s) { } +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 |

