mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
CPP: Tag LossyFunctionResultCast.ql. Will be run on LGTM.
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
/**
|
||||
* @name Lossy function result cast
|
||||
* @description Finds function calls whose result type is a floating point type, and which are casted to an integral type.
|
||||
* Includes only expressions with implicit cast and excludes function calls to ceil, floor and round. {This is a gcc check; doesn't seem wildly useful.}
|
||||
* Includes only expressions with implicit cast and excludes function calls to ceil, floor and round.
|
||||
* @kind problem
|
||||
* @id cpp/lossy-function-result-cast
|
||||
* @problem.severity warning
|
||||
* @precision medium
|
||||
* @tags correctness
|
||||
*/
|
||||
import cpp
|
||||
|
||||
@@ -15,4 +17,4 @@ where t1 = c.getTarget().getType().getUnderlyingType() and
|
||||
not c.getTarget().getName() = "ceil" and
|
||||
not c.getTarget().getName() = "floor" and
|
||||
not c.getTarget().getName() = "round"
|
||||
select c
|
||||
select c, "Return value of type " + t1.toString() + " is implicitly converted to " + t2.toString() + " here."
|
||||
|
||||
Reference in New Issue
Block a user