diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-07-05 14:23:59 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-07-05 14:23:59 +0000 |
commit | c192b3dcffd5e672a2b2e1730e2440febb4fb192 (patch) | |
tree | ac719b5984165053bf83d71142e4d96b609b9784 /test/SemaObjC/format-strings-objc.m | |
parent | 2e645aa5697838f16ec570eb07c2bee7e13d0e0b (diff) |
Diffstat (limited to 'test/SemaObjC/format-strings-objc.m')
-rw-r--r-- | test/SemaObjC/format-strings-objc.m | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/SemaObjC/format-strings-objc.m b/test/SemaObjC/format-strings-objc.m index f4c528cc7ac04..079460cc76cb6 100644 --- a/test/SemaObjC/format-strings-objc.m +++ b/test/SemaObjC/format-strings-objc.m @@ -251,3 +251,16 @@ void testUnicode() { NSLog(@"%C", 0x202200); // expected-warning{{format specifies type 'unichar' (aka 'unsigned short') but the argument has type 'int'}} } +// Test Objective-C modifier flags. +void testObjCModifierFlags() { + NSLog(@"%[]@", @"Foo"); // expected-warning {{missing object format flag}} + NSLog(@"%[", @"Foo"); // expected-warning {{incomplete format specifier}} + NSLog(@"%[tt", @"Foo"); // expected-warning {{incomplete format specifier}} + NSLog(@"%[tt]@", @"Foo"); // no-warning + NSLog(@"%[tt]@ %s", @"Foo", "hello"); // no-warning + NSLog(@"%s %[tt]@", "hello", @"Foo"); // no-warning + NSLog(@"%[blark]@", @"Foo"); // expected-warning {{'blark' is not a valid object format flag}} + NSLog(@"%2$[tt]@ %1$[tt]@", @"Foo", @"Bar"); // no-warning + NSLog(@"%2$[tt]@ %1$[tt]s", @"Foo", @"Bar"); // expected-warning {{object format flags cannot be used with 's' conversion specifier}} +} + |