Skip to content

Commit 54492b0

Browse files
authored
Merge pull request github#586 from github/initial-misra-cpp-2023-support
Initial misra cpp 2023 support
2 parents 02dfac9 + c06b373 commit 54492b0

File tree

13 files changed

+107
-6
lines changed

13 files changed

+107
-6
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- `MISRA C++ 2023`:
2+
- Extend the project structure and provide initial support for query writing.

cpp/common/test/options

Lines changed: 1 addition & 0 deletions
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
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
- description: MISRA C++ 2023 (Default)
2+
- qlpack: codeql/misra-cpp-coding-standards
3+
- include:
4+
kind:
5+
- problem
6+
- path-problem
7+
- exclude:
8+
tags contain:
9+
- external/misra/audit
10+
- external/misra/default-disabled
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
- description: MISRA C++ 2023 (Single Translation Unit)
2+
- qlpack: codeql/misra-cpp-coding-standards
3+
- include:
4+
kind:
5+
- problem
6+
- path-problem
7+
tags contain:
8+
- scope/single-translation-unit
9+
- exclude:
10+
tags contain:
11+
- external/misra/audit
12+
- external/misra/default-disabled
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import cpp
2+
import misra.Customizations
3+
import codingstandards.cpp.CodingStandards
4+
import codingstandards.cpp.exclusions.cpp.RuleMetadata
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* Contains customizations to the MISRA C++ query rules.
3+
*
4+
* This module is imported by `misra.qll`, so any customizations defined here
5+
* automatically apply to all MISRA C++ queries.
6+
*/
7+
8+
import cpp

cpp/misra/src/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: codeql/misra-cpp-coding-standards
22
version: 2.33.0-dev
3-
description: MISRA C++ 2008
3+
description: MISRA C++ 2023
44
suites: codeql-suites
55
license: MIT
66
dependencies:

cpp/misra/test/options

Lines changed: 1 addition & 0 deletions
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

docs/design/guideline_recategorization.md

Lines changed: 1 addition & 1 deletion
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

schemas/rule-package.schema.json

Lines changed: 49 additions & 0 deletions
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,

0 commit comments

Comments
 (0)