[clang] 5ee51e8 - [clang] trim trailing space in format tests. NFC
YingChi Long via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 31 22:31:24 PDT 2022
Author: YingChi Long
Date: 2022-09-01T13:30:40+08:00
New Revision: 5ee51e8154253088b333c8e82c64d0f00d7d0524
URL: https://github.com/llvm/llvm-project/commit/5ee51e8154253088b333c8e82c64d0f00d7d0524
DIFF: https://github.com/llvm/llvm-project/commit/5ee51e8154253088b333c8e82c64d0f00d7d0524.diff
LOG: [clang] trim trailing space in format tests. NFC
Found in https://reviews.llvm.org/D132568
Differential Revision: https://reviews.llvm.org/D133085
Added:
Modified:
clang/test/FixIt/format.m
clang/test/FixIt/format.mm
clang/test/Sema/format-strings-scanf.c
Removed:
################################################################################
diff --git a/clang/test/FixIt/format.m b/clang/test/FixIt/format.m
index 966cf79b2e0f7..950765bad9339 100644
--- a/clang/test/FixIt/format.m
+++ b/clang/test/FixIt/format.m
@@ -37,7 +37,7 @@ void test_string_correction (char *x) {
// CHECK: fix-it:"{{.*}}":{34:11-34:13}:"%s"
}
-void test_object_correction (id x) {
+void test_object_correction (id x) {
NSLog(@"%d", x); // expected-warning{{format specifies type 'int' but the argument has type 'id'}}
NSLog(@"%s", x); // expected-warning{{format specifies type 'char *' but the argument has type 'id'}}
NSLog(@"%lf", x); // expected-warning{{format specifies type 'double' but the argument has type 'id'}}
@@ -108,7 +108,7 @@ void test_char(char c, signed char s, unsigned char u, uint8_t n) {
NSLog(@"%c", c); // no-warning
// CHECK-NOT: fix-it:"{{.*}}":{[[@LINE-1]]:11-[[@LINE-1]]:13}:"%c"
-
+
NSLog(@"%s", s); // expected-warning{{format specifies type 'char *' but the argument has type 'signed char'}}
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:11-[[@LINE-1]]:13}:"%c"
@@ -197,11 +197,11 @@ void test_percent_C(void) {
// CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:16-[[@LINE-2]]:16}:"(unsigned short)"
typedef unsigned short unichar;
-
+
NSLog(@"%C", 0x260300); // expected-warning{{format specifies type 'unichar' (aka 'unsigned short') but the argument has type 'int'}}
// CHECK-NOT: fix-it:"{{.*}}":{[[@LINE-1]]:11-[[@LINE-1]]:13}:"%d"
// CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:16-[[@LINE-2]]:16}:"(unichar)"
-
+
NSLog(@"%C", data ? 0x2F0000 : 0x260300); // expected-warning{{format specifies type 'unichar' (aka 'unsigned short') but the argument has type 'int'}}
// CHECK-NOT: fix-it:"{{.*}}":{[[@LINE-1]]:11-[[@LINE-1]]:13}:"%d"
// CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:16-[[@LINE-2]]:16}:"(unichar)("
@@ -239,7 +239,7 @@ void testSizeTypes(void) {
printf("%zd", 0.f); // expected-warning-re{{format specifies type 'ssize_t' (aka '{{.+}}') but the argument has type 'float'}}
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:11-[[@LINE-1]]:14}:"%f"
-
+
short x;
#if !defined(__ANDROID__) && !defined(__Fuchsia__)
printf("%zn", &x); // expected-warning-re{{format specifies type 'ssize_t *' (aka '{{.+}}') but the argument has type 'short *'}}
@@ -266,7 +266,7 @@ void testPtrDiffTypes(void) {
printf("%tu", 0.f); // expected-warning-re{{format specifies type 'unsigned ptr
diff _t' (aka '{{.+}}') but the argument has type 'float'}}
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:11-[[@LINE-1]]:14}:"%f"
-
+
ptr
diff _t p2 = 0;
printf("%td", p2); // No warning.
diff --git a/clang/test/FixIt/format.mm b/clang/test/FixIt/format.mm
index 9d89c062faa97..eed7c981f2c45 100644
--- a/clang/test/FixIt/format.mm
+++ b/clang/test/FixIt/format.mm
@@ -19,11 +19,11 @@ void test_percent_C() {
NSLog(@"%C", wchar_data); // expected-warning{{format specifies type 'unichar' (aka 'unsigned short') but the argument has type 'wchar_t'}}
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:16-[[@LINE-1]]:16}:"(unichar)"
-
+
NSLog(@"%C", 0x260300); // expected-warning{{format specifies type 'unichar' (aka 'unsigned short') but the argument has type 'int'}}
// CHECK-NOT: fix-it:"{{.*}}":{[[@LINE-1]]:11-[[@LINE-1]]:13}:"%d"
// CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:16-[[@LINE-2]]:16}:"(unichar)"
-
+
NSLog(@"%C", 0.0); // expected-warning{{format specifies type 'unichar' (aka 'unsigned short') but the argument has type 'double'}}
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:11-[[@LINE-1]]:13}:"%f"
// CHECK-NOT: fix-it:"{{.*}}":{[[@LINE-2]]:16-[[@LINE-2]]:16}:"(unichar)"
diff --git a/clang/test/Sema/format-strings-scanf.c b/clang/test/Sema/format-strings-scanf.c
index 054439ecaf5a7..aebb68c37fb98 100644
--- a/clang/test/Sema/format-strings-scanf.c
+++ b/clang/test/Sema/format-strings-scanf.c
@@ -12,7 +12,7 @@ typedef __SIZE_TYPE__ size_t;
unsigned int : (int)0, \
unsigned short : (short)0, \
unsigned char : (signed char)0))
-typedef __SSIZE_TYPE__ ssize_t;
+typedef __SSIZE_TYPE__ ssize_t;
typedef __PTRDIFF_TYPE__ ptr
diff _t;
#define __UNSIGNED_PTRDIFF_TYPE__ \
@@ -224,13 +224,13 @@ void test_ptr
diff _t_types(void) {
ptr
diff _t p2 = 0;
scanf("%td", &p2); // No warning.
-
+
double d2 = 0.;
scanf("%td", &d2); // expected-warning-re{{format specifies type 'ptr
diff _t *' (aka '{{.+}}') but the argument has type 'double *'}}
ptr
diff _t p3 = 0;
scanf("%tn", &p3); // No warning.
-
+
double d3 = 0.;
scanf("%tn", &d3); // expected-warning-re{{format specifies type 'ptr
diff _t *' (aka '{{.+}}') but the argument has type 'double *'}}
}
More information about the cfe-commits
mailing list