Skip to content

Commit 7a6fb0b

Browse files
committed
Add missing metadata files
1 parent fbdbff1 commit 7a6fb0b

File tree

2 files changed

+186
-0
lines changed

2 files changed

+186
-0
lines changed
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
//** THIS FILE IS AUTOGENERATED, DO NOT MODIFY DIRECTLY. **/
2+
import cpp
3+
import RuleMetadata
4+
import codingstandards.cpp.exclusions.RuleMetadata
5+
6+
newtype Types1Query =
7+
TExprShiftedbyNegativeOrGreaterPrecisionOperandQuery() or
8+
TConvertingAPointerToIntegerOrIntegerToPointerQuery() or
9+
TPlainNumericalTypeUsedOverExplicitTypedefQuery() or
10+
TSizeofOperatorUsedOnArrayTypeParamQuery() or
11+
TStringLiteralAssignedToNonConstCharQuery()
12+
13+
predicate isTypes1QueryMetadata(Query query, string queryId, string ruleId, string category) {
14+
query =
15+
// `Query` instance for the `exprShiftedbyNegativeOrGreaterPrecisionOperand` query
16+
Types1Package::exprShiftedbyNegativeOrGreaterPrecisionOperandQuery() and
17+
queryId =
18+
// `@id` for the `exprShiftedbyNegativeOrGreaterPrecisionOperand` query
19+
"c/cert/expr-shiftedby-negative-or-greater-precision-operand" and
20+
ruleId = "INT34-C" and
21+
category = "rule"
22+
or
23+
query =
24+
// `Query` instance for the `convertingAPointerToIntegerOrIntegerToPointer` query
25+
Types1Package::convertingAPointerToIntegerOrIntegerToPointerQuery() and
26+
queryId =
27+
// `@id` for the `convertingAPointerToIntegerOrIntegerToPointer` query
28+
"c/cert/converting-a-pointer-to-integer-or-integer-to-pointer" and
29+
ruleId = "INT36-C" and
30+
category = "rule"
31+
or
32+
query =
33+
// `Query` instance for the `plainNumericalTypeUsedOverExplicitTypedef` query
34+
Types1Package::plainNumericalTypeUsedOverExplicitTypedefQuery() and
35+
queryId =
36+
// `@id` for the `plainNumericalTypeUsedOverExplicitTypedef` query
37+
"c/misra/plain-numerical-type-used-over-explicit-typedef" and
38+
ruleId = "DIR-4-6" and
39+
category = "advisory"
40+
or
41+
query =
42+
// `Query` instance for the `sizeofOperatorUsedOnArrayTypeParam` query
43+
Types1Package::sizeofOperatorUsedOnArrayTypeParamQuery() and
44+
queryId =
45+
// `@id` for the `sizeofOperatorUsedOnArrayTypeParam` query
46+
"c/misra/sizeof-operator-used-on-array-type-param" and
47+
ruleId = "RULE-12-5" and
48+
category = "mandatory"
49+
or
50+
query =
51+
// `Query` instance for the `stringLiteralAssignedToNonConstChar` query
52+
Types1Package::stringLiteralAssignedToNonConstCharQuery() and
53+
queryId =
54+
// `@id` for the `stringLiteralAssignedToNonConstChar` query
55+
"c/misra/string-literal-assigned-to-non-const-char" and
56+
ruleId = "RULE-7-4" and
57+
category = "required"
58+
}
59+
60+
module Types1Package {
61+
Query exprShiftedbyNegativeOrGreaterPrecisionOperandQuery() {
62+
//autogenerate `Query` type
63+
result =
64+
// `Query` type for `exprShiftedbyNegativeOrGreaterPrecisionOperand` query
65+
TQueryC(TTypes1PackageQuery(TExprShiftedbyNegativeOrGreaterPrecisionOperandQuery()))
66+
}
67+
68+
Query convertingAPointerToIntegerOrIntegerToPointerQuery() {
69+
//autogenerate `Query` type
70+
result =
71+
// `Query` type for `convertingAPointerToIntegerOrIntegerToPointer` query
72+
TQueryC(TTypes1PackageQuery(TConvertingAPointerToIntegerOrIntegerToPointerQuery()))
73+
}
74+
75+
Query plainNumericalTypeUsedOverExplicitTypedefQuery() {
76+
//autogenerate `Query` type
77+
result =
78+
// `Query` type for `plainNumericalTypeUsedOverExplicitTypedef` query
79+
TQueryC(TTypes1PackageQuery(TPlainNumericalTypeUsedOverExplicitTypedefQuery()))
80+
}
81+
82+
Query sizeofOperatorUsedOnArrayTypeParamQuery() {
83+
//autogenerate `Query` type
84+
result =
85+
// `Query` type for `sizeofOperatorUsedOnArrayTypeParam` query
86+
TQueryC(TTypes1PackageQuery(TSizeofOperatorUsedOnArrayTypeParamQuery()))
87+
}
88+
89+
Query stringLiteralAssignedToNonConstCharQuery() {
90+
//autogenerate `Query` type
91+
result =
92+
// `Query` type for `stringLiteralAssignedToNonConstChar` query
93+
TQueryC(TTypes1PackageQuery(TStringLiteralAssignedToNonConstCharQuery()))
94+
}
95+
}

