Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #12458 (checkers report: does not indicate misra checkers properly) #6302

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions addons/cppcheckdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -1651,6 +1651,14 @@ def is_suppressed(location, message, errorId):
return True
return False

def log_checker(message, addon):
if '--cli' in sys.argv:
msg = { 'addon': addon,
'severity': 'none',
'message': message,
'errorId': 'logChecker'}
sys.stdout.write(json.dumps(msg) + '\n')

def reportError(location, severity, message, addon, errorId, extra='', columnOverride=None):
if '--cli' in sys.argv:
msg = { 'file': location.file,
Expand Down
4 changes: 4 additions & 0 deletions addons/misra.py
Original file line number Diff line number Diff line change
Expand Up @@ -4489,6 +4489,10 @@ def executeCheck(self, rule_num, check_function, *args):
1901) # misra-c2012-19.1 : misra c++2008 2-13-3

if (not self.is_cpp) or rule_num in misra_cpp:
# log checker
errmsg = 'Misra C: %i.%i' % (rule_num // 100, rule_num % 100)
cppcheckdata.log_checker(errmsg, 'misra')

check_function(*args)

def parseDump(self, dumpfile, path_premium_addon=None):
Expand Down
4 changes: 2 additions & 2 deletions lib/checkbufferoverrun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ void CheckBufferOverrun::negativeIndexError(const Token* tok,

void CheckBufferOverrun::pointerArithmetic()
{
if (!mSettings->severity.isEnabled(Severity::portability))
if (!mSettings->severity.isEnabled(Severity::portability) && !mSettings->isPremiumEnabled("pointerOutOfBounds"))
return;

logChecker("CheckBufferOverrun::pointerArithmetic"); // portability
Expand Down Expand Up @@ -820,7 +820,7 @@ void CheckBufferOverrun::terminateStrncpyError(const Token *tok, const std::stri
void CheckBufferOverrun::argumentSize()
{
// Check '%type% x[10]' arguments
if (!mSettings->severity.isEnabled(Severity::warning))
if (!mSettings->severity.isEnabled(Severity::warning) && !mSettings->isPremiumEnabled("argumentSize"))
return;

logChecker("CheckBufferOverrun::argumentSize"); // warning
Expand Down
Loading
Loading