Skip to content

Commit 069d174

Browse files
committed
Checker report: Update premium checkers info
1 parent 05d5710 commit 069d174

11 files changed

Lines changed: 177 additions & 37 deletions

lib/checkbool.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ void CheckBool::assignBoolToPointerError(const Token *tok)
341341
//-----------------------------------------------------------------------------
342342
void CheckBool::checkComparisonOfBoolExpressionWithInt()
343343
{
344-
if (!mSettings->severity.isEnabled(Severity::warning))
344+
if (!mSettings->severity.isEnabled(Severity::warning) && !mSettings->isPremiumEnabled("compareBoolExpressionWithInt"))
345345
return;
346346

347347
logChecker("CheckBool::checkComparisonOfBoolExpressionWithInt"); // warning

lib/checkclass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1714,7 +1714,7 @@ void CheckClass::operatorEqMissingReturnStatementError(const Token *tok, bool er
17141714

17151715
void CheckClass::operatorEqToSelf()
17161716
{
1717-
if (!mSettings->severity.isEnabled(Severity::warning))
1717+
if (!mSettings->severity.isEnabled(Severity::warning) && !mSettings->isPremiumEnabled("operatorEqToSelf"))
17181718
return;
17191719

17201720
logChecker("CheckClass::operatorEqToSelf"); // warning
@@ -2953,7 +2953,7 @@ void CheckClass::pureVirtualFunctionCallInConstructorError(
29532953

29542954
void CheckClass::checkDuplInheritedMembers()
29552955
{
2956-
if (!mSettings->severity.isEnabled(Severity::warning))
2956+
if (!mSettings->severity.isEnabled(Severity::warning) && !mSettings->isPremiumEnabled("duplInheritedMember"))
29572957
return;
29582958

29592959
logChecker("CheckClass::checkDuplInheritedMembers"); // warning

lib/checkcondition.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,9 @@ static bool isNonConstFunctionCall(const Token *ftok, const Library &library)
613613

614614
void CheckCondition::multiCondition2()
615615
{
616-
if (!mSettings->severity.isEnabled(Severity::warning))
616+
if (!mSettings->severity.isEnabled(Severity::warning) &&
617+
!mSettings->isPremiumEnabled("identicalConditionAfterEarlyExit") &&
618+
!mSettings->isPremiumEnabled("identicalInnerCondition"))
617619
return;
618620

619621
logChecker("CheckCondition::multiCondition2"); // warning
@@ -1482,7 +1484,8 @@ void CheckCondition::alwaysTrueFalse()
14821484
{
14831485
if (!mSettings->severity.isEnabled(Severity::style) &&
14841486
!mSettings->isPremiumEnabled("alwaysTrue") &&
1485-
!mSettings->isPremiumEnabled("alwaysFalse"))
1487+
!mSettings->isPremiumEnabled("alwaysFalse") &&
1488+
!mSettings->isPremiumEnabled("knownConditionTrueFalse"))
14861489
return;
14871490

14881491
logChecker("CheckCondition::alwaysTrueFalse"); // style

lib/checkers.cpp

Lines changed: 81 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,6 @@ namespace checkers {
230230
{"Autosar: A2-13-1",""},
231231
{"Autosar: A2-13-3",""},
232232
{"Autosar: A2-13-5",""},
233-
{"Autosar: A2-13-6",""},
234233
{"Autosar: A2-5-2",""},
235234
{"Autosar: A20-8-2","warning"},
236235
{"Autosar: A20-8-3","warning"},
@@ -578,55 +577,113 @@ namespace checkers {
578577
{"Misra C++ 2008: M9-6-2",""},
579578
{"Misra C++ 2008: M9-6-3",""},
580579
{"Misra C++ 2008: M9-6-4",""},
580+
{"Misra C++ 2023: 0.1.2",""},
581581
{"Misra C++ 2023: 0.2.1",""},
582+
{"Misra C++ 2023: 0.2.2",""},
583+
{"Misra C++ 2023: 0.2.3",""},
584+
{"Misra C++ 2023: 0.2.4",""},
582585
{"Misra C++ 2023: 10.0.1",""},
583586
{"Misra C++ 2023: 10.1.2",""},
584587
{"Misra C++ 2023: 10.2.1",""},
585588
{"Misra C++ 2023: 10.2.2",""},
586589
{"Misra C++ 2023: 10.2.3",""},
590+
{"Misra C++ 2023: 10.3.1",""},
587591
{"Misra C++ 2023: 10.4.1",""},
588592
{"Misra C++ 2023: 11.3.1",""},
593+
{"Misra C++ 2023: 11.3.2",""},
589594
{"Misra C++ 2023: 11.6.1",""},
590595
{"Misra C++ 2023: 11.6.3",""},
591596
{"Misra C++ 2023: 12.2.1",""},
597+
{"Misra C++ 2023: 12.2.2",""},
598+
{"Misra C++ 2023: 12.2.3",""},
599+
{"Misra C++ 2023: 12.3.1",""},
592600
{"Misra C++ 2023: 13.1.1",""},
601+
{"Misra C++ 2023: 13.1.2",""},
593602
{"Misra C++ 2023: 13.3.1",""},
594603
{"Misra C++ 2023: 13.3.2",""},
595604
{"Misra C++ 2023: 13.3.3",""},
596605
{"Misra C++ 2023: 13.3.4",""},
597606
{"Misra C++ 2023: 14.1.1",""},
598607
{"Misra C++ 2023: 15.0.1",""},
599608
{"Misra C++ 2023: 15.0.2",""},
609+
{"Misra C++ 2023: 15.1.2",""},
600610
{"Misra C++ 2023: 15.1.3",""},
601611
{"Misra C++ 2023: 15.1.5",""},
612+
{"Misra C++ 2023: 16.5.1",""},
613+
{"Misra C++ 2023: 16.5.2",""},
614+
{"Misra C++ 2023: 16.6.1",""},
602615
{"Misra C++ 2023: 17.8.1",""},
616+
{"Misra C++ 2023: 18.1.1",""},
617+
{"Misra C++ 2023: 18.1.2",""},
618+
{"Misra C++ 2023: 18.3.1",""},
619+
{"Misra C++ 2023: 18.3.2",""},
620+
{"Misra C++ 2023: 18.3.3",""},
603621
{"Misra C++ 2023: 18.4.1",""},
622+
{"Misra C++ 2023: 18.5.1",""},
604623
{"Misra C++ 2023: 18.5.2",""},
624+
{"Misra C++ 2023: 19.0.1",""},
625+
{"Misra C++ 2023: 19.0.2",""},
626+
{"Misra C++ 2023: 19.0.3",""},
627+
{"Misra C++ 2023: 19.0.4",""},
628+
{"Misra C++ 2023: 19.1.1",""},
629+
{"Misra C++ 2023: 19.1.2",""},
630+
{"Misra C++ 2023: 19.1.3",""},
631+
{"Misra C++ 2023: 19.2.1",""},
632+
{"Misra C++ 2023: 19.2.2",""},
633+
{"Misra C++ 2023: 19.2.3",""},
634+
{"Misra C++ 2023: 19.3.1",""},
605635
{"Misra C++ 2023: 19.3.2",""},
606636
{"Misra C++ 2023: 19.3.3",""},
607-
{"Misra C++ 2023: 21.20.1",""},
608-
{"Misra C++ 2023: 21.20.2",""},
637+
{"Misra C++ 2023: 19.3.4",""},
638+
{"Misra C++ 2023: 19.6.1",""},
639+
{"Misra C++ 2023: 21.10.1",""},
640+
{"Misra C++ 2023: 21.10.2",""},
641+
{"Misra C++ 2023: 21.10.3",""},
642+
{"Misra C++ 2023: 21.2.1",""},
643+
{"Misra C++ 2023: 21.2.2",""},
644+
{"Misra C++ 2023: 21.2.3",""},
645+
{"Misra C++ 2023: 21.2.4",""},
646+
{"Misra C++ 2023: 21.6.1",""},
647+
{"Misra C++ 2023: 21.6.2",""},
609648
{"Misra C++ 2023: 21.6.3",""},
610649
{"Misra C++ 2023: 21.6.4",""},
611650
{"Misra C++ 2023: 21.6.5",""},
612651
{"Misra C++ 2023: 22.3.1",""},
613652
{"Misra C++ 2023: 22.4.1",""},
653+
{"Misra C++ 2023: 23.11.1",""},
614654
{"Misra C++ 2023: 24.5.1",""},
615655
{"Misra C++ 2023: 24.5.2",""},
616656
{"Misra C++ 2023: 25.5.1",""},
617657
{"Misra C++ 2023: 25.5.2",""},
618658
{"Misra C++ 2023: 25.5.3",""},
659+
{"Misra C++ 2023: 26.3.1",""},
660+
{"Misra C++ 2023: 28.3.1",""},
619661
{"Misra C++ 2023: 28.6.1",""},
620662
{"Misra C++ 2023: 28.6.2",""},
663+
{"Misra C++ 2023: 30.0.1",""},
621664
{"Misra C++ 2023: 30.0.2",""},
622665
{"Misra C++ 2023: 4.1.1",""},
623666
{"Misra C++ 2023: 4.1.2",""},
667+
{"Misra C++ 2023: 5.0.1",""},
668+
{"Misra C++ 2023: 5.13.1",""},
624669
{"Misra C++ 2023: 5.13.2",""},
670+
{"Misra C++ 2023: 5.13.3",""},
671+
{"Misra C++ 2023: 5.13.4",""},
625672
{"Misra C++ 2023: 5.13.5",""},
626673
{"Misra C++ 2023: 5.13.6",""},
674+
{"Misra C++ 2023: 5.13.7",""},
675+
{"Misra C++ 2023: 5.7.1",""},
627676
{"Misra C++ 2023: 5.7.3",""},
677+
{"Misra C++ 2023: 6.0.1",""},
678+
{"Misra C++ 2023: 6.0.2",""},
679+
{"Misra C++ 2023: 6.0.3",""},
680+
{"Misra C++ 2023: 6.0.4",""},
681+
{"Misra C++ 2023: 6.2.2",""},
682+
{"Misra C++ 2023: 6.2.4",""},
628683
{"Misra C++ 2023: 6.4.2",""},
629684
{"Misra C++ 2023: 6.4.3",""},
685+
{"Misra C++ 2023: 6.5.1",""},
686+
{"Misra C++ 2023: 6.5.2",""},
630687
{"Misra C++ 2023: 6.7.1",""},
631688
{"Misra C++ 2023: 6.7.2",""},
632689
{"Misra C++ 2023: 6.8.3",""},
@@ -636,20 +693,41 @@ namespace checkers {
636693
{"Misra C++ 2023: 7.0.1",""},
637694
{"Misra C++ 2023: 7.0.2",""},
638695
{"Misra C++ 2023: 7.0.3",""},
696+
{"Misra C++ 2023: 7.0.4",""},
639697
{"Misra C++ 2023: 7.0.5",""},
640698
{"Misra C++ 2023: 7.0.6",""},
699+
{"Misra C++ 2023: 7.11.1",""},
700+
{"Misra C++ 2023: 7.11.2",""},
701+
{"Misra C++ 2023: 7.11.3",""},
702+
{"Misra C++ 2023: 8.0.1",""},
641703
{"Misra C++ 2023: 8.1.1",""},
704+
{"Misra C++ 2023: 8.1.2",""},
705+
{"Misra C++ 2023: 8.14.1",""},
706+
{"Misra C++ 2023: 8.18.2",""},
707+
{"Misra C++ 2023: 8.19.1",""},
708+
{"Misra C++ 2023: 8.2.1",""},
642709
{"Misra C++ 2023: 8.2.11",""},
643710
{"Misra C++ 2023: 8.2.2",""},
644711
{"Misra C++ 2023: 8.2.3",""},
645712
{"Misra C++ 2023: 8.2.4",""},
713+
{"Misra C++ 2023: 8.2.5",""},
714+
{"Misra C++ 2023: 8.2.6",""},
715+
{"Misra C++ 2023: 8.2.7",""},
646716
{"Misra C++ 2023: 8.2.8",""},
647717
{"Misra C++ 2023: 8.2.9",""},
718+
{"Misra C++ 2023: 8.20.1",""},
719+
{"Misra C++ 2023: 8.3.1",""},
648720
{"Misra C++ 2023: 8.3.2",""},
649721
{"Misra C++ 2023: 9.2.1",""},
722+
{"Misra C++ 2023: 9.3.1",""},
723+
{"Misra C++ 2023: 9.4.1",""},
724+
{"Misra C++ 2023: 9.4.2",""},
650725
{"Misra C++ 2023: 9.5.1",""},
651726
{"Misra C++ 2023: 9.5.2",""},
652727
{"Misra C++ 2023: 9.6.1",""},
728+
{"Misra C++ 2023: 9.6.2",""},
729+
{"Misra C++ 2023: 9.6.3",""},
730+
{"Misra C++ 2023: 9.6.4",""},
653731
{"Misra C: 1.4",""},
654732
{"Misra C: 1.5",""},
655733
{"Misra C: 10.1",""},

lib/checkio.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -411,9 +411,11 @@ void CheckIO::incompatibleFileOpenError(const Token *tok, const std::string &fil
411411
//---------------------------------------------------------------------------
412412
void CheckIO::invalidScanf()
413413
{
414-
if (!mSettings->severity.isEnabled(Severity::warning))
414+
if (!mSettings->severity.isEnabled(Severity::warning) && !mSettings->isPremiumEnabled("invalidscanf"))
415415
return;
416416

417+
logChecker("CheckIO::invalidScanf");
418+
417419
const SymbolDatabase * const symbolDatabase = mTokenizer->getSymbolDatabase();
418420
for (const Scope * scope : symbolDatabase->functionScopes) {
419421
for (const Token *tok = scope->bodyStart->next(); tok != scope->bodyEnd; tok = tok->next()) {
@@ -1710,7 +1712,7 @@ void CheckIO::wrongPrintfScanfArgumentsError(const Token* tok,
17101712
nonneg int numFunction)
17111713
{
17121714
const Severity severity = numFormat > numFunction ? Severity::error : Severity::warning;
1713-
if (severity != Severity::error && !mSettings->severity.isEnabled(Severity::warning))
1715+
if (severity != Severity::error && !mSettings->severity.isEnabled(Severity::warning) && !mSettings->isPremiumEnabled("wrongPrintfScanfArgNum"))
17141716
return;
17151717

17161718
std::ostringstream errmsg;
@@ -1729,7 +1731,7 @@ void CheckIO::wrongPrintfScanfArgumentsError(const Token* tok,
17291731
void CheckIO::wrongPrintfScanfPosixParameterPositionError(const Token* tok, const std::string& functionName,
17301732
nonneg int index, nonneg int numFunction)
17311733
{
1732-
if (!mSettings->severity.isEnabled(Severity::warning))
1734+
if (!mSettings->severity.isEnabled(Severity::warning) && !mSettings->isPremiumEnabled("wrongPrintfScanfParameterPositionError"))
17331735
return;
17341736
std::ostringstream errmsg;
17351737
errmsg << functionName << ": ";
@@ -1992,7 +1994,7 @@ void CheckIO::argumentType(std::ostream& os, const ArgumentInfo * argInfo)
19921994

19931995
void CheckIO::invalidLengthModifierError(const Token* tok, nonneg int numFormat, const std::string& modifier)
19941996
{
1995-
if (!mSettings->severity.isEnabled(Severity::warning))
1997+
if (!mSettings->severity.isEnabled(Severity::warning) && !mSettings->isPremiumEnabled("invalidLengthModifierError"))
19961998
return;
19971999
std::ostringstream errmsg;
19982000
errmsg << "'" << modifier << "' in format string (no. " << numFormat << ") is a length modifier and cannot be used without a conversion specifier.";

lib/checkmemoryleak.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1093,9 +1093,14 @@ void CheckMemoryLeakNoVar::checkForUnusedReturnValue(const Scope *scope)
10931093
void CheckMemoryLeakNoVar::checkForUnsafeArgAlloc(const Scope *scope)
10941094
{
10951095
// This test only applies to C++ source
1096-
if (!mTokenizer->isCPP() || !mSettings->certainty.isEnabled(Certainty::inconclusive) || !mSettings->severity.isEnabled(Severity::warning))
1096+
if (!mTokenizer->isCPP())
10971097
return;
10981098

1099+
if (!mSettings->isPremiumEnabled("leakUnsafeArgAlloc") && (!mSettings->certainty.isEnabled(Certainty::inconclusive) || !mSettings->severity.isEnabled(Severity::warning)))
1100+
return;
1101+
1102+
logChecker("CheckMemoryLeakNoVar::checkForUnsafeArgAlloc");
1103+
10991104
for (const Token *tok = scope->bodyStart; tok != scope->bodyEnd; tok = tok->next()) {
11001105
if (Token::Match(tok, "%name% (")) {
11011106
const Token *endParamToken = tok->next()->link();

lib/checknullpointer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ void CheckNullPointer::nullPointerError(const Token *tok, const std::string &var
441441
return;
442442
}
443443

444-
if (!mSettings->isEnabled(value, inconclusive))
444+
if (!mSettings->isEnabled(value, inconclusive) && !mSettings->isPremiumEnabled("nullPointer"))
445445
return;
446446

447447
const ErrorPath errorPath = getErrorPath(tok, value, "Null pointer dereference");

lib/checkother.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,9 @@ void CheckOther::invalidPointerCastError(const Token* tok, const std::string& fr
424424

425425
void CheckOther::checkRedundantAssignment()
426426
{
427-
if (!mSettings->severity.isEnabled(Severity::style) && !mSettings->isPremiumEnabled("redundantAssignment"))
427+
if (!mSettings->severity.isEnabled(Severity::style) &&
428+
!mSettings->isPremiumEnabled("redundantAssignment") &&
429+
!mSettings->isPremiumEnabled("redundantAssignInSwitch"))
428430
return;
429431

430432
logChecker("CheckOther::checkRedundantAssignment"); // style
@@ -773,7 +775,7 @@ void CheckOther::checkUnreachableCode()
773775
// misra-c-2023-2.1
774776
// misra-cpp-2008-0-1-1
775777
// autosar
776-
if (!mSettings->severity.isEnabled(Severity::style) && !mSettings->isPremiumEnabled("unreachableCode"))
778+
if (!mSettings->severity.isEnabled(Severity::style) && !mSettings->isPremiumEnabled("duplicateBreak") && !mSettings->isPremiumEnabled("unreachableCode"))
777779
return;
778780

779781
logChecker("CheckOther::checkUnreachableCode"); // style
@@ -1326,9 +1328,11 @@ static bool isVariableMutableInInitializer(const Token* start, const Token * end
13261328

13271329
void CheckOther::checkConstVariable()
13281330
{
1329-
if (!mSettings->severity.isEnabled(Severity::style) || mTokenizer->isC())
1331+
if ((!mSettings->severity.isEnabled(Severity::style) || mTokenizer->isC()) && !mSettings->isPremiumEnabled("constVariable"))
13301332
return;
13311333

1334+
logChecker("CheckOther::checkConstVariable"); // style,c++
1335+
13321336
const SymbolDatabase *const symbolDatabase = mTokenizer->getSymbolDatabase();
13331337

13341338
for (const Variable *var : symbolDatabase->variableList()) {
@@ -1476,6 +1480,7 @@ void CheckOther::checkConstPointer()
14761480
{
14771481
if (!mSettings->severity.isEnabled(Severity::style) &&
14781482
!mSettings->isPremiumEnabled("constParameter") &&
1483+
!mSettings->isPremiumEnabled("constParameterReference") &&
14791484
!mSettings->isPremiumEnabled("constPointer"))
14801485
return;
14811486

@@ -3344,7 +3349,9 @@ void CheckOther::unknownEvaluationOrder(const Token* tok)
33443349

33453350
void CheckOther::checkAccessOfMovedVariable()
33463351
{
3347-
if (!mTokenizer->isCPP() || mSettings->standards.cpp < Standards::CPP11 || !mSettings->severity.isEnabled(Severity::warning))
3352+
if (!mTokenizer->isCPP() || mSettings->standards.cpp < Standards::CPP11)
3353+
return;
3354+
if (!mSettings->isPremiumEnabled("accessMoved") && !mSettings->severity.isEnabled(Severity::warning))
33483355
return;
33493356
logChecker("CheckOther::checkAccessOfMovedVariable"); // c++11,warning
33503357
const bool reportInconclusive = mSettings->certainty.isEnabled(Certainty::inconclusive);

lib/checksizeof.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ void CheckSizeof::sizeofCalculationError(const Token *tok, bool inconclusive)
358358

359359
void CheckSizeof::sizeofFunction()
360360
{
361-
if (!mSettings->severity.isEnabled(Severity::warning))
361+
if (!mSettings->severity.isEnabled(Severity::warning) && !mSettings->isPremiumEnabled("sizeofFunctionCall"))
362362
return;
363363

364364
logChecker("CheckSizeof::sizeofFunction"); // warning

lib/checkunusedvar.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1445,7 +1445,7 @@ void CheckUnusedVar::unassignedVariableError(const Token *tok, const std::string
14451445
//---------------------------------------------------------------------------
14461446
void CheckUnusedVar::checkStructMemberUsage()
14471447
{
1448-
if (!mSettings->severity.isEnabled(Severity::style) && !mSettings->isPremiumEnabled("unusedVariable"))
1448+
if (!mSettings->severity.isEnabled(Severity::style) && !mSettings->isPremiumEnabled("unusedStructMember") && !mSettings->isPremiumEnabled("unusedVariable"))
14491449
return;
14501450

14511451
logChecker("CheckUnusedVar::checkStructMemberUsage"); // style

0 commit comments

Comments
 (0)