aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/format-strings.c
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-02-24 00:05:54 +0000
committerTed Kremenek <kremenek@apple.com>2010-02-24 00:05:54 +0000
commit87260c7eabf88eb2009ba2ba20150cd897483241 (patch)
tree60d1b903ff318e339af688508d130631d22e81d7 /test/Sema/format-strings.c
parentf914b9782a6091a7c7dfd41b0a273ee724351b84 (diff)
Add support for '%C' and '%S' printf conversion specifiers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97005 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 f1fa6580e3..4cd4db26eb 100644
--- a/test/Sema/format-strings.c
+++ b/test/Sema/format-strings.c
@@ -204,3 +204,18 @@ void test_asl(aslclient asl) {
// <rdar://problem/7595366>
typedef enum { A } int_t;
void f0(int_t x) { printf("%d\n", x); }
+
+// Unicode test cases. These are possibly specific to Mac OS X. If so, they should
+// eventually be moved into a separate test.
+typedef __WCHAR_TYPE__ wchar_t;
+
+void test_unicode_conversions(wchar_t *s) {
+ printf("%S", s); // no-warning
+ printf("%s", s); // expected-warning{{conversion specifies type 'char *' but the argument has type 'wchar_t *'}}
+ printf("%C", s[0]); // no-warning
+ printf("%c", s[0]);
+ printf("%C", 10);
+ // FIXME: we report the expected type as 'int*' instead of 'wchar_t*'
+ printf("%S", "hello"); // expected-warning{{but the argument has type 'char *'}}
+}
+