Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5d0bfee

Browse files
committed
A7-1-2: Remove function constexpr test cases
1 parentf0e3c45 commit5d0bfee

File tree

2 files changed

+12
-143
lines changed

2 files changed

+12
-143
lines changed

‎cpp/autosar/test/rules/A7-1-2/VariableMissingConstexpr.expected‎

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,15 @@
1010
| test.cpp:55:7:55:8 | m2 | Variable 'm2' could be marked 'constexpr' and static. |
1111
| test.cpp:65:7:65:8 | x2 | Variable 'x2' could be marked 'constexpr'. |
1212
| test.cpp:66:13:66:14 | x3 | Variable 'x3' could be marked 'constexpr'. |
13-
| test.cpp:130:7:130:8 | m1 | Variable 'm1' could be marked 'constexpr' and static. |
14-
| test.cpp:141:7:141:8 | m1 | Variable 'm1' could be marked 'constexpr' and static. |
15-
| test.cpp:221:7:221:8 | l1 | Variable 'l1' could be marked 'constexpr'. |
16-
| test.cpp:235:7:235:8 | l6 | Variable 'l6' could be marked 'constexpr'. |
17-
| test.cpp:237:7:237:8 | l8 | Variable 'l8' could be marked 'constexpr'. |
18-
| test.cpp:240:7:240:9 | l10 | Variable 'l10' could be marked 'constexpr'. |
19-
| test.cpp:243:7:243:9 | l12 | Variable 'l12' could be marked 'constexpr'. |
20-
| test.cpp:248:7:248:9 | l15 | Variable 'l15' could be marked 'constexpr'. |
21-
| test.cpp:250:7:250:9 | l16 | Variable 'l16' could be marked 'constexpr'. |
22-
| test.cpp:251:7:251:9 | l17 | Variable 'l17' could be marked 'constexpr'. |
23-
| test.cpp:257:7:257:9 | l21 | Variable 'l21' could be marked 'constexpr'. |
24-
| test.cpp:262:7:262:9 | l24 | Variable 'l24' could be marked 'constexpr'. |
25-
| test.cpp:263:7:263:9 | l25 | Variable 'l25' could be marked 'constexpr'. |
13+
| test.cpp:76:7:76:8 | m1 | Variable 'm1' could be marked 'constexpr' and static. |
14+
| test.cpp:91:7:91:8 | l1 | Variable 'l1' could be marked 'constexpr'. |
15+
| test.cpp:105:7:105:8 | l6 | Variable 'l6' could be marked 'constexpr'. |
16+
| test.cpp:107:7:107:8 | l8 | Variable 'l8' could be marked 'constexpr'. |
17+
| test.cpp:110:7:110:9 | l10 | Variable 'l10' could be marked 'constexpr'. |
18+
| test.cpp:113:7:113:9 | l12 | Variable 'l12' could be marked 'constexpr'. |
19+
| test.cpp:118:7:118:9 | l15 | Variable 'l15' could be marked 'constexpr'. |
20+
| test.cpp:120:7:120:9 | l16 | Variable 'l16' could be marked 'constexpr'. |
21+
| test.cpp:121:7:121:9 | l17 | Variable 'l17' could be marked 'constexpr'. |
22+
| test.cpp:127:7:127:9 | l21 | Variable 'l21' could be marked 'constexpr'. |
23+
| test.cpp:132:7:132:9 | l24 | Variable 'l24' could be marked 'constexpr'. |
24+
| test.cpp:133:7:133:9 | l25 | Variable 'l25' could be marked 'constexpr'. |

‎cpp/autosar/test/rules/A7-1-2/test.cpp‎

Lines changed: 0 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -67,60 +67,6 @@ int h2() {
6767
constexprint x4 =h1_const(1,1);// COMPLIANT
6868
}
6969

