Skip to content

checkcondition.cpp: fixed -Wbitwise-instead-of-logical Clang warnings#7736

Merged
chrchr-github merged 1 commit intodanmar:mainfrom
firewave:diag-bitwise
Aug 18, 2025
Merged

checkcondition.cpp: fixed -Wbitwise-instead-of-logical Clang warnings#7736
chrchr-github merged 1 commit intodanmar:mainfrom
firewave:diag-bitwise

Conversation

@firewave
Copy link
Copy Markdown
Collaborator

these are shown with a make build using Clang

Comment thread lib/checkcondition.cpp Outdated

bool CheckCondition::diag(const Token* tok1, const Token* tok2)
{
bool b = diag(tok1);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe spell out the logic in a comment? We always mark both tokens as diagnosed.
Could also use two variables: return b1 && b2;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe spell out the logic in a comment?

I never understood the logic. Care to provide a comment to add?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

diag(tok) marks a token as diagnosed and returns true if it was already marked. diag(tok1, tok2) therefore needs to mark both tokens. // mark both tokens would probably be enough.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

these are shown with a make build using Clang
@sonarqubecloud
Copy link
Copy Markdown

@chrchr-github chrchr-github merged commit 9dd0555 into danmar:main Aug 18, 2025
63 checks passed
@firewave firewave deleted the diag-bitwise branch August 18, 2025 08:23
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.

2 participants