Skip to content

fix: improve misra.py for missing prototype false positives - #8805

Open
jfdeverge wants to merge 1 commit into
cppcheck-opensource:mainfrom
jfdeverge:dev/fix_misra_8_4_and_17_3
Open

fix: improve misra.py for missing prototype false positives#8805
jfdeverge wants to merge 1 commit into
cppcheck-opensource:mainfrom
jfdeverge:dev/fix_misra_8_4_and_17_3

Conversation

@jfdeverge

Copy link
Copy Markdown

The MISRA addon reported false positives for Rules 8.4 and 17.3 in cases involving valid prototypes and function-pointer calls. We identified these issues by comparing its results with reports previously generated by our company’s internal tool on the same software.

The fix improves prototype and function-call detection in addons/misra.py and adds a regression test covering both cases.

@jfdeverge

jfdeverge commented Aug 21, 2026

Copy link
Copy Markdown
Author

The bug report would have looked like below, but I don't have access to "issues" panel.

MISRA addon reports false positives for Rules 8.4 and 17.3

Description

The MISRA addon reports false positives for Rules 8.4 and 17.3 when valid function prototypes or function-pointer calls are present. The issue was identified by comparing cppcheck results with reports generated by our company's internal tool on the same software.

Reproduction

int regression_function(int value);

int regression_function(int value)
{
    return value;
}

int main(void)
{
    int local_prototype(int value);
    int (*callback)(int) = regression_function;

    return callback(0);
}

Run the MISRA addon on this file with Rules 8.4 and 17.3 enabled:

cppcheck --enable=all --addon=addons/misra.py \
  addons/test/misra/misra-regression-prototypes.c

Expected result

No Rule 8.4 or Rule 17.3 violation is reported.

Actual result

The addon reports violations for valid prototype and function-pointer constructs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant