From e3c93f46c06da82f1957afb8ecf02f1190ff8142 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Mon, 19 Aug 2024 22:30:08 +0200 Subject: [PATCH 1/2] Fix #13030 (Checkers report: Misra C 8.13 is not executed unless --enable=style is used) --- lib/checkother.cpp | 1 + lib/settings.cpp | 31 ++++++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 01388c53c93..868a9621976 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -1609,6 +1609,7 @@ void CheckOther::checkConstPointer() { if (!mSettings->severity.isEnabled(Severity::style) && !mSettings->isPremiumEnabled("constParameter") && + !mSettings->isPremiumEnabled("constParameterPointer") && !mSettings->isPremiumEnabled("constParameterReference") && !mSettings->isPremiumEnabled("constPointer")) return; diff --git a/lib/settings.cpp b/lib/settings.cpp index 63d7d08f9bd..5041cfde1cc 100644 --- a/lib/settings.cpp +++ b/lib/settings.cpp @@ -316,7 +316,36 @@ void Settings::setCheckLevel(CheckLevel level) } } -// TODO: auto generate these tables +// These tables are auto generated from Cppcheck Premium script + +static const std::set cweCheckers{ + "StlMissingComparison", + "assignBoolToPointer", + "autovarInvalidDeallocation", + "deallocuse", + "derefInvalidIterator", + "doubleFree", + "funcArgOrderDifferent", + "globalLockGuard", + "ignoredReturnValue", + "invalidTestForOverflow", + "invalidscanf", + "leakNoVarFunctionCall", + "leakReturnValNotUsed", + "localMutex", + "multiCondition", + "raceAfterInterlockedDecrement", + "resourceLeak", + "rethrowNoCurrentException", + "signConversion", + "signedCharArrayIndex", + "stlIfStrFind", + "unhandledExceptionSpecification", + "unknownEvaluationOrder", + "useClosedFile", + "varFuncNullUB", + "virtualDestructor" +}; static const std::set autosarCheckers{ "accessMoved", From 9348a21c74f0dd8e0fd48dad784b4d71ffad5336 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 20 Aug 2024 10:37:37 +0200 Subject: [PATCH 2/2] fix --- lib/settings.cpp | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/lib/settings.cpp b/lib/settings.cpp index 5041cfde1cc..55b4d91fff0 100644 --- a/lib/settings.cpp +++ b/lib/settings.cpp @@ -318,35 +318,6 @@ void Settings::setCheckLevel(CheckLevel level) // These tables are auto generated from Cppcheck Premium script -static const std::set cweCheckers{ - "StlMissingComparison", - "assignBoolToPointer", - "autovarInvalidDeallocation", - "deallocuse", - "derefInvalidIterator", - "doubleFree", - "funcArgOrderDifferent", - "globalLockGuard", - "ignoredReturnValue", - "invalidTestForOverflow", - "invalidscanf", - "leakNoVarFunctionCall", - "leakReturnValNotUsed", - "localMutex", - "multiCondition", - "raceAfterInterlockedDecrement", - "resourceLeak", - "rethrowNoCurrentException", - "signConversion", - "signedCharArrayIndex", - "stlIfStrFind", - "unhandledExceptionSpecification", - "unknownEvaluationOrder", - "useClosedFile", - "varFuncNullUB", - "virtualDestructor" -}; - static const std::set autosarCheckers{ "accessMoved", "argumentSize",