2 // RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fblocks -Wformat -fixit %t
3 // RUN: grep -v CHECK %t | FileCheck %s
5 /* This is a test of code modifications created by darwin format fix-its hints
6 that are provided as part of warning */
8 int printf(const char * restrict, ...);
12 typedef long NSInteger;
13 typedef unsigned long NSUInteger;
16 typedef int NSInteger;
17 typedef unsigned int NSUInteger;
19 CFIndex getCFIndex(void);
20 NSInteger getNSInteger(void);
21 NSUInteger getNSUInteger(void);
25 printf(__VA_ARGS__); \
30 printf(__VA_ARGS__); \
31 printf(__VA_ARGS__); \
34 #define Log3(X, Y, Z) \
41 printf("test 1: %s", getNSInteger());
42 // CHECK: printf("test 1: %ld", (long)getNSInteger());
43 printf("test 2: %s %s", getNSInteger(), getNSInteger());
44 // CHECK: printf("test 2: %ld %ld", (long)getNSInteger(), (long)getNSInteger());
46 Log1("test 3: %s", getNSInteger());
47 // CHECK: Log1("test 3: %ld", (long)getNSInteger());
48 Log1("test 4: %s %s", getNSInteger(), getNSInteger());
49 // CHECK: Log1("test 4: %ld %ld", (long)getNSInteger(), (long)getNSInteger());
51 Log2("test 5: %s", getNSInteger());
52 // CHECK: Log2("test 5: %ld", (long)getNSInteger());
53 Log2("test 6: %s %s", getNSInteger(), getNSInteger());
54 // CHECK: Log2("test 6: %ld %ld", (long)getNSInteger(), (long)getNSInteger());
56 // Artificial test to check that X (in Log3(X, Y, Z))
57 // is modified only according to the diagnostics
58 // for the first printf and the modification caused
59 // by the second printf is dropped.
60 Log3("test 7: %s", getNSInteger(), getNSUInteger());
61 // CHECK: Log3("test 7: %ld", (long)getNSInteger(), (unsigned long)getNSUInteger());
66 printf(__VA_ARGS__); \
71 Outer1(__VA_ARGS__); Outer1(__VA_ARGS__); \
75 Outer2("test 8: %s", getNSInteger());
76 // CHECK: Outer2("test 8: %ld", (long)getNSInteger());
77 Outer2("test 9: %s %s", getNSInteger(), getNSInteger());
78 // CHECK: Outer2("test 9: %ld %ld", (long)getNSInteger(), (long)getNSInteger());
81 void testCFIndex(void) {
82 printf("test 10: %s", getCFIndex());
83 // CHECK: printf("test 10: %ld", (long)getCFIndex());
84 printf("test 11: %s %s", getCFIndex(), getCFIndex());
85 // CHECK: printf("test 11: %ld %ld", (long)getCFIndex(), (long)getCFIndex());