[cfe-commits] r94865 - /cfe/trunk/test/SemaObjC/format-strings-objc.m

Ted Kremenek kremenek at apple.com
Fri Jan 29 16:56:00 PST 2010


Author: kremenek
Date: Fri Jan 29 18:56:00 2010
New Revision: 94865

URL: http://llvm.org/viewvc/llvm-project?rev=94865&view=rev
Log:
Add test case for <rdar://problem/7068334> (which was fixed by r94864).

Modified:
    cfe/trunk/test/SemaObjC/format-strings-objc.m

Modified: cfe/trunk/test/SemaObjC/format-strings-objc.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/format-strings-objc.m?rev=94865&r1=94864&r2=94865&view=diff

==============================================================================
--- cfe/trunk/test/SemaObjC/format-strings-objc.m (original)
+++ cfe/trunk/test/SemaObjC/format-strings-objc.m Fri Jan 29 18:56:00 2010
@@ -29,6 +29,8 @@
 typedef const struct __CFString * CFStringRef;
 extern void CFStringCreateWithFormat(CFStringRef format, ...) __attribute__((format(CFString, 1, 2)));
 
+int printf(const char * restrict, ...) ;
+
 //===----------------------------------------------------------------------===//
 // Test cases.
 //===----------------------------------------------------------------------===//
@@ -41,3 +43,10 @@
 // Check type validation
 extern void NSLog2(int format, ...) __attribute__((format(__NSString__, 1, 2))); // expected-error {{format argument not an NSString}}
 extern void CFStringCreateWithFormat2(int *format, ...) __attribute__((format(CFString, 1, 2))); // expected-error {{format argument not a CFString}}
+
+// <rdar://problem/7068334> - Catch use of long long with int arguments.
+void rdar_7068334() {
+  long long test = 500;  
+  printf("%i ",test); // expected-warning{{conversion specifies type 'int' but the argument has type 'long long'}}
+  NSLog(@"%i ",test); // expected-warning{{conversion specifies type 'int' but the argument has type 'long long'}}
+}





More information about the cfe-commits mailing list