Skip to content

Commit cfc6de7

Browse files
committed
Minor edits of comments
1 parent c91e5c5 commit cfc6de7

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

cpp/misra/src/rules/RULE-10-2-3/UnscopedEnumWithoutFixedUnderlyingTypeUsed.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ predicate staticCastTargetIsUnscopedUnfixedEnumVariant(StaticCast cast) {
201201
exists(Enum e |
202202
e = cast.getType() and
203203
isUnscopedEnumWithoutFixedUnderlyingType(e) and
204-
// Exclude same-type casts (allowed by the "from" rule)
204+
/* Exclude cases where the assignment's target type is the same enum. */
205205
not cast.getExpr().getType() = e
206206
)
207207
}

cpp/misra/test/rules/RULE-10-2-3/test.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ void static_cast_from_fixed() {
268268
static_cast<Fixed>(f); // COMPLIANT: fixed underlying type
269269
static_cast<int>(f); // COMPLIANT: fixed underlying type
270270
static_cast<std::int8_t>(f); // COMPLIANT: fixed underlying type
271-
static_cast<Unfixed>(f); // NON_COMPLIANT: target is unfixed enum (TO rule)
271+
static_cast<Unfixed>(f); // NON_COMPLIANT: target is unfixed enum
272272
}
273273

274274
/* ========== 12. static_cast TO unfixed enum ========== */
@@ -291,12 +291,12 @@ void static_cast_to_fixed() {
291291
int i = 0;
292292
Unfixed u = U0;
293293

294-
// Fixed enum as target is compliant (for the TO rule)
294+
// Fixed enum as target is compliant
295295
static_cast<Fixed>(0); // COMPLIANT: fixed enum as target
296296
static_cast<Fixed>(i); // COMPLIANT: fixed enum as target
297297
static_cast<Fixed>(F0); // COMPLIANT: fixed enum as target
298298
static_cast<Fixed>(u); // NON_COMPLIANT: source is unfixed enum, target is
299-
// different type (FROM rule)
299+
// different type
300300
}
301301

302302
/* ========== 14. static_cast TO scoped enum ========== */
@@ -309,7 +309,7 @@ void static_cast_to_scoped() {
309309
static_cast<Scoped>(0); // COMPLIANT: scoped enum has fixed type
310310
static_cast<Scoped>(i); // COMPLIANT: scoped enum has fixed type
311311
static_cast<Scoped>(u); // NON_COMPLIANT: source is unfixed enum, target is
312-
// different type (FROM rule)
312+
// different type
313313
}
314314

315315
/* ========== 15. static_cast FROM scoped enum ========== */
@@ -321,7 +321,7 @@ void static_cast_from_scoped() {
321321
static_cast<int>(s); // COMPLIANT: scoped enum has fixed type
322322
static_cast<std::int8_t>(s); // COMPLIANT: scoped enum has fixed type
323323
static_cast<Scoped>(s); // COMPLIANT: same type, fixed
324-
static_cast<Unfixed>(s); // NON_COMPLIANT: target is unfixed enum (TO rule)
324+
static_cast<Unfixed>(s); // NON_COMPLIANT: target is unfixed enum
325325
}
326326

327327
/* ========== 16. Cross-enum relational operators ========== */

0 commit comments

Comments
 (0)