mirror of
https://github.com/github/codeql.git
synced 2025-12-17 17:23:36 +01:00
Merge pull request #405 from geoffw0/selfcompare
CPP: Fix false positives in PointlessSelfComparison.ql
This commit is contained in:
@@ -18,4 +18,12 @@ from ComparisonOperation cmp
|
||||
where pointlessSelfComparison(cmp)
|
||||
and not nanTest(cmp)
|
||||
and not overflowTest(cmp)
|
||||
and not exists(MacroInvocation mi |
|
||||
// cmp is in mi
|
||||
mi.getAnExpandedElement() = cmp and
|
||||
|
||||
// and cmp was apparently not passed in as a macro parameter
|
||||
cmp.getLocation().getStartLine() = mi.getLocation().getStartLine() and
|
||||
cmp.getLocation().getStartColumn() = mi.getLocation().getStartColumn()
|
||||
)
|
||||
select cmp, "Self comparison."
|
||||
|
||||
Reference in New Issue
Block a user