Skip to content

Commit 60dc594

Browse files
committed
EssentialTypes: Refine set of rules and commit package files.
1 parent a53e650 commit 60dc594

File tree

4 files changed

+385
-2
lines changed

4 files changed

+385
-2
lines changed
Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
//** THIS FILE IS AUTOGENERATED, DO NOT MODIFY DIRECTLY. **/
2+
import cpp
3+
import RuleMetadata
4+
import codingstandards.cpp.exclusions.RuleMetadata
5+
6+
newtype EssentialTypesQuery =
7+
TOperandsOfAnInappropriateEssentialTypeQuery() or
8+
TPointerTypeOnLogicalOperatorQuery() or
9+
TAdditionSubtractionOnEssentiallyCharTypeQuery() or
10+
TAssignmentOfIncompatibleEssentialTypeQuery() or
11+
TOperandsWithMismatchedEssentialTypeCategoryQuery() or
12+
TInappropriateEssentialTypeCastQuery() or
13+
TAssignmentToWiderEssentialTypeQuery() or
14+
TImplicitConversionOfCompositeExpressionQuery() or
15+
TInappropriateCastOfCompositeExpressionQuery() or
16+
TLoopOverEssentiallyFloatTypeQuery() or
17+
TMemcmpOnInappropriateEssentialTypeArgsQuery()
18+
19+
predicate isEssentialTypesQueryMetadata(Query query, string queryId, string ruleId, string category) {
20+
query =
21+
// `Query` instance for the `operandsOfAnInappropriateEssentialType` query
22+
EssentialTypesPackage::operandsOfAnInappropriateEssentialTypeQuery() and
23+
queryId =
24+
// `@id` for the `operandsOfAnInappropriateEssentialType` query
25+
"c/misra/operands-of-an-inappropriate-essential-type" and
26+
ruleId = "RULE-10-1" and
27+
category = "required"
28+
or
29+
query =
30+
// `Query` instance for the `pointerTypeOnLogicalOperator` query
31+
EssentialTypesPackage::pointerTypeOnLogicalOperatorQuery() and
32+
queryId =
33+
// `@id` for the `pointerTypeOnLogicalOperator` query
34+
"c/misra/pointer-type-on-logical-operator" and
35+
ruleId = "RULE-10-1" and
36+
category = "required"
37+
or
38+
query =
39+
// `Query` instance for the `additionSubtractionOnEssentiallyCharType` query
40+
EssentialTypesPackage::additionSubtractionOnEssentiallyCharTypeQuery() and
41+
queryId =
42+
// `@id` for the `additionSubtractionOnEssentiallyCharType` query
43+
"c/misra/addition-subtraction-on-essentially-char-type" and
44+
ruleId = "RULE-10-2" and
45+
category = "required"
46+
or
47+
query =
48+
// `Query` instance for the `assignmentOfIncompatibleEssentialType` query
49+
EssentialTypesPackage::assignmentOfIncompatibleEssentialTypeQuery() and
50+
queryId =
51+
// `@id` for the `assignmentOfIncompatibleEssentialType` query
52+
"c/misra/assignment-of-incompatible-essential-type" and
53+
ruleId = "RULE-10-3" and
54+
category = "required"
55+
or
56+
query =
57+
// `Query` instance for the `operandsWithMismatchedEssentialTypeCategory` query
58+
EssentialTypesPackage::operandsWithMismatchedEssentialTypeCategoryQuery() and
59+
queryId =
60+
// `@id` for the `operandsWithMismatchedEssentialTypeCategory` query
61+
"c/misra/operands-with-mismatched-essential-type-category" and
62+
ruleId = "RULE-10-4" and
63+
category = "required"
64+
or
65+
query =
66+
// `Query` instance for the `inappropriateEssentialTypeCast` query
67+
EssentialTypesPackage::inappropriateEssentialTypeCastQuery() and
68+
queryId =
69+
// `@id` for the `inappropriateEssentialTypeCast` query
70+
"c/misra/inappropriate-essential-type-cast" and
71+
ruleId = "RULE-10-5" and
72+
category = "advisory"
73+
or
74+
query =
75+
// `Query` instance for the `assignmentToWiderEssentialType` query
76+
EssentialTypesPackage::assignmentToWiderEssentialTypeQuery() and
77+
queryId =
78+
// `@id` for the `assignmentToWiderEssentialType` query
79+
"c/misra/assignment-to-wider-essential-type" and
80+
ruleId = "RULE-10-6" and
81+
category = "required"
82+
or
83+
query =
84+
// `Query` instance for the `implicitConversionOfCompositeExpression` query
85+
EssentialTypesPackage::implicitConversionOfCompositeExpressionQuery() and
86+
queryId =
87+
// `@id` for the `implicitConversionOfCompositeExpression` query
88+
"c/misra/implicit-conversion-of-composite-expression" and
89+
ruleId = "RULE-10-7" and
90+
category = "required"
91+
or
92+
query =
93+
// `Query` instance for the `inappropriateCastOfCompositeExpression` query
94+
EssentialTypesPackage::inappropriateCastOfCompositeExpressionQuery() and
95+
queryId =
96+
// `@id` for the `inappropriateCastOfCompositeExpression` query
97+
"c/misra/inappropriate-cast-of-composite-expression" and
98+
ruleId = "RULE-10-8" and
99+
category = "required"
100+
or
101+
query =
102+
// `Query` instance for the `loopOverEssentiallyFloatType` query
103+
EssentialTypesPackage::loopOverEssentiallyFloatTypeQuery() and
104+
queryId =
105+
// `@id` for the `loopOverEssentiallyFloatType` query
106+
"c/misra/loop-over-essentially-float-type" and
107+
ruleId = "RULE-14-1" and
108+
category = "required"
109+
or
110+
query =
111+
// `Query` instance for the `memcmpOnInappropriateEssentialTypeArgs` query
112+
EssentialTypesPackage::memcmpOnInappropriateEssentialTypeArgsQuery() and
113+
queryId =
114+
// `@id` for the `memcmpOnInappropriateEssentialTypeArgs` query
115+
"c/misra/memcmp-on-inappropriate-essential-type-args" and
116+
ruleId = "RULE-21-16" and
117+
category = "required"
118+
}
119+
120+
module EssentialTypesPackage {
121+
Query operandsOfAnInappropriateEssentialTypeQuery() {
122+
//autogenerate `Query` type
123+
result =
124+
// `Query` type for `operandsOfAnInappropriateEssentialType` query
125+
TQueryC(TEssentialTypesPackageQuery(TOperandsOfAnInappropriateEssentialTypeQuery()))
126+
}
127+
128+
Query pointerTypeOnLogicalOperatorQuery() {
129+
//autogenerate `Query` type
130+
result =
131+
// `Query` type for `pointerTypeOnLogicalOperator` query
132+
TQueryC(TEssentialTypesPackageQuery(TPointerTypeOnLogicalOperatorQuery()))
133+
}
134+
135+
Query additionSubtractionOnEssentiallyCharTypeQuery() {
136+
//autogenerate `Query` type
137+
result =
138+
// `Query` type for `additionSubtractionOnEssentiallyCharType` query
139+
TQueryC(TEssentialTypesPackageQuery(TAdditionSubtractionOnEssentiallyCharTypeQuery()))
140+
}
141+
142+
Query assignmentOfIncompatibleEssentialTypeQuery() {
143+
//autogenerate `Query` type
144+
result =
145+
// `Query` type for `assignmentOfIncompatibleEssentialType` query
146+
TQueryC(TEssentialTypesPackageQuery(TAssignmentOfIncompatibleEssentialTypeQuery()))
147+
}
148+
149+
Query operandsWithMismatchedEssentialTypeCategoryQuery() {
150+
//autogenerate `Query` type
151+
result =
152+
// `Query` type for `operandsWithMismatchedEssentialTypeCategory` query
153+
TQueryC(TEssentialTypesPackageQuery(TOperandsWithMismatchedEssentialTypeCategoryQuery()))
154+
}
155+
156+
Query inappropriateEssentialTypeCastQuery() {
157+
//autogenerate `Query` type
158+
result =
159+
// `Query` type for `inappropriateEssentialTypeCast` query
160+
TQueryC(TEssentialTypesPackageQuery(TInappropriateEssentialTypeCastQuery()))
161+
}
162+
163+
Query assignmentToWiderEssentialTypeQuery() {
164+
//autogenerate `Query` type
165+
result =
166+
// `Query` type for `assignmentToWiderEssentialType` query
167+
TQueryC(TEssentialTypesPackageQuery(TAssignmentToWiderEssentialTypeQuery()))
168+
}
169+
170+
Query implicitConversionOfCompositeExpressionQuery() {
171+
//autogenerate `Query` type
172+
result =
173+
// `Query` type for `implicitConversionOfCompositeExpression` query
174+
TQueryC(TEssentialTypesPackageQuery(TImplicitConversionOfCompositeExpressionQuery()))
175+
}
176+
177+
Query inappropriateCastOfCompositeExpressionQuery() {
178+
//autogenerate `Query` type
179+
result =
180+
// `Query` type for `inappropriateCastOfCompositeExpression` query
181+
TQueryC(TEssentialTypesPackageQuery(TInappropriateCastOfCompositeExpressionQuery()))
182+
}
183+
184+
Query loopOverEssentiallyFloatTypeQuery() {
185+
//autogenerate `Query` type
186+
result =
187+
// `Query` type for `loopOverEssentiallyFloatType` query
188+
TQueryC(TEssentialTypesPackageQuery(TLoopOverEssentiallyFloatTypeQuery()))
189+
}
190+
191+
Query memcmpOnInappropriateEssentialTypeArgsQuery() {
192+
//autogenerate `Query` type
193+
result =
194+
// `Query` type for `memcmpOnInappropriateEssentialTypeArgs` query
195+
TQueryC(TEssentialTypesPackageQuery(TMemcmpOnInappropriateEssentialTypeArgsQuery()))
196+
}
197+
}

