Skip to content

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

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

firewave
Copy link
Collaborator

these are shown with a make build using Clang

@@ -78,6 +78,13 @@ bool CheckCondition::diag(const Token* tok, bool insert)
return true;
}

bool CheckCondition::diag(const Token* tok1, const Token* tok2)
{
bool b = diag(tok1);
Copy link
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
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
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
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
Copy link

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