Fix #14628: MISRA: avoid false positives for true/false after #14607#8388
Open
varshneydevansh wants to merge 2 commits intodanmar:mainfrom
Open
Fix #14628: MISRA: avoid false positives for true/false after #14607#8388varshneydevansh wants to merge 2 commits intodanmar:mainfrom
varshneydevansh wants to merge 2 commits intodanmar:mainfrom
Conversation
f772d27 to
a7340d1
Compare
|
This was referenced Mar 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



This #14628 is a follow-up to #14607.
After #14607, MISRA rule
10.3report false positives for assignments written withtrue/falsein C99 and later.The issue is that in C,
<stdbool.h>often expands:true->1false->0So checking only the processed RHS token text is not enough to distinguish:
true/false0/1This change uses the RHS token macro origin (
macroName) to preserve that distinction.Behavior after this change:
true/false: allowed0/1:c8910.3inc99/c11/c17/c18/c23Changes:
addons/misra.pyrule10.3to distinguish boolean macro spelling from integer literalstrue/falseinitialization and assignment casesDownstream reproduction:
CPPCHECK_DIR=/Users/devanshvarshney/cppcheckbool <- true/falsedisappeared10.3reports are actual source0/1assignmentsRelated Context: