Skip to content

Commit c725301

Browse files
committed
fix unit tests to match new warning message
1 parent 2104952 commit c725301

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

clang-tools-extra/test/clang-tidy/checkers/portability/avoid-platform-specific-fundamental-types-ints.cpp

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,28 @@ typedef unsigned long size_t;
2323

2424
// Test fundamental integer types that should trigger warnings
2525
int global_int = 42;
26-
// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: avoid using platform-dependent fundamental integer type 'int'; consider using a 'typedef' or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
26+
// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: avoid using platform-dependent fundamental integer type 'int'; consider using a type alias or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
2727

2828
short global_short = 10;
29-
// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: avoid using platform-dependent fundamental integer type 'short'; consider using a 'typedef' or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
29+
// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: avoid using platform-dependent fundamental integer type 'short'; consider using a type alias or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
3030

3131
long global_long = 100L;
32-
// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: avoid using platform-dependent fundamental integer type 'long'; consider using a 'typedef' or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
32+
// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: avoid using platform-dependent fundamental integer type 'long'; consider using a type alias or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
3333

3434
long long global_long_long = 1000LL;
35-
// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: avoid using platform-dependent fundamental integer type 'long long'; consider using a 'typedef' or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
35+
// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: avoid using platform-dependent fundamental integer type 'long long'; consider using a type alias or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
3636

3737
unsigned int global_unsigned_int = 42U;
38-
// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: avoid using platform-dependent fundamental integer type 'unsigned int'; consider using a 'typedef' or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
38+
// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: avoid using platform-dependent fundamental integer type 'unsigned int'; consider using a type alias or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
3939

4040
unsigned short global_unsigned_short = 10U;
41-
// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: avoid using platform-dependent fundamental integer type 'unsigned short'; consider using a 'typedef' or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
41+
// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: avoid using platform-dependent fundamental integer type 'unsigned short'; consider using a type alias or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
4242

4343
unsigned long global_unsigned_long = 100UL;
44-
// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: avoid using platform-dependent fundamental integer type 'unsigned long'; consider using a 'typedef' or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
44+
// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: avoid using platform-dependent fundamental integer type 'unsigned long'; consider using a type alias or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
4545

4646
unsigned long long global_unsigned_long_long = 1000ULL;
47-
// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: avoid using platform-dependent fundamental integer type 'unsigned long long'; consider using a 'typedef' or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
47+
// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: avoid using platform-dependent fundamental integer type 'unsigned long long'; consider using a type alias or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
4848

4949
// Test integer that should NEVER trigger warnings
5050
bool global_bool = true;
@@ -68,34 +68,34 @@ ptrdiff_t global_ptrdiff = 50;
6868

6969
// Test function parameters
7070
void function_with_int_param(int param) {
71-
// CHECK-MESSAGES: :[[@LINE-1]]:30: warning: avoid using platform-dependent fundamental integer type 'int'; consider using a 'typedef' or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
71+
// CHECK-MESSAGES: :[[@LINE-1]]:30: warning: avoid using platform-dependent fundamental integer type 'int'; consider using a type alias or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
7272
}
7373

7474
void function_with_short_param(short param) {
75-
// CHECK-MESSAGES: :[[@LINE-1]]:32: warning: avoid using platform-dependent fundamental integer type 'short'; consider using a 'typedef' or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
75+
// CHECK-MESSAGES: :[[@LINE-1]]:32: warning: avoid using platform-dependent fundamental integer type 'short'; consider using a type alias or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
7676
}
7777

7878
// Test function return types
7979
int function_returning_int() {
80-
// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: avoid using platform-dependent fundamental integer type 'int'; consider using a 'typedef' or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
80+
// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: avoid using platform-dependent fundamental integer type 'int'; consider using a type alias or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
8181
return 42;
8282
}
8383

8484
long function_returning_long() {
85-
// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: avoid using platform-dependent fundamental integer type 'long'; consider using a 'typedef' or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
85+
// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: avoid using platform-dependent fundamental integer type 'long'; consider using a type alias or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
8686
return 100L;
8787
}
8888

