Skip to content

Commit 3cb4211

Browse files
committed
CPP: Exclude code in macro invocations.
1 parent b4adfec commit 3cb4211

File tree

3 files changed

+2
-2
lines changed

3 files changed

+2
-2
lines changed

cpp/ql/src/Likely Bugs/Arithmetic/PointlessSelfComparison.ql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ from ComparisonOperation cmp
1818
where pointlessSelfComparison(cmp)
1919
and not nanTest(cmp)
2020
and not overflowTest(cmp)
21+
and not cmp.isInMacroExpansion()
2122
select cmp, "Self comparison."

cpp/ql/test/query-tests/Likely Bugs/Arithmetic/BadAdditionOverflowCheck/PointlessSelfComparison.expected

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@
33
| test.cpp:83:10:83:15 | ... == ... | Self comparison. |
44
| test.cpp:90:10:90:15 | ... == ... | Self comparison. |
55
| test.cpp:118:7:118:32 | ... != ... | Self comparison. |
6-
| test.cpp:145:2:145:30 | ... == ... | Self comparison. |

cpp/ql/test/query-tests/Likely Bugs/Arithmetic/BadAdditionOverflowCheck/test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,5 +142,5 @@ void useMarkRange(int offs) {
142142
markRange(buffer, 10, 20);
143143
markRange(buffer, 30, 30);
144144
markRange(buffer, offs, offs + 10);
145-
markRange(buffer, offs, offs); // GOOD (comparison is in the macro) [FALSE POSITIVE]
145+
markRange(buffer, offs, offs); // GOOD (comparison is in the macro)
146146
}

0 commit comments

Comments
 (0)