Skip to content

Fix #12079: Misra: calling unknown function in condition => false pos…#5568

Merged
danmar merged 1 commit intocppcheck-opensource:mainfrom
swasti16:swasti/10279_14.4
Oct 19, 2023
Merged

Fix #12079: Misra: calling unknown function in condition => false pos…#5568
danmar merged 1 commit intocppcheck-opensource:mainfrom
swasti16:swasti/10279_14.4

Conversation

@swasti16
Copy link
Copy Markdown
Contributor

…itive 14.4, missing misra-config warning

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

@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 cppcheck-opensource:main Oct 19, 2023
Comment thread addons/misra.py
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
Copy Markdown
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
Copy Markdown
Collaborator

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
Copy Markdown
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