rule_packages/c/Types1.json

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
{
2+
"CERT-C": {
3+
"INT34-C": {
4+
"properties": {
5+
"obligation": "rule"
6+
},
7+
"queries": [
8+
{
9+
"description": "Shifting an expression by an operand that is negative or of precision greater or equal to that or the another causes representational error.",
10+
"kind": "problem",
11+
"name": "Bit shift should not be done by a negative operand or an operand of greater-or-equal precision than that of another",
12+
"precision": "very-high",
13+
"severity": "error",
14+
"short_name": "ExprShiftedbyNegativeOrGreaterPrecisionOperand",
15+
"tags": []
16+
}
17+
],
18+
"title": "Do not shift an expression by a negative number of bits or by greater than or equal to the number of bits that exist in the operand"
19+
},
20+
"INT36-C": {
21+
"properties": {
22+
"obligation": "rule"
23+
},
24+
"queries": [
25+
{
26+
"description": "Converting between pointers and integers is not portable and might cause invalid memory access.",
27+
"kind": "problem",
28+
"name": "Do not convert pointers to integers and back",
29+
"precision": "very-high",
30+
"severity": "error",
31+
"short_name": "ConvertingAPointerToIntegerOrIntegerToPointer",
32+
"tags": []
33+
}
34+
],
35+
"title": "Converting a pointer to integer or integer to pointer"
36+
}
37+
},
38+
"MISRA-C-2012": {
39+
"DIR-4-6": {
40+
"properties": {
41+
"obligation": "advisory"
42+
},
43+
"queries": [
44+
{
45+
"description": "Using plain numerical types over typedefs with explicit sign and bit counts may lead to confusion on how much bits are allocated for a value.",
46+
"kind": "problem",
47+
"name": "Do not use plain numerical types over typedefs named after their explicit bit layout",
48+
"precision": "high",
49+
"severity": "error",
50+
"short_name": "PlainNumericalTypeUsedOverExplicitTypedef",
51+
"tags": []
52+
}
53+
],
54+
"title": "typedefs that indicate size and signedness should be used in place of the basic numerical types"
55+
},
56+
"RULE-12-5": {
57+
"properties": {
58+
"obligation": "mandatory"
59+
},
60+
"queries": [
61+
{
62+
"description": "Using sizeof operator on an array type function parameter leads to unintended results.",
63+
"kind": "problem",
64+
"name": "The sizeof operator should not be used on an array type function parameter",
65+
"precision": "very-high",
66+
"severity": "error",
67+
"short_name": "SizeofOperatorUsedOnArrayTypeParam",
68+
"tags": []
69+
}
70+
],
71+
"title": "The sizeof operator shall not have an operand which is a function parameter declared as 'array of type'"
72+
},
73+
"RULE-7-4": {
74+
"properties": {
75+
"obligation": "required"
76+
},
77+
"queries": [
78+
{
79+
"description": "Assigning string literal to a variable with type other than a pointer to const char and modifying it causes undefined behavior .",
80+
"kind": "problem",
81+
"name": "A string literal shall only be assigned to a pointer to const char",
82+
"precision": "very-high",
83+
"severity": "error",
84+
"short_name": "StringLiteralAssignedToNonConstChar",
85+
"tags": []
86+
}
87+
],
88+
"title": "A string literal shall not be assigned to an object unless the object's type is 'pointer to const-qualified char'"
89+
}
90+
}
91+
}

0 commit comments

Comments
 (0)