Skip to content

cpp: Incorrect not operator usage#416

Merged
geoffw0 merged 4 commits into
github:masterfrom
raulgarciamsft:users/raulga/c6317
Nov 9, 2018
Merged

cpp: Incorrect not operator usage#416
geoffw0 merged 4 commits into
github:masterfrom
raulgarciamsft:users/raulga/c6317

Conversation

@raulgarciamsft
Copy link
Copy Markdown
Contributor

Marked as Low precision as Linux kernel code mix the usage of logical operators and bit-wise opeartors.
warning C6317: incorrect operator: logical-not (!) is not interchangeable with ones-complement (~)

Marked as Low precision as Linux kernel code mix the usage of logical operators and bit-wise opeartors.
warning C6317: incorrect operator: logical-not (!) is not interchangeable with ones-complement (~)
@raulgarciamsft raulgarciamsft requested a review from a team as a code owner November 6, 2018 20:51
Copy link
Copy Markdown
Contributor

@geoffw0 geoffw0 left a comment

Choose a reason for hiding this comment

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

LGTM.

The results I'm seeing for & and I appear to be good quality, whereas many results for ^ and >>/<< are questionable. Have you considered restricting the query to just BitwiseAndExpr + BitwiseOrExpr, which might perhaps justify a precision of medium?

Would there be value in covering the opposite case, i && ~FLAGS?

Comment thread cpp/ql/src/Likely Bugs/Likely Typos/IncorrectNotOperatorUsage.cpp Outdated
Comment thread cpp/ql/src/Likely Bugs/Likely Typos/IncorrectNotOperatorUsage.ql Outdated
raulgarciamsft and others added 2 commits November 7, 2018 13:26
Restricting to analyze only logical & and | operations
@jbj jbj added the C++ label Nov 8, 2018
Copy link
Copy Markdown
Contributor

@geoffw0 geoffw0 left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thank you for working on this new query!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants