2 // RUN: %clang_cc1 -triple=x86_64-pc-linux-gnu -Wformat -Wformat-signedness -fixit %t
3 // RUN: %clang_cc1 -triple=x86_64-pc-linux-gnu -fsyntax-only -Wformat -Wformat-signedness -Werror %t
4 // RUN: %clang_cc1 -triple=x86_64-pc-linux-gnu -E -o - %t | FileCheck %s
8 int printf(const char *restrict format
, ...);
10 void test_printf_int(int x
)
15 void test_printf_unsigned(unsigned x
)
20 void test_printf_long(long x
)
25 void test_printf_unsigned_long(unsigned long x
)
30 void test_printf_long_long(long long x
)
35 void test_printf_unsigned_long_long(unsigned long long x
)
44 void test_printf_enum_int(enum enum_int x
)
53 void test_printf_enum_unsigned(enum enum_unsigned x
)
61 unsigned_val
= (unsigned)INT_MIN
64 void test_printf_enum_long(enum enum_long x
)
69 enum enum_unsigned_long
{
70 uint_max_plus
= (unsigned long)UINT_MAX
+1,
73 void test_printf_enum_unsigned_long(enum enum_unsigned_long x
)
78 // Validate the fixes.
79 // CHECK: void test_printf_int(int x)
80 // CHECK: printf("%d", x);
81 // CHECK: void test_printf_unsigned(unsigned x)
82 // CHECK: printf("%u", x);
83 // CHECK: void test_printf_long(long x)
84 // CHECK: printf("%ld", x);
85 // CHECK: void test_printf_unsigned_long(unsigned long x)
86 // CHECK: printf("%lu", x);
87 // CHECK: void test_printf_long_long(long long x)
88 // CHECK: printf("%lld", x);
89 // CHECK: void test_printf_unsigned_long_long(unsigned long long x)
90 // CHECK: printf("%llu", x);
91 // CHECK: void test_printf_enum_int(enum enum_int x)
92 // CHECK: printf("%d", x);
93 // CHECK: void test_printf_enum_unsigned(enum enum_unsigned x)
94 // CHECK: printf("%u", x);
95 // CHECK: void test_printf_enum_long(enum enum_long x)
96 // CHECK: printf("%ld", x);
97 // CHECK: void test_printf_enum_unsigned_long(enum enum_unsigned_long x)
98 // CHECK: printf("%lu", x);