70-
inth3(int x) {// COMPLIANT - uses goto, so can't be constexpr
71-
if (x) {
72-
goto l1;
73-
}else {
74-
return10;
75-
}
76-
l1:
77-
return1;
78-
}
79-
80-
inth4(int x) {// COMPLIANT - uses try, so can't be constexpr
81-
try {
82-
return1;
83-
}catch (...) {
84-
}
85-
}
86-
87-
inth5(int x) {// COMPLIANT - declares non literal local var
88-
NonLiteralClass nlc;
89-
}
90-
91-
inth6(int x) {// COMPLIANT - declares static variable
92-
staticint i = x;
93-
return x;
94-
}
95-
96-
inth7(int x) {// COMPLIANT - declares no init variable
97-
int i;
98-
}
99-
100-
inth8(int x) {// NON_COMPLIANT - could be constexpr
101-
int i = x;
102-
return i;
103-
}
104-
105-
constexprinth8_correct(int x) {// COMPLIANT
106-
int i = x;
107-
return i;
108-
}
109-
110-
inth9(int x) {// COMPLIANT - declares thread local variable
111-
thread_localint i = x;
112-
return x;
113-
}
114-
115-
classConstexprFunctionClass {
116-
public:
117-
intmf1(int x) {return m1 + x; }// NON_COMPLIANT
118-
constexprintmf1_correct(int x) {return m1 + x; }// COMPLIANT
119-
120-
private:
121-
int m1;
122-
};
123-
12470
classMissingConstexprClass {
12571
public:
12672
MissingConstexprClass() =default;// NON_COMPLIANT
@@ -130,82 +76,6 @@ class MissingConstexprClass {
13076
int m1 =0;// NON_COMPLIANT
13177
};
13278

133-
classVirtualBaseClass {};
134-
135-
classDerivedClass :publicvirtual VirtualBaseClass {
136-
public:
137-
DerivedClass() =default;// COMPLIANT
138-
DerivedClass(int i) =delete;// COMPLIANT
139-
DerivedClass(int i, LiteralClass lc) {}// COMPLIANT
140-
private:
141-
int m1 =0;// NON_COMPLIANT
142-
};
143-
144-
classNotAllMembersInitializedClass {
145-
public:
146-
NotAllMembersInitializedClass() =default;// COMPLIANT
147-
NotAllMembersInitializedClass(int i) =delete;// COMPLIANT
148-
NotAllMembersInitializedClass(int i, LiteralClass lc) {}// COMPLIANT
149-
private:
150-
int m1;
151-
};
152-
153-
classNonLiteralParamsClass {
154-
public:
155-
NonLiteralParamsClass(int i, NonLiteralClass lc) {}// COMPLIANT
156-
};
157-
158-
// Variant members are always initialized, so this can be marked constexpr
159-
classVariantMemberInitialized {
160-
public:
161-
VariantMemberInitialized() =default;// NON_COMPLIANT
162-
VariantMemberInitialized(int i) =delete;// NON_COMPLIANT
163-
VariantMemberInitialized(int i, LiteralClass lc) {}// NON_COMPLIANT
164-
private:
165-
union {
166-
int i =0;
167-
short s;
168-
};
169-
};
170-
171-
classVariantMemberInitConstexpr {
172-
public:
173-
constexprVariantMemberInitConstexpr() = default;// COMPLIANT
174-
constexprVariantMemberInitConstexpr(int i) = delete;// COMPLIANT
175-
constexprVariantMemberInitConstexpr(int i, LiteralClass lc) {}// COMPLIANT
176-
private:
177-
union {
178-
int i =0;
179-
short s;
180-
};
181-
};
182-
183-
// Variant members are not initialized at declaration, so we can only mark the
184-
// constructors as constexpr if we explicitly initialize the variant member
185-
classVariantMemberNotInit {
186-
public:
187-
VariantMemberNotInit() =default;// COMPLIANT
188-
VariantMemberNotInit(int pi) =delete;// COMPLIANT
189-
VariantMemberNotInit(int pi, LiteralClass lc) {}// COMPLIANT
190-
VariantMemberNotInit(LiteralClass lc,int pi) : i(pi) {}// NON_COMPLIANT
191-
constexprVariantMemberNotInit(LiteralClass lc,short pi)// COMPLIANT
192-
: i(pi) {}
193-
194-
private:
195-
union {
196-
int i;
197-
short s;
198-
};
199-
};
200-
201-
classExcludedCases {
202-
public:
203-
~ExcludedCases() {}// COMPLIANT
204-
205-
voidoperator=(ExcludedCases &) {}// COMPLIANT
206-
voidoperator=(ExcludedCases &&) {}// COMPLIANT
207-
};
208-
20979
externintrandom();
21080
constexprintadd(int x,int y) {return x + y; }
21181
// Example with compile time constant literal value as default argument

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp