Skip to content

Fix #13647: Misra C 21.6: Location should point at function call instead of #include#7355

Merged
danmar merged 1 commit intocppcheck-opensource:mainfrom
swasti16:swasti/13647_21.6
Mar 11, 2025
Merged

Fix #13647: Misra C 21.6: Location should point at function call instead of #include#7355
danmar merged 1 commit intocppcheck-opensource:mainfrom
swasti16:swasti/13647_21.6

Conversation

@swasti16
Copy link
Copy Markdown
Contributor

@swasti16 swasti16 commented Mar 5, 2025

No description provided.

@wienans
Copy link
Copy Markdown
Contributor

wienans commented Mar 5, 2025

I would suggest to make it dependent on C standard.

this PR will fix many missing Identifieres and add the new once from C11.
#7325

Therefore C standard dependence would be a good thing.

there is already a Funktion isStdLibId, but that would check if the token.str is within any of the library header files.

@swasti16 swasti16 force-pushed the swasti/13647_21.6 branch 2 times, most recently from 18123e6 to 3638fd9 Compare March 8, 2025 17:02
Comment thread addons/misra.py Outdated
Comment thread addons/misra.py Outdated
@swasti16 swasti16 force-pushed the swasti/13647_21.6 branch 3 times, most recently from cb9c0bb to b643467 Compare March 9, 2025 09:33
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.

refactor lookup please

Comment thread addons/misra.py Outdated
continue
standard_id = getStdLib(data.standards.c)
funcname = token.previous.str
if "stdio.h" in standard_id.keys() and funcname in standard_id["stdio.h"]:
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.

I'd suggest:

Suggested change
if "stdio.h" in standard_id.keys() and funcname in standard_id["stdio.h"]:
if funcname in standard_id.get("stdio.h", []):

@swasti16 swasti16 force-pushed the swasti/13647_21.6 branch from b643467 to 15e5015 Compare March 10, 2025 08:00
@danmar danmar merged commit 66880df into cppcheck-opensource:main Mar 11, 2025
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