Skip to content

cppcheck: replace bool 0 assignment with false#3444

Merged
adeebshihadeh merged 1 commit into
commaai:masterfrom
varshneydevansh:new_zero_one
Jun 9, 2026
Merged

cppcheck: replace bool 0 assignment with false#3444
adeebshihadeh merged 1 commit into
commaai:masterfrom
varshneydevansh:new_zero_one

Conversation

@varshneydevansh

Copy link
Copy Markdown
Contributor

This PR is related to the cleanup requested in commaai/panda#2105,
where the original ask is to replace bool assignments that use
integer 0/1 with false/true.

After updating panda to use cppcheck 2.21.0 and re-running the
MISRA/static-analysis path locally, the remaining cppcheck rule 10.3
finding from opendbc is in Toyota safety:

  • tx = 0;

Since tx is a bool, this change replaces that assignment with:

  • tx = false;

Validation:

What cppcheck report through panda before the opendbc fix:

 Devanshs-MacBook-Pro    \panda  ➜ (  new_zero_one)   30ms   1:26 AM   
 ⚡devanshvarshney ❯❯ SKIP_BUILD=1 SKIP_TABLES_DIFF=1 tests/misra/test_misra.sh 2>&1 | rg "misra-c2012-10.3"

/Users/devanshvarshney/panda/.venv/lib/python3.12/site-packages/opendbc/safety/modes/toyota.h:334:10: style: misra violation (use --rule-texts=<file> to get proper output) [misra-c2012-10.3]
/Users/devanshvarshney/panda/board/drivers/can_common.h:41:12: style: misra violation (use --rule-texts=<file> to get proper output) [misra-c2012-10.3]
/Users/devanshvarshney/panda/board/drivers/can_common.h:51:9: style: misra violation (use --rule-texts=<file> to get proper output) [misra-c2012-10.3]

After the fix:

 Devanshs-MacBook-Pro    \panda  ➜ (  new_zero_one)   60ms   1:48 AM   
 ⚡devanshvarshney ❯❯ SKIP_BUILD=1 SKIP_TABLES_DIFF=1 tests/misra/test_misra.sh 2>&1 | rg "misra-c2012-10.3"

# no output

Where this was found:

Related:

@github-actions github-actions Bot added the car safety vehicle-specific safety code label Jun 7, 2026
@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Car behavior report

Replays driving segments through this PR and compares the behavior to master.
Please review any changes carefully to ensure they are expected.

Testing 190 segments for: TOYOTA_ALPHARD_TSS2, TOYOTA_AVALON, TOYOTA_AVALON_2019, TOYOTA_AVALON_TSS2, TOYOTA_CAMRY, TOYOTA_CAMRY_TSS2, TOYOTA_CHR, TOYOTA_CHR_TSS2, TOYOTA_COROLLA, TOYOTA_COROLLA_TSS2, TOYOTA_HIGHLANDER, TOYOTA_HIGHLANDER_TSS2, TOYOTA_PRIUS, TOYOTA_PRIUS_V, TOYOTA_PRIUS_TSS2, TOYOTA_RAV4, TOYOTA_RAV4H, TOYOTA_RAV4_TSS2, TOYOTA_RAV4_TSS2_2022, TOYOTA_RAV4_TSS2_2023, TOYOTA_RAV4_PRIME, TOYOTA_YARIS, TOYOTA_MIRAI, TOYOTA_SIENNA, TOYOTA_SIENNA_4TH_GEN

✅ 0 changed, 190 passed, 0 errors

@adeebshihadeh adeebshihadeh merged commit ccfda5f into commaai:master Jun 9, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

car safety vehicle-specific safety code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants