-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Conversation
7a8a33b
to
774766d
Compare
af151d7
to
3c46935
Compare
3c46935
to
f454d92
Compare
…itive 14.4, missing misra-config warning
f454d92
to
1e721c2
Compare
There was a problem hiding this 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.
@@ -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"]: |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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()
.
…itive 14.4, missing misra-config warning