mirror of
https://github.com/github/codeql.git
synced 2026-03-28 02:08:17 +01:00
22 lines
568 B
Plaintext
22 lines
568 B
Plaintext
/**
|
|
* @name Self comparison
|
|
* @description Comparing a variable to itself always produces the
|
|
same result, unless the purpose is to check for
|
|
integer overflow or floating point NaN.
|
|
* @kind problem
|
|
* @problem.severity warning
|
|
* @precision high
|
|
* @id cpp/comparison-of-identical-expressions
|
|
* @tags readability
|
|
* maintainability
|
|
*/
|
|
|
|
import cpp
|
|
import PointlessSelfComparison
|
|
|
|
from ComparisonOperation cmp
|
|
where pointlessSelfComparison(cmp)
|
|
and not nanTest(cmp)
|
|
and not overflowTest(cmp)
|
|
select cmp, "Self comparison."
|