Skip to content

Commit 11a277f

Browse files
committed
Deduplicate more test cases and fix expected results
1 parent 2ed4443 commit 11a277f

File tree

2 files changed

+32
-40
lines changed

2 files changed

+32
-40
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
| test.cpp:106:7:106:8 | (unsigned char)... | Implicit conversion of plain char $@ to unsigned char. | test.cpp:106:7:106:8 | x3 | expression |
2-
| test.cpp:109:20:109:21 | (signed char)... | Implicit conversion of plain char $@ to signed char. | test.cpp:109:20:109:21 | x4 | expression |
3-
| test.cpp:119:21:119:22 | (uint8_t)... | Implicit conversion of plain char $@ to uint8_t. | test.cpp:119:21:119:22 | x7 | expression |
4-
| test.cpp:122:20:122:21 | (int8_t)... | Implicit conversion of plain char $@ to int8_t. | test.cpp:122:20:122:21 | x8 | expression |
5-
| test.cpp:132:17:132:18 | definition of c3 | Implicit conversion of plain char $@ to unsigned char from instantiating template 'C1<T, y>'. | test.cpp:5:12:5:12 | 120 | expression |
6-
| test.cpp:135:17:135:18 | definition of c4 | Implicit conversion of plain char $@ to signed char from instantiating template 'C2<T, y>'. | test.cpp:13:12:13:12 | 120 | expression |
7-
| test.cpp:145:15:145:16 | definition of c7 | Implicit conversion of plain char $@ to uint8_t from instantiating template 'C5<T, y>'. | test.cpp:22:12:22:12 | 1 | expression |
8-
| test.cpp:148:15:148:16 | definition of c8 | Implicit conversion of plain char $@ to int8_t from instantiating template 'C6<T, y>'. | test.cpp:30:12:30:12 | 1 | expression |
9-
| test.cpp:165:7:165:10 | (unsigned char)... | Implicit conversion of plain char $@ to unsigned char. | test.cpp:165:7:165:10 | * ... | expression |
10-
| test.cpp:170:7:170:10 | (signed char)... | Implicit conversion of plain char $@ to signed char. | test.cpp:170:7:170:10 | * ... | expression |
11-
| test.cpp:185:7:185:10 | (uint8_t)... | Implicit conversion of plain char $@ to uint8_t. | test.cpp:185:7:185:10 | * ... | expression |
12-
| test.cpp:190:7:190:10 | (int8_t)... | Implicit conversion of plain char $@ to int8_t. | test.cpp:190:7:190:10 | * ... | expression |
13-
| test.cpp:204:6:204:7 | (unsigned char)... | Implicit conversion of plain char $@ to unsigned char. | test.cpp:204:6:204:7 | a3 | expression |
14-
| test.cpp:207:6:207:7 | (signed char)... | Implicit conversion of plain char $@ to signed char. | test.cpp:207:6:207:7 | a4 | expression |
15-
| test.cpp:217:7:217:8 | (uint8_t)... | Implicit conversion of plain char $@ to uint8_t. | test.cpp:217:7:217:8 | a7 | expression |
16-
| test.cpp:220:7:220:8 | (int8_t)... | Implicit conversion of plain char $@ to int8_t. | test.cpp:220:7:220:8 | a8 | expression |
17-
| test.cpp:234:3:234:4 | call to f7 | Implicit conversion of plain char $@ to unsigned char from instantiating template 'f7'. | test.cpp:49:56:49:56 | x | expression |
18-
| test.cpp:238:3:238:4 | call to f8 | Implicit conversion of plain char $@ to signed char from instantiating template 'f8'. | test.cpp:50:54:50:54 | x | expression |
19-
| test.cpp:251:3:251:5 | call to f15 | Implicit conversion of plain char $@ to uint8_t from instantiating template 'f15'. | test.cpp:55:56:55:56 | x | expression |
20-
| test.cpp:255:3:255:5 | call to f16 | Implicit conversion of plain char $@ to int8_t from instantiating template 'f16'. | test.cpp:56:55:56:55 | x | expression |
21-
| test.cpp:272:12:272:14 | definition of c11 | Implicit conversion of plain char $@ to unsigned char from instantiating template 'C9<T>'. | test.cpp:60:15:60:15 | y | expression |
22-
| test.cpp:277:13:277:15 | definition of c12 | Implicit conversion of plain char $@ to signed char from instantiating template 'C10<T>'. | test.cpp:68:16:68:16 | y | expression |
23-
| test.cpp:292:13:292:15 | definition of c15 | Implicit conversion of plain char $@ to uint8_t from instantiating template 'C13<T>'. | test.cpp:77:16:77:16 | y | expression |
24-
| test.cpp:296:13:296:15 | definition of c16 | Implicit conversion of plain char $@ to int8_t from instantiating template 'C14<T>'. | test.cpp:85:16:85:16 | y | expression |
1+
| test.cpp:98:7:98:8 | (unsigned char)... | Implicit conversion of plain char $@ to unsigned char. | test.cpp:98:7:98:8 | x3 | expression |
2+
| test.cpp:101:20:101:21 | (signed char)... | Implicit conversion of plain char $@ to signed char. | test.cpp:101:20:101:21 | x4 | expression |
3+
| test.cpp:111:21:111:22 | (uint8_t)... | Implicit conversion of plain char $@ to uint8_t. | test.cpp:111:21:111:22 | x7 | expression |
4+
| test.cpp:114:20:114:21 | (int8_t)... | Implicit conversion of plain char $@ to int8_t. | test.cpp:114:20:114:21 | x8 | expression |
5+
| test.cpp:124:17:124:18 | definition of c3 | Implicit conversion of plain char $@ to unsigned char from instantiating template 'C1<T, y>'. | test.cpp:5:12:5:12 | 120 | expression |
6+
| test.cpp:127:17:127:18 | definition of c4 | Implicit conversion of plain char $@ to signed char from instantiating template 'C2<T, y>'. | test.cpp:13:12:13:12 | 120 | expression |
7+
| test.cpp:137:15:137:16 | definition of c7 | Implicit conversion of plain char $@ to uint8_t from instantiating template 'C5<T, y>'. | test.cpp:22:12:22:12 | 1 | expression |
8+
| test.cpp:140:15:140:16 | definition of c8 | Implicit conversion of plain char $@ to int8_t from instantiating template 'C6<T, y>'. | test.cpp:30:12:30:12 | 1 | expression |
9+
| test.cpp:157:7:157:10 | (unsigned char)... | Implicit conversion of plain char $@ to unsigned char. | test.cpp:157:7:157:10 | * ... | expression |
10+
| test.cpp:162:7:162:10 | (signed char)... | Implicit conversion of plain char $@ to signed char. | test.cpp:162:7:162:10 | * ... | expression |
11+
| test.cpp:177:7:177:10 | (uint8_t)... | Implicit conversion of plain char $@ to uint8_t. | test.cpp:177:7:177:10 | * ... | expression |
12+
| test.cpp:182:7:182:10 | (int8_t)... | Implicit conversion of plain char $@ to int8_t. | test.cpp:182:7:182:10 | * ... | expression |
13+
| test.cpp:196:6:196:7 | (unsigned char)... | Implicit conversion of plain char $@ to unsigned char. | test.cpp:196:6:196:7 | a3 | expression |
14+
| test.cpp:199:6:199:7 | (signed char)... | Implicit conversion of plain char $@ to signed char. | test.cpp:199:6:199:7 | a4 | expression |
15+
| test.cpp:209:6:209:7 | (uint8_t)... | Implicit conversion of plain char $@ to uint8_t. | test.cpp:209:6:209:7 | a7 | expression |
16+
| test.cpp:212:7:212:8 | (int8_t)... | Implicit conversion of plain char $@ to int8_t. | test.cpp:212:7:212:8 | a8 | expression |
17+
| test.cpp:226:3:226:4 | call to f5 | Implicit conversion of plain char $@ to unsigned char from instantiating template 'f5'. | test.cpp:43:56:43:56 | x | expression |
18+
| test.cpp:230:3:230:4 | call to f6 | Implicit conversion of plain char $@ to signed char from instantiating template 'f6'. | test.cpp:44:54:44:54 | x | expression |
19+
| test.cpp:243:3:243:5 | call to f13 | Implicit conversion of plain char $@ to uint8_t from instantiating template 'f13'. | test.cpp:47:56:47:56 | x | expression |
20+
| test.cpp:247:3:247:5 | call to f14 | Implicit conversion of plain char $@ to int8_t from instantiating template 'f14'. | test.cpp:48:55:48:55 | x | expression |
21+
| test.cpp:264:12:264:14 | definition of c11 | Implicit conversion of plain char $@ to unsigned char from instantiating template 'C9<T>'. | test.cpp:52:15:52:15 | y | expression |
22+
| test.cpp:269:13:269:15 | definition of c12 | Implicit conversion of plain char $@ to signed char from instantiating template 'C10<T>'. | test.cpp:60:16:60:16 | y | expression |
23+
| test.cpp:284:13:284:15 | definition of c15 | Implicit conversion of plain char $@ to uint8_t from instantiating template 'C13<T>'. | test.cpp:69:16:69:16 | y | expression |
24+
| test.cpp:288:13:288:15 | definition of c16 | Implicit conversion of plain char $@ to int8_t from instantiating template 'C14<T>'. | test.cpp:77:16:77:16 | y | expression |

