Skip to content

Commit e4e30c4

Browse files
committed
MISRA C++ 2023 pack structure
1 parent 86bf6aa commit e4e30c4

File tree

7 files changed

+53
-3
lines changed

7 files changed

+53
-3
lines changed

cpp/common/test/options

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
semmle-extractor-options:--clang -std=c++17 -nostdinc++ -I../../../../common/test/includes/standard-library -I../../../../common/test/includes/custom-library
File renamed without changes.

docs/design/guideline_recategorization.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ The *effective category* is the category whose policy is applied during the eval
101101
The policy of a category dictates if a result can be deviated from and implements the effect described in the design section.
102102
The existing exclusion mechanism implemented in the predicate `isExcluded` defined in the `Exclusions.qll` library will be updated to consider the applicable policy of a guideline.
103103

104-
Note: This changes the behavior of deviations which will no longer have an impact on Mandatory guidelines! However, this will only affect MISRA C rules because there are no MISRA C++ Guidelines with a Mandatory category.
104+
Note: This changes the behavior of deviations which will no longer have an impact on Mandatory MISRA guidelines!
105105

106106
### Specification validation
107107

rules.csv

+1-1
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ c,MISRA-C-2012,RULE-22-7,Yes,Required,,,The macro EOF shall only be compared wit
774774
c,MISRA-C-2012,RULE-22-8,Yes,Required,,,The value of errno shall be set to zero prior to a call to an errno-setting-function,ERR30-C,Contracts3,Medium,
775775
c,MISRA-C-2012,RULE-22-9,Yes,Required,,,The value of errno shall be tested against zero after calling an errno-setting-function,,Contracts3,Medium,
776776
c,MISRA-C-2012,RULE-22-10,Yes,Required,,,The value of errno shall only be tested when the last function to be called was an errno-setting-function,,Contracts3,Medium,
777-
cpp,MISRA-C++-2023,RULE-0-0-1,Yes,Required,Decidable,Single Translation Unit,A function shall not contain unreachable statements,,,Medium,
777+
cpp,MISRA-C++-2023,RULE-0-0-1,Yes,Required,Decidable,Single Translation Unit,A function shall not contain unreachable statements,,DeadCode,Medium,
778778
cpp,MISRA-C++-2023,RULE-0-0-2,Yes,Advisory,Undecidable,System,Controlling expressions should not be invariant,,,Easy,
779779
cpp,MISRA-C++-2023,RULE-0-1-1,Yes,Advisory,Undecidable,System,A value should not be unnecessarily written to a local object,,,Medium,
780780
cpp,MISRA-C++-2023,RULE-0-1-2,Yes,Required,Decidable,Single Translation Unit,The value returned by a function shall be used,,,Easy,

schemas/rule-package.schema.json

+49
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,55 @@
220220
"minProperties": 1
221221
}
222222
}
223+
},
224+
{
225+
"properties": {
226+
"MISRA-C++-2023": {
227+
"description": "Rules part of the MISRA C++ 2023 standard",
228+
"type": "object",
229+
"patternProperties": {
230+
"^RULE-\\d+-\\d+-\\d+": {
231+
"description": "A coding standard rule",
232+
"type": "object",
233+
"properties": {
234+
"properties": {
235+
"type": "object",
236+
"properties": {
237+
"obligation": {
238+
"type": "string",
239+
"enum": [
240+
"required",
241+
"advisory",
242+
"mandatory"
243+
]
244+
}
245+
},
246+
"required": [
247+
"obligation"
248+
]
249+
},
250+
"queries": {
251+
"type": "array",
252+
"uniqueItems": true,
253+
"items": {
254+
"$ref": "#/$defs/query"
255+
}
256+
},
257+
"title": {
258+
"type": "string"
259+
}
260+
},
261+
"required": [
262+
"properties",
263+
"queries",
264+
"title"
265+
],
266+
"additionalProperties": false
267+
}
268+
},
269+
"minProperties": 1
270+
}
271+
}
223272
}
224273
],
225274
"minProperties": 1,

scripts/reports/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def __init__(self, sarif_results_file_path):
149149
if standard_rule_id in self.guideline_obligation_level[standard_short_name]:
150150
if not self.guideline_obligation_level[standard_short_name][standard_rule_id] == obligation_level:
151151
print(
152-
f"WARNING: Rule { rule['id'] } specifies a conflicting obligation level of { obligation_level }, was previously specified as { guideline_obligation_level[standard_short_name][standard_rule_id] }.")
152+
f"WARNING: Rule { rule['id'] } specifies a conflicting obligation level of { obligation_level }, was previously specified as { self.guideline_obligation_level[standard_short_name][standard_rule_id] }.")
153153
else:
154154
self.guideline_obligation_level[standard_short_name][standard_rule_id] = obligation_level
155155
# Add deviation counts for the rule

0 commit comments

Comments
 (0)