diff options
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/FixIt/format.m | 4 | ||||
| -rw-r--r-- | clang/test/Index/fix-its.c | 2 | ||||
| -rw-r--r-- | clang/test/Misc/caret-diags-macros.c | 2 | ||||
| -rw-r--r-- | clang/test/Sema/format-strings-fixit.c | 8 |
4 files changed, 10 insertions, 6 deletions
diff --git a/clang/test/FixIt/format.m b/clang/test/FixIt/format.m index f8ca0e124de..919212b3067 100644 --- a/clang/test/FixIt/format.m +++ b/clang/test/FixIt/format.m @@ -223,4 +223,8 @@ void testSignedness(long i, unsigned long u) { // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:11-[[@LINE-4]]:13}:"%lu" // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:11-[[@LINE-4]]:13}:"%lu" // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:11-[[@LINE-4]]:13}:"%ld" + + printf("%+d", u); // expected-warning{{format specifies type 'int' but the argument has type 'unsigned long'}} + + // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:11-[[@LINE-2]]:14}:"%+ld" } diff --git a/clang/test/Index/fix-its.c b/clang/test/Index/fix-its.c index d5cb1af854c..1e710c28afc 100644 --- a/clang/test/Index/fix-its.c +++ b/clang/test/Index/fix-its.c @@ -22,6 +22,6 @@ int printf(const char *restrict, ...); void f2() { unsigned long index; // CHECK: warning: format specifies type 'int' but the argument has type 'unsigned long' - // CHECK: FIX-IT: Replace [26:17 - 26:19] with "%ld" + // CHECK: FIX-IT: Replace [26:17 - 26:19] with "%lu" MACRO(printf("%d", index)); } diff --git a/clang/test/Misc/caret-diags-macros.c b/clang/test/Misc/caret-diags-macros.c index 538431a17a0..316454c513b 100644 --- a/clang/test/Misc/caret-diags-macros.c +++ b/clang/test/Misc/caret-diags-macros.c @@ -218,7 +218,7 @@ Csprintf(pMsgBuf,"\nEnter minimum anagram length (2-%1d): ", Cstrlen(pKeepBuf)); // CHECK: {{.*}}:216:62: warning: format specifies type 'int' but the argument has type 'unsigned long' // CHECK-NEXT: Csprintf(pMsgBuf,"\nEnter minimum anagram length (2-%1d): ", Cstrlen(pKeepBuf)); // CHECK-NEXT: {{^ ~~~ \^}} -// CHECK-NEXT: {{^ %1ld}} +// CHECK-NEXT: {{^ %1lu}} // CHECK-NEXT: {{.*}}:213:21: note: expanded from macro 'Cstrlen' // CHECK-NEXT: #define Cstrlen(a) strlen_test(a) // CHECK-NEXT: {{^ \^}} diff --git a/clang/test/Sema/format-strings-fixit.c b/clang/test/Sema/format-strings-fixit.c index 15ac7134287..31274185cbc 100644 --- a/clang/test/Sema/format-strings-fixit.c +++ b/clang/test/Sema/format-strings-fixit.c @@ -165,7 +165,7 @@ void test2() { // Validate the fixes. // CHECK: printf("%d", (int) 123); // CHECK: printf("abc%s", "testing testing 123"); -// CHECK: printf("%lu", (long) -12); +// CHECK: printf("%ld", (long) -12); // CHECK: printf("%d", 123); // CHECK: printf("%s\n", "x"); // CHECK: printf("%f\n", 1.23); @@ -193,11 +193,11 @@ void test2() { // CHECK: printf("%d", (my_int_type) 42); // CHECK: printf("%s", "foo"); // CHECK: printf("%lo", (long) 42); -// CHECK: printf("%lu", (long) 42); +// CHECK: printf("%ld", (long) 42); // CHECK: printf("%lx", (long) 42); // CHECK: printf("%lX", (long) 42); -// CHECK: printf("%li", (unsigned long) 42); -// CHECK: printf("%ld", (unsigned long) 42); +// CHECK: printf("%lu", (unsigned long) 42); +// CHECK: printf("%lu", (unsigned long) 42); // CHECK: printf("%LF", (long double) 42); // CHECK: printf("%Le", (long double) 42); // CHECK: printf("%LE", (long double) 42); |

