summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/format-strings-ms.c
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2018-09-19 16:18:55 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2018-09-19 16:18:55 +0000
commit6183c6316d2187a4cbca23e7c3e07d36ef1edd8b (patch)
treea19d4a9936e9d8a1f77ee70d90a13cda4e2abda4 /clang/test/Sema/format-strings-ms.c
parent5b476c5a9f6e250a4b4b2d18f6da839ca62dd458 (diff)
downloadbcm5719-llvm-6183c6316d2187a4cbca23e7c3e07d36ef1edd8b.tar.gz
bcm5719-llvm-6183c6316d2187a4cbca23e7c3e07d36ef1edd8b.zip
Basic: correct `__WINT_TYPE__` on Windows
Windows uses `unsigned short` for `wint_t`. Correct the type definition as vended by the compiler. This type is defined in corecrt.h and is unconditionally typedef'ed. cl does not have an equivalent to `__WINT_TYPE__` which is why this was never detected. llvm-svn: 342557
Diffstat (limited to 'clang/test/Sema/format-strings-ms.c')
-rw-r--r--clang/test/Sema/format-strings-ms.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/test/Sema/format-strings-ms.c b/clang/test/Sema/format-strings-ms.c
index 42676e7a4e0..9887b461f61 100644
--- a/clang/test/Sema/format-strings-ms.c
+++ b/clang/test/Sema/format-strings-ms.c
@@ -13,6 +13,7 @@ void non_iso_warning_test(__int32 i32, __int64 i64, wchar_t c, void *p) {
printf("%I32d", i32); // expected-warning{{'I32' length modifier is not supported by ISO C}}
printf("%I64d", i64); // expected-warning{{'I64' length modifier is not supported by ISO C}}
printf("%wc", c); // expected-warning{{'w' length modifier is not supported by ISO C}}
+ // expected-warning@-1{{format specifies type 'wint_t' (aka 'unsigned short') but the argument has type 'wchar_t' (aka 'unsigned short')}}
printf("%Z", p); // expected-warning{{'Z' conversion specifier is not supported by ISO C}}
}
@@ -35,7 +36,7 @@ void unsigned_test() {
}
void w_test(wchar_t c, wchar_t *s) {
- printf("%wc", c);
+ printf("%wc", c); // expected-warning{{format specifies type 'wint_t' (aka 'unsigned short') but the argument has type 'wchar_t' (aka 'unsigned short')}}
printf("%wC", c);
printf("%C", c);
printf("%ws", s);
@@ -49,7 +50,7 @@ void w_test(wchar_t c, wchar_t *s) {
scanf("%S", s);
double bad;
- printf("%wc", bad); // expected-warning{{format specifies type 'wint_t' (aka 'int') but the argument has type 'double'}}
+ printf("%wc", bad); // expected-warning{{format specifies type 'wint_t' (aka 'unsigned short') but the argument has type 'double'}}
printf("%wC", bad); // expected-warning{{format specifies type 'wchar_t' (aka 'unsigned short') but the argument has type 'double'}}
printf("%C", bad); // expected-warning{{format specifies type 'wchar_t' (aka 'unsigned short') but the argument has type 'double'}}
printf("%ws", bad); // expected-warning{{format specifies type 'wchar_t *' (aka 'unsigned short *') but the argument has type 'double'}}
OpenPOWER on IntegriCloud