aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/format-strings.c
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-08-24 22:24:51 +0000
committerTed Kremenek <kremenek@apple.com>2010-08-24 22:24:51 +0000
commit9325eaf08fcccbc0d038e703f570c64daacdaa31 (patch)
tree3fe0fad021235b1707690aa05f1b0ceabe5f5cde /test/Sema/format-strings.c
parent4020f8703a8822fe0d4efe4a0dc74f0b8040bd9f (diff)
Fix printf format string checking for '%lc' (which expects a wint_t or compatible argument). Fixes PR 7981.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111978 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/format-strings.c')
-rw-r--r--test/Sema/format-strings.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/Sema/format-strings.c b/test/Sema/format-strings.c
index 080e4dbeb5..2325454c0b 100644
--- a/test/Sema/format-strings.c
+++ b/test/Sema/format-strings.c
@@ -286,3 +286,18 @@ void bug7377_bad_length_mod_usage() {
printf("%-0f", 1.23); // expected-warning{{flag '0' is ignored when flag '-' is present}}
printf("%-+f", 1.23); // no-warning
}
+
+// PR 7981 - handle '%lc' (wint_t)
+#ifndef wint_t
+typedef int __darwin_wint_t;
+typedef __darwin_wint_t wint_t;
+#endif
+
+void pr7981(wint_t c, wchar_t c2) {
+ printf("%lc", c); // no-warning
+ 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 *' (aka 'int *')}}
+ printf("%lc", c2); // no-warning
+}
+