-
Notifications
You must be signed in to change notification settings - Fork 76
Expand file tree
/
Copy pathConst.json
More file actions
266 lines (266 loc) · 9.6 KB
/
Copy pathConst.json
File metadata and controls
266 lines (266 loc) · 9.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
{
"AUTOSAR": {
"A5-2-3": {
"properties": {
"allocated-target": [
"implementation"
],
"enforcement": "automated",
"obligation": "required"
},
"queries": [
{
"description": "Removing `const`/`volatile` qualification can result in undefined behavior when a `const`/`volatile` qualified object is modified through a non-const access path.",
"kind": "problem",
"name": "A cast shall not remove any const or volatile qualification from the type of a pointer or reference",
"precision": "very-high",
"severity": "warning",
"shared_implementation_short_name": "RemoveConstOrVolatileQualification",
"short_name": "RemoveConstOrVolatileQualificationAutosar",
"tags": [
"correctness"
]
}
],
"title": "A cast shall not remove any const or volatile qualification from the type of a pointer or reference."
},
"A7-1-1": {
"properties": {
"allocated-target": [
"implementation"
],
"enforcement": "automated",
"obligation": "required"
},
"queries": [
{
"description": "`Constexpr`/`const` specifiers prevent unintentional data modification for data intended as immutable.",
"kind": "problem",
"name": "Constexpr or const specifiers shall be used for immutable data declaration",
"precision": "high",
"severity": "warning",
"short_name": "DeclarationUnmodifiedObjectMissingConstSpecifier",
"tags": [
"correctness",
"maintainability",
"readability"
],
"implementation_scope": {
"description": "We exclude function parameters from this rule in line with the rule intention as described in the C++ Core Guidelines Con.1 which excludes function parameters."
}
}
],
"title": "Constexpr or const specifiers shall be used for immutable data declaration."
},
"A7-1-2": {
"properties": {
"allocated-target": [
"implementation"
],
"enforcement": "automated",
"obligation": "required"
},
"queries": [
{
"description": "Using 'constexpr' makes it clear that a variable is intended to be compile time constant.",
"kind": "problem",
"name": "The constexpr specifier shall be used for variables that can be determined at compile time",
"precision": "high",
"severity": "recommendation",
"short_name": "VariableMissingConstexpr",
"tags": [
"maintainability"
]
}
],
"title": "The constexpr specifier shall be used for values that can be determined at compile time."
},
"A7-1-3": {
"properties": {
"allocated-target": [
"implementation"
],
"enforcement": "automated",
"obligation": "required"
},
"queries": [
{
"description": "Using `const`/`volatile` qualifiers on the left hand side of types that are `typedef`s or `using` names makes it harder to understand what the qualifier applies to.",
"kind": "problem",
"name": "CV-qualifiers shall be placed on the right hand side of the type that is a typedef or a using name",
"precision": "very-high",
"severity": "warning",
"short_name": "CvQualifiersNotPlacedOnTheRightHandSide",
"tags": [
"correctness",
"maintainability",
"readability"
]
}
],
"title": "CV-qualifiers shall be placed on the right hand side of the type that is a typedef or a using name."
},
"A8-4-8": {
"properties": {
"allocated-target": [
"design"
],
"enforcement": "automated",
"obligation": "required"
},
"queries": [
{
"description": "Using output parameters can lead to undefined program behaviour, for example when they return dangling references.",
"kind": "problem",
"name": "Output parameters shall not be used",
"precision": "high",
"severity": "warning",
"short_name": "OutputParametersUsed",
"tags": [
"correctness",
"maintainability",
"readability",
"external/autosar/strict"
]
}
],
"title": "Output parameters shall not be used."
},
"A8-4-9": {
"properties": {
"allocated-target": [
"design"
],
"enforcement": "automated",
"obligation": "required"
},
"queries": [
{
"description": "Parameters declared as `T &` are intended to be modified (or else they would be specified to be read-only) and not modifiying them indicate a possible mistake on the part of the programmer.",
"kind": "problem",
"name": "'in-out' parameters declared as T & shall be modified",
"precision": "high",
"severity": "warning",
"short_name": "InOutParametersDeclaredAsTNotModified",
"tags": [
"correctness",
"maintainability",
"readability"
]
}
],
"title": "'in-out' parameters declared as T & shall be modified."
},
"M7-1-2": {
"properties": {
"allocated-target": [
"implementation"
],
"enforcement": "automated",
"obligation": "required"
},
"queries": [
{
"description": "Using a pointer/reference parameter in a function as pointer/reference to const if the corresponding object is not modified prevents unintended program behaviour.",
"kind": "problem",
"name": "A pointer or reference parameter in a function shall be declared as pointer to const or reference to const where possible",
"precision": "high",
"severity": "warning",
"short_name": "PointerOrReferenceParameterToConst",
"tags": [
"correctness",
"maintainability",
"readability"
]
}
],
"title": "A pointer or reference parameter in a function shall be declared as pointer to const or reference to const if the corresponding object is not modified."
},
"M9-3-1": {
"properties": {
"allocated-target": [
"implementation"
],
"enforcement": "automated",
"obligation": "required"
},
"queries": [
{
"description": "Returning references to class-data from `const` member functions is inconsistent with developer expectations because it allows modification of state of an object that was expected to be overall `const`.",
"kind": "problem",
"name": "Const member functions shall not return non-const pointers/references to class-data",
"precision": "high",
"severity": "warning",
"short_name": "ConstMemberFunctionReturnsNonConstPointer",
"tags": [
"correctness",
"maintainability",
"readability"
]
}
],
"title": "Const member functions shall not return non-const pointers or references to class-data."
},
"M9-3-3": {
"properties": {
"allocated-target": [
"implementation"
],
"enforcement": "automated",
"obligation": "required"
},
"queries": [
{
"description": "Using `static` specifiers for member functions where possible prevents unintentional data modification (and therefore unintentional program behaviour).",
"kind": "problem",
"name": "A member function shall be made static where possible",
"precision": "very-high",
"severity": "warning",
"short_name": "MemberFunctionStaticIfPossible",
"tags": [
"correctness"
]
},
{
"description": "Using `const` specifiers for member functions where possible prevents unintentional data modification (and therefore unintentional program behaviour).",
"kind": "problem",
"name": "A member function shall be made const where possible",
"precision": "high",
"severity": "warning",
"short_name": "MemberFunctionConstIfPossible",
"tags": [
"correctness"
]
}
],
"title": "If a member function can be made static then it shall be made static, otherwise if it can be made const then it shall be made const."
}
},
"CERT-C++": {
"EXP55-CPP": {
"properties": {
"obligation": "rule"
},
"queries": [
{
"description": "Removing `const`/`volatile` qualification can result in undefined behavior when a `const`/`volatile` qualified object is modified through a non-const access path.",
"kind": "problem",
"name": "Do not access a cv-qualified object through a cv-unqualified type",
"precision": "very-high",
"severity": "warning",
"shared_implementation_short_name": "RemoveConstOrVolatileQualification",
"short_name": "RemoveConstOrVolatileQualificationCert",
"tags": [
"correctness",
"external/cert/severity/medium",
"external/cert/likelihood/probable",
"external/cert/remediation-cost/medium",
"external/cert/priority/p8",
"external/cert/level/l2"
]
}
],
"title": "Do not access a cv-qualified object through a cv-unqualified type"
}
}
}