cpp/common/src/codingstandards/cpp/exclusions/c/RuleMetadata.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import Declarations1
1616
import Declarations2
1717
import Declarations3
1818
import Declarations4
19+
import EssentialTypes
1920
import Expressions
2021
import IO1
2122
import IO2
@@ -55,6 +56,7 @@ newtype TCQuery =
5556
TDeclarations2PackageQuery(Declarations2Query q) or
5657
TDeclarations3PackageQuery(Declarations3Query q) or
5758
TDeclarations4PackageQuery(Declarations4Query q) or
59+
TEssentialTypesPackageQuery(EssentialTypesQuery q) or
5860
TExpressionsPackageQuery(ExpressionsQuery q) or
5961
TIO1PackageQuery(IO1Query q) or
6062
TIO2PackageQuery(IO2Query q) or
@@ -94,6 +96,7 @@ predicate isQueryMetadata(Query query, string queryId, string ruleId, string cat
9496
isDeclarations2QueryMetadata(query, queryId, ruleId, category) or
9597
isDeclarations3QueryMetadata(query, queryId, ruleId, category) or
9698
isDeclarations4QueryMetadata(query, queryId, ruleId, category) or
99+
isEssentialTypesQueryMetadata(query, queryId, ruleId, category) or
97100
isExpressionsQueryMetadata(query, queryId, ruleId, category) or
98101
isIO1QueryMetadata(query, queryId, ruleId, category) or
99102
isIO2QueryMetadata(query, queryId, ruleId, category) or

0 commit comments

Comments
 (0)