1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -fdiagnostics-parseable-fixits -fsyntax-only %s 2>&1 | FileCheck %s
7 extern void NSLog(NSString *format, ...);
8 int printf(const char * restrict, ...) ;
11 void test_object_correction (id x) {
12 printf("%d", x); // expected-warning{{format specifies type 'int' but the argument has type 'id'}}
13 printf("%s", x); // expected-warning{{format specifies type 'char *' but the argument has type 'id'}}
14 printf("%lf", x); // expected-warning{{format specifies type 'double' but the argument has type 'id'}}
18 // Old-style Core Foundation types do not have __attribute__((NSObject)).
19 // This is okay, but we won't suggest a fixit; arbitrary structure pointers may
21 typedef const struct __CFString * CFStringRef;
23 void test_cf_object_correction (CFStringRef x) {
24 NSLog(@"%@", x); // no-warning
26 NSLog(@"%d", x); // expected-warning{{format specifies type 'int' but the argument has type 'CFStringRef'}}
27 NSLog(@"%s", x); // expected-warning{{format specifies type 'char *' but the argument has type 'CFStringRef'}}
28 NSLog(@"%lf", x); // expected-warning{{format specifies type 'double' but the argument has type 'CFStringRef'}}