8989
// Test local variables
9090
void test_local_variables() {
9191
int local_int = 10;
92-
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: avoid using platform-dependent fundamental integer type 'int'; consider using a 'typedef' or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
92+
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: avoid using platform-dependent fundamental integer type 'int'; consider using a type alias or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
9393

9494
short local_short = 5;
95-
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: avoid using platform-dependent fundamental integer type 'short'; consider using a 'typedef' or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
95+
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: avoid using platform-dependent fundamental integer type 'short'; consider using a type alias or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
9696

9797
unsigned long local_unsigned_long = 200UL;
98-
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: avoid using platform-dependent fundamental integer type 'unsigned long'; consider using a 'typedef' or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
98+
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: avoid using platform-dependent fundamental integer type 'unsigned long'; consider using a type alias or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
9999

100100
// These should not trigger warnings
101101
char local_char = 'x';
@@ -113,10 +113,10 @@ void test_local_variables() {
113113
// Test struct/class members
114114
struct TestStruct {
115115
int member_int;
116-
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: avoid using platform-dependent fundamental integer type 'int'; consider using a 'typedef' or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
116+
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: avoid using platform-dependent fundamental integer type 'int'; consider using a type alias or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
117117

118118
long member_long;
119-
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: avoid using platform-dependent fundamental integer type 'long'; consider using a 'typedef' or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
119+
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: avoid using platform-dependent fundamental integer type 'long'; consider using a type alias or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
120120

121121
// These should not trigger warnings
122122
char member_char;
@@ -126,29 +126,29 @@ struct TestStruct {
126126
class TestClass {
127127
public:
128128
unsigned int public_member;
129-
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: avoid using platform-dependent fundamental integer type 'unsigned int'; consider using a 'typedef' or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
129+
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: avoid using platform-dependent fundamental integer type 'unsigned int'; consider using a type alias or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
130130

131131
private:
132132
short private_member;
133-
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: avoid using platform-dependent fundamental integer type 'short'; consider using a 'typedef' or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
133+
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: avoid using platform-dependent fundamental integer type 'short'; consider using a type alias or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
134134
};
135135

136136
// Test typedefs and type aliases
137137
typedef int MyInt;
138-
// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: avoid using platform-dependent fundamental integer type 'int'; consider using a 'typedef' or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
138+
// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: avoid using platform-dependent fundamental integer type 'int'; consider using a type alias or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
139139

140140
using MyLong = long;
141-
// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: avoid using platform-dependent fundamental integer type 'long'; consider using a 'typedef' or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
141+
// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: avoid using platform-dependent fundamental integer type 'long'; consider using a type alias or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
142142

143143
typedef long long customType;
144-
// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: avoid using platform-dependent fundamental integer type 'long long'; consider using a 'typedef' or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
144+
// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: avoid using platform-dependent fundamental integer type 'long long'; consider using a type alias or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
145145

146146
// Test template parameters
147147
template<typename T>
148148
void template_function(T param) {}
149149

150150
template<>
151151
void template_function<int>(int param) {
152-
// CHECK-MESSAGES: :[[@LINE-1]]:24: warning: avoid using platform-dependent fundamental integer type 'int'; consider using a 'typedef' or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
153-
// CHECK-MESSAGES: :[[@LINE-2]]:29: warning: avoid using platform-dependent fundamental integer type 'int'; consider using a 'typedef' or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
152+
// CHECK-MESSAGES: :[[@LINE-1]]:24: warning: avoid using platform-dependent fundamental integer type 'int'; consider using a type alias or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
153+
// CHECK-MESSAGES: :[[@LINE-2]]:29: warning: avoid using platform-dependent fundamental integer type 'int'; consider using a type alias or fixed-width type instead [portability-avoid-platform-specific-fundamental-types]
154154
}

0 commit comments

Comments
 (0)