cpp/autosar/test/rules/M5-0-12/test.cpp

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,17 @@ template <typename T, T y> class C6 {
3535

3636
void f1(unsigned char x) {}
3737
void f2(signed char x) {}
38-
void f3(unsigned char x) {}
39-
void f4(signed char x) {}
4038

4139
/* Twin functions for std::uint8_t and std::int8_t */
4240
void f9(std::uint8_t x) {}
4341
void f10(std::int8_t x) {}
44-
void f11(std::uint8_t x) {}
45-
void f12(std::int8_t x) {}
4642

4743
template <typename T> void f5(T x) { unsigned char y = x; }
4844
template <typename T> void f6(T x) { signed char y = x; }
49-
template <typename T> void f7(T x) { unsigned char y = x; }
50-
template <typename T> void f8(T x) { signed char y = x; }
5145

5246
/* Twin template functions for std::uint8_t and std::int8_t */
5347
template <typename T> void f13(T x) { std::uint8_t y = x; }
5448
template <typename T> void f14(T x) { std::int8_t y = x; }
55-
template <typename T> void f15(T x) { std::uint8_t y = x; }
56-
template <typename T> void f16(T x) { std::int8_t y = x; }
5749

5850
template <typename T> class C9 {
5951
public:
@@ -201,10 +193,10 @@ int main() {
201193
f2(a2); // COMPLIANT: signed char arg passed to a signed char parameter
202194

203195
char a3 = 'a';
204-
f3(a3); // NON-COMPLIANT: plain char arg passed to a unsigned char parameter
196+
f1(a3); // NON-COMPLIANT: plain char arg passed to a unsigned char parameter
205197

206198
char a4 = 'a';
207-
f4(a4); // NON-COMPLIANT: plain char arg passed to a signed char parameter
199+
f2(a4); // NON-COMPLIANT: plain char arg passed to a signed char parameter
208200

209201
/* Twin cases with std::uint8_t and std::int8_t */
210202
std::uint8_t a5 = 1;
@@ -214,10 +206,10 @@ int main() {
214206
f10(a6); // COMPLIANT: std::int8_t arg passed to a std::int8_t parameter
215207

216208
char a7 = 'a';
217-
f11(a7); // NON-COMPLIANT: plain char arg passed to a std::uint8_t parameter
209+
f9(a7); // NON-COMPLIANT: plain char arg passed to a std::uint8_t parameter
218210

219211
char a8 = 'a';
220-
f12(a8); // NON-COMPLIANT: plain char arg passed to a std::int8_t parameter
212+
f10(a8); // NON-COMPLIANT: plain char arg passed to a std::int8_t parameter
221213

222214
/* ===== 2-2. Passing char argument to a char parameter through a template
223215
* ===== */
@@ -231,11 +223,11 @@ int main() {
231223
// through a template
232224

233225
char a11 = 'a';
234-
f7(a11); // NON-COMPLIANT: plain char arg passed to an unsigned char parameter
226+
f5(a11); // NON-COMPLIANT: plain char arg passed to an unsigned char parameter
235227
// through a template
236228

237229
char a12 = 'a';
238-
f8(a12); // NON-COMPLIANT: plain char arg passed to a signed char parameter
230+
f6(a12); // NON-COMPLIANT: plain char arg passed to a signed char parameter
239231
// through a template
240232

241233
/* Twin cases with std::uint8_t and std::int8_t */
@@ -248,11 +240,11 @@ int main() {
248240
// through a template
249241

250242
char a15 = 'a';
251-
f15(a15); // NON-COMPLIANT: plain char arg passed to a std::uint8_t parameter
243+
f13(a15); // NON-COMPLIANT: plain char arg passed to a std::uint8_t parameter
252244
// through a template
253245

254246
char a16 = 'a';
255-
f16(a16); // NON-COMPLIANT: plain char arg passed to a std::int8_t parameter
247+
f14(a16); // NON-COMPLIANT: plain char arg passed to a std::int8_t parameter
256248
// through a template
257249

258250
/* ========== 2-3. Passing a char argument to a char parameter through a

0 commit comments

Comments
 (0)