fix: improve misra.py for missing prototype false positives - #8805
Open
jfdeverge wants to merge 1 commit into
Open
fix: improve misra.py for missing prototype false positives#8805jfdeverge wants to merge 1 commit into
jfdeverge wants to merge 1 commit into
Conversation
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.3DescriptionThe 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. Reproductionint 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.cExpected resultNo Rule 8.4 or Rule 17.3 violation is reported. Actual resultThe addon reports violations for valid prototype and function-pointer constructs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.