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

MISRA: only true/false allowed for bools #1876

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

AlexandreSato
Copy link
Contributor

0 -> false

@adeebshihadeh
Copy link
Contributor

adeebshihadeh commented Feb 18, 2024

I don't really want to merge this without cppcheck enforcing this. @0x41head do you think there's a way to make cppcheck check this somehow? I'd put up a new bounty for adding upstream support for that. Maybe we can directly check the token string?

@0x41head
Copy link
Contributor

Can I get some context ? What is this commit for ? Why is this commit a problem since false in stdbool is just #define false 0

@adeebshihadeh
Copy link
Contributor

We want bool tx = 0/1 to fail and bool tx = false/true to pass for readability, even if 0/1 are the underlying values.

@0x41head
Copy link
Contributor

I am not sure if we can push this upstream. But we can definitely make our own addon for this check. Should be easy as all addons work on a dump file generated by cppchecker, which is just an XML.

@adeebshihadeh
Copy link
Contributor

I'd prefer to upstream it, but that may be an option if the addon is small (<20 lines?)

@0x41head
Copy link
Contributor

addon would be pretty small. Probably something like the findcasts addon

@adeebshihadeh
Copy link
Contributor

That would be totally fine, but let's try to upstream it first.

@adeebshihadeh
Copy link
Contributor

Cool, let's do a $150 bounty for getting all of these fixed and checked with cppcheck, ideally inside cppcheck, but ok as an addon if they reject it

@adeebshihadeh adeebshihadeh changed the title MISRA safety_toyota.h MISRA: only true/false allowed for bools Dec 12, 2024
@adeebshihadeh adeebshihadeh marked this pull request as draft December 12, 2024 23:44
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