2 // RUN: %clang_cc1 -fsyntax-only -fixit %t
3 // RUN: %clang_cc1 -E -o - %t | FileCheck %s
5 /* This is a test of the various code modification hints that are
6 provided as part of warning or extension diagnostics. Only
7 warnings for format strings within the function call will be
8 fixed by -fixit. Other format strings will be left alone. */
10 int printf(char const *, ...);
11 int scanf(char const *, ...);
14 const char kFormat1[] = "%s";
18 const char kFormat2[] = "%.3p";
23 const char kFormat3[] = "%0s";
24 printf(kFormat3, "a");
27 const char kFormat4[] = "%hhs";
28 printf(kFormat4, "a");
31 const char kFormat5[] = "%-0d";
35 const char kFormat6[] = "%00d";
41 // CHECK: const char kFormat1[] = "%s";
42 // CHECK: printf(kFormat1, 5);
43 // CHECK: printf("%d", 5);
45 // CHECK: const char kFormat2[] = "%.3p";
47 // CHECK: printf(kFormat2, p);
48 // CHECK: printf("%p", p);
50 // CHECK: const char kFormat3[] = "%0s";
51 // CHECK: printf(kFormat3, "a");
52 // CHECK: printf("%s", "a");
54 // CHECK: const char kFormat4[] = "%hhs";
55 // CHECK: printf(kFormat4, "a");
56 // CHECK: printf("%s", "a");
58 // CHECK: const char kFormat5[] = "%-0d";
59 // CHECK: printf(kFormat5, 5);
60 // CHECK: printf("%-d", 5);
62 // CHECK: const char kFormat6[] = "%00d";
64 // CHECK: scanf(kFormat6, i);
65 // CHECK: scanf("%d", i);