Skip to content

Commit 82dadd9

Browse files
committed
generate rule package files for c/Types.json
1 parent 41e755f commit 82dadd9

File tree

103 files changed

+1318
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+1318
-2
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# FLP32-C: Prevent or detect ___domain and range errors in math functions
2+
3+
This query implements the CERT-C rule FLP32-C:
4+
5+
> Prevent or detect ___domain and range errors in math functions
6+
7+
8+
## CERT
9+
10+
** REPLACE THIS BY RUNNING THE SCRIPT `scripts/help/cert-help-extraction.py` **
11+
12+
## Implementation notes
13+
14+
None
15+
16+
## References
17+
18+
* CERT-C: [FLP32-C: Prevent or detect ___domain and range errors in math functions](https://wiki.sei.cmu.edu/confluence/display/c)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* @id c/cert/prevent-or-detect-___domain-and-range-errors-in-math-functions
3+
* @name FLP32-C: Prevent or detect ___domain and range errors in math functions
4+
* @description TODO.
5+
* @kind problem
6+
* @precision very-high
7+
* @problem.severity error
8+
* @tags external/cert/id/flp32-c
9+
* external/cert/obligation/rule
10+
*/
11+
12+
import cpp
13+
import codingstandards.c.cert
14+
15+
from
16+
where
17+
not isExcluded(x, TypesPackage::preventOrDetectDomainAndRangeErrorsInMathFunctionsQuery()) and
18+
select
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# FLP34-C: Ensure that floating-point conversions are within range of the new type
2+
3+
This query implements the CERT-C rule FLP34-C:
4+
5+
> Ensure that floating-point conversions are within range of the new type
6+
## CERT
7+
8+
** REPLACE THIS BY RUNNING THE SCRIPT `scripts/help/cert-help-extraction.py` **
9+
10+
## Implementation notes
11+
12+
None
13+
14+
## References
15+
16+
* CERT-C: [FLP34-C: Ensure that floating-point conversions are within range of the new type](https://wiki.sei.cmu.edu/confluence/display/c)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* @id c/cert/floating-point-conversions-not-within-range-of-new-type
3+
* @name FLP34-C: Ensure that floating-point conversions are within range of the new type
4+
* @description TODO.
5+
* @kind problem
6+
* @precision very-high
7+
* @problem.severity error
8+
* @tags external/cert/id/flp34-c
9+
* external/cert/obligation/rule
10+
*/
11+
12+
import cpp
13+
import codingstandards.c.cert
14+
15+
from
16+
where
17+
not isExcluded(x, TypesPackage::floatingPointConversionsNotWithinRangeOfNewTypeQuery()) and
18+
select
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# FLP36-C: Preserve precision when converting integral values to floating-point type
2+
3+
This query implements the CERT-C rule FLP36-C:
4+
5+
> Preserve precision when converting integral values to floating-point type
6+
## CERT
7+
8+
** REPLACE THIS BY RUNNING THE SCRIPT `scripts/help/cert-help-extraction.py` **
9+
10+
## Implementation notes
11+
12+
None
13+
14+
## References
15+
16+
* CERT-C: [FLP36-C: Preserve precision when converting integral values to floating-point type](https://wiki.sei.cmu.edu/confluence/display/c)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* @id c/cert/floating-point-of-integral-values-lose-precision
3+
* @name FLP36-C: Preserve precision when converting integral values to floating-point type
4+
* @description TODO.
5+
* @kind problem
6+
* @precision very-high
7+
* @problem.severity error
8+
* @tags external/cert/id/flp36-c
9+
* external/cert/obligation/rule
10+
*/
11+
12+
import cpp
13+
import codingstandards.c.cert
14+
15+
from
16+
where
17+
not isExcluded(x, TypesPackage::floatingPointOfIntegralValuesLosePrecisionQuery()) and
18+
select
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# FLP37-C: Do not use object representations to compare floating-point values
2+
3+
This query implements the CERT-C rule FLP37-C:
4+
5+
> Do not use object representations to compare floating-point values
6+
## CERT
7+
8+
** REPLACE THIS BY RUNNING THE SCRIPT `scripts/help/cert-help-extraction.py` **
9+
10+
## Implementation notes
11+
12+
None
13+
14+
## References
15+
16+
* CERT-C: [FLP37-C: Do not use object representations to compare floating-point values](https://wiki.sei.cmu.edu/confluence/display/c)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* @id c/cert/object-repr-used-for-comparing-floating-point-values
3+
* @name FLP37-C: Do not use object representations to compare floating-point values
4+
* @description TODO.
5+
* @kind problem
6+
* @precision very-high
7+
* @problem.severity error
8+
* @tags external/cert/id/flp37-c
9+
* external/cert/obligation/rule
10+
*/
11+
12+
import cpp
13+
import codingstandards.c.cert
14+
15+
from
16+
where
17+
not isExcluded(x, TypesPackage::objectReprUsedForComparingFloatingPointValuesQuery()) and
18+
select
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# INT30-C: Ensure that unsigned integer operations do not wrap
2+
3+
This query implements the CERT-C rule INT30-C:
4+
5+
> Ensure that unsigned integer operations do not wrap
6+
## CERT
7+
8+
** REPLACE THIS BY RUNNING THE SCRIPT `scripts/help/cert-help-extraction.py` **
9+
10+
## Implementation notes
11+
12+
None
13+
14+
## References
15+
16+
* CERT-C: [INT30-C: Ensure that unsigned integer operations do not wrap](https://wiki.sei.cmu.edu/confluence/display/c)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* @id c/cert/ensure-that-unsigned-integer-operations-do-not-wrap
3+
* @name INT30-C: Ensure that unsigned integer operations do not wrap
4+
* @description TODO.
5+
* @kind problem
6+
* @precision high
7+
* @problem.severity error
8+
* @tags external/cert/id/int30-c
9+
* external/cert/obligation/rule
10+
*/
11+
12+
import cpp
13+
import codingstandards.c.cert
14+
15+
from
16+
where
17+
not isExcluded(x, TypesPackage::ensureThatUnsignedIntegerOperationsDoNotWrapQuery()) and
18+
select

0 commit comments

Comments
 (0)