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 #12413 ( False positive on Misra 10.3 for bools ) #5948

Merged
merged 3 commits into from
Feb 6, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions addons/misra.py
Original file line number Diff line number Diff line change
Expand Up @@ -2291,10 +2291,9 @@ def get_category(essential_type):
rhs_category = get_category(rhs)
if lhs_category and rhs_category and lhs_category != rhs_category and rhs_category not in ('signed','unsigned'):
self.reportError(tok, 10, 3)
if bitsOfEssentialType(lhs) < bitsOfEssentialType(rhs):
if bitsOfEssentialType(lhs) < bitsOfEssentialType(rhs) and (lhs != "bool" or tok.astOperand2.str not in ('0','1')):
self.reportError(tok, 10, 3)


def misra_10_4(self, data):
op = {'+', '-', '*', '/', '%', '&', '|', '^', '+=', '-=', ':'}
for token in data.tokenlist:
Expand Down
Loading