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 #12079: Misra: calling unknown function in condition => false pos… #5568

Merged
merged 1 commit into from
Oct 19, 2023

Conversation

swasti16
Copy link
Contributor

…itive 14.4, missing misra-config warning

addons/test/misra/misra-test.c Outdated Show resolved Hide resolved
addons/test/misra/misra-test.c Outdated Show resolved Hide resolved
@swasti16 swasti16 force-pushed the swasti/10279_14.4 branch 2 times, most recently from 7a8a33b to 774766d Compare October 18, 2023 11:33
addons/misra.py Outdated Show resolved Hide resolved
addons/misra.py Outdated Show resolved Hide resolved
addons/misra.py Outdated Show resolved Hide resolved
addons/misra.py Outdated Show resolved Hide resolved
addons/misra.py Outdated Show resolved Hide resolved
@swasti16 swasti16 force-pushed the swasti/10279_14.4 branch 4 times, most recently from af151d7 to 3c46935 Compare October 19, 2023 13:58
addons/cppcheckdata.py Outdated Show resolved Hide resolved
addons/misra.py Outdated Show resolved Hide resolved
addons/misra.py Outdated Show resolved Hide resolved
addons/misra.py Outdated Show resolved Hide resolved
addons/test/misra/misra-test.c Outdated Show resolved Hide resolved
addons/test/misra/misra-test.c Outdated Show resolved Hide resolved
Copy link
Owner

@danmar danmar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If CI pass I feel this can be merged.

@danmar danmar merged commit 04ece4f into danmar:main Oct 19, 2023
74 checks passed
@@ -3185,6 +3187,39 @@ def misra_17_3(self, cfg):
for w in cfg.clang_warnings:
if w['message'].endswith('[-Wimplicit-function-declaration]'):
self.reportError(cppcheckdata.Location(w), 17, 3)
for token in cfg.tokenlist:
if token.str not in ["while", "if"]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is misra-17.3 only checked inside if/while condition ?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was probably to avoid some false positives. But it's not a good heuristic.

We don't assume that cppcheck users provide the include paths for standard headers. And the misra.py addon does not load std.cfg file.

Copy link
Contributor

@dzid26 dzid26 Jun 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I noticed misra addon treated __typeof__ extension as a function and it was only reported when inside if( ) condition.

Loading Gnu.cfg library also was not helping as it misra addon also doesn't know typeof() .

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.

3 participants