Skip to content

Commit dcb32c1

Browse files
committed
DIR-4-11: Add query for checking math.h functions
Add query which detects domain and pole errors for math.h functions.
1 parent 52bdbd7 commit dcb32c1

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* @id c/misra/check-math-library-function-parameters
3+
* @name DIR-4-11: The validity of values passed to `math.h` library functions shall be checked
4+
* @description Range, domain or pole errors in math functions may return unexpected values, trigger
5+
* floating-point exceptions or set unexpected error modes.
6+
* @kind problem
7+
* @precision high
8+
* @problem.severity error
9+
* @tags external/misra/id/dir-4-11
10+
* correctness
11+
* external/misra/obligation/required
12+
*/
13+
14+
import cpp
15+
import codingstandards.c.misra
16+
import codingstandards.cpp.rules.uncheckedrangedomainpoleerrors.UncheckedRangeDomainPoleErrors
17+
18+
class CheckMathLibraryFunctionParametersQuery extends UncheckedRangeDomainPoleErrorsSharedQuery {
19+
CheckMathLibraryFunctionParametersQuery() {
20+
this = ContractsPackage::checkMathLibraryFunctionParametersQuery()
21+
}
22+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
c/common/test/rules/uncheckedrangedomainpoleerrors/UncheckedRangeDomainPoleErrors.ql

0 commit comments

Comments
 (0)