summaryrefslogtreecommitdiffstats
path: root/clang/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
commit74a4ce7f1e6b449834fd4ba9f63939d69140df27 (patch)
tree637472cd57b994b86eeaee7bb6940ce461ced8ea /clang/test/Sema/format-strings.c
parent49346eedeb81a5085b2c808a30dcc39730d708e2 (diff)
downloadbcm5719-llvm-74a4ce7f1e6b449834fd4ba9f63939d69140df27.tar.gz
bcm5719-llvm-74a4ce7f1e6b449834fd4ba9f63939d69140df27.zip
Add support for '%C' and '%S' printf conversion specifiers.
llvm-svn: 97005
Diffstat (limited to 'clang/test/Sema/format-strings.c')
-rw-r--r--clang/test/Sema/format-strings.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/Sema/format-strings.c b/clang/test/Sema/format-strings.c
index f1fa6580e3b..4cd4db26ebb 100644
--- a/clang/test/Sema/format-strings.c
+++ b/clang/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 *'}}
+}
+
OpenPOWER on IntegriCloud