mirror of
https://github.com/github/codeql.git
synced 2026-04-29 02:35:15 +02:00
Merge pull request #16403 from geoffw0/qhelp1
C++: Improve qhelp for IncorrectNotOperatorUsage.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
void C6317_positive(int i)
|
||||
{
|
||||
if (i & !FLAGS) // BUG
|
||||
if (i & !FLAGS) // BUG
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -71,3 +71,22 @@ void macroUsage(unsigned int arg1, unsigned int arg2)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void bool_examples(bool a, bool b)
|
||||
{
|
||||
if (a & !b) // dubious (confusing intent, but shouldn't produce a wrong result)
|
||||
{
|
||||
}
|
||||
|
||||
if (a & ~b)
|
||||
{
|
||||
}
|
||||
|
||||
if (a && ~b)
|
||||
{
|
||||
}
|
||||
|
||||
if (a && !b)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,3 +14,4 @@
|
||||
| IncorrectNotOperatorUsage.cpp:48:9:48:18 | ... \| ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.cpp:49:9:49:20 | ... \| ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.cpp:70:10:70:34 | ... \| ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
| IncorrectNotOperatorUsage.cpp:77:9:77:14 | ... & ... | Usage of a logical not (!) expression as a bitwise operator. |
|
||||
|
||||
Reference in New Issue
Block a user