summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/format-strings.c
diff options
context:
space:
mode:
authorJames Molloy <james.molloy@arm.com>2012-05-04 11:23:40 +0000
committerJames Molloy <james.molloy@arm.com>2012-05-04 11:23:40 +0000
commit222f27858f25a93ffea8a5d47669180344a03efc (patch)
tree2d14e4340e82135e32b77c722a7531292e6bf650 /clang/test/Sema/format-strings.c
parent14316fcf7d525dcdcf6d3772cfaa7af24669dfed (diff)
downloadbcm5719-llvm-222f27858f25a93ffea8a5d47669180344a03efc.tar.gz
bcm5719-llvm-222f27858f25a93ffea8a5d47669180344a03efc.zip
Add a predefine __WINT_UNSIGNED__, similar to __WCHAR_UNSIGNED__, and test them both for ARM and X86.
Use this to fully fix Sema/format-strings.c for non-x86 platforms. Reviewed by Chandler on IRC. llvm-svn: 156169
Diffstat (limited to 'clang/test/Sema/format-strings.c')
-rw-r--r--clang/test/Sema/format-strings.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/test/Sema/format-strings.c b/clang/test/Sema/format-strings.c
index d1dca7e2fb0..5d8e4cbb874 100644
--- a/clang/test/Sema/format-strings.c
+++ b/clang/test/Sema/format-strings.c
@@ -339,7 +339,12 @@ void pr7981(wint_t c, wchar_t c2) {
printf("%lc", 1.0); // expected-warning{{the argument has type 'double'}}
printf("%lc", (char) 1); // no-warning
printf("%lc", &c); // expected-warning{{the argument has type 'wint_t *'}}
+ // If wint_t and wchar_t are the same width and wint_t is signed where
+ // wchar_t is unsigned, an implicit conversion isn't possible.
+#if defined(__WINT_UNSIGNED__) || !defined(__WCHAR_UNSIGNED__) || \
+ __WINT_WIDTH__ > __WCHAR_WIDTH__
printf("%lc", c2); // no-warning
+#endif
}
// <rdar://problem/8269537> -Wformat-security says NULL is not a string literal
OpenPOWER on IntegriCloud