Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement MISRA-C clarifications from amendments3, 4, at TC2. #820

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 27 additions & 26 deletions amendments.csv
Original file line number Diff line number Diff line change
Expand Up @@ -9,41 +9,42 @@ c,MISRA-C-2012,Amendment3,RULE-10-4,Yes,Refine,No,Import
c,MISRA-C-2012,Amendment3,RULE-10-5,Yes,Expand,No,Easy
c,MISRA-C-2012,Amendment3,RULE-10-7,Yes,Refine,No,Import
c,MISRA-C-2012,Amendment3,RULE-10-8,Yes,Refine,No,Import
c,MISRA-C-2012,Amendment3,RULE-21-11,Yes,Clarification,No,Import
c,MISRA-C-2012,Amendment3,RULE-21-11,Yes,Clarification,Yes,Import
c,MISRA-C-2012,Amendment3,RULE-21-12,Yes,Replace,No,Easy
c,MISRA-C-2012,Amendment4,RULE-11-3,Yes,Expand,No,Easy
c,MISRA-C-2012,Amendment4,RULE-11-8,Yes,Expand,No,Easy
c,MISRA-C-2012,Amendment4,RULE-13-2,Yes,Expand,No,Very Hard
c,MISRA-C-2012,Amendment4,RULE-18-6,Yes,Expand,No,Medium
c,MISRA-C-2012,Amendment4,RULE-18-8,Yes,Split,Yes,Easy
c,MISRA-C-2012,Corrigendum2,RULE-2-2,Yes,Clarification,No,Import
c,MISRA-C-2012,Corrigendum2,RULE-2-7,Yes,Clarification,No,Import
c,MISRA-C-2012,Corrigendum2,RULE-3-1,Yes,Refine,No,Easy
c,MISRA-C-2012,Corrigendum2,RULE-8-6,Yes,Clarification,No,Import
c,MISRA-C-2012,Corrigendum2,RULE-8-9,Yes,Clarification,No,Import
c,MISRA-C-2012,Corrigendum2,RULE-9-4,Yes,Clarification,No,Import
c,MISRA-C-2012,Corrigendum2,RULE-10-1,Yes,Clarification,No,Import
c,MISRA-C-2012,Corrigendum2,RULE-18-3,Yes,Clarification,No,Import
c,MISRA-C-2012,Corrigendum2,RULE-1-4,Yes,Replace,No,Easy
c,MISRA-C-2012,Corrigendum2,RULE-9-1,Yes,Refine,No,Easy
c,MISRA-C-2012,Corrigendum2,RULE-9-2,Yes,Refine,No,Import
c,MISRA-C-2012,Corrigendum2,DIR-4-10,Yes,Clarification,No,Import
c,MISRA-C-2012,Amendment4,RULE-2-2,Yes,Clarification,Yes,Import
c,MISRA-C-2012,Amendment4,RULE-2-7,Yes,Clarification,Yes,Import
c,MISRA-C-2012,Amendment4,RULE-3-1,Yes,Refine,No,Easy
c,MISRA-C-2012,Amendment4,RULE-8-6,Yes,Clarification,Yes,Import
c,MISRA-C-2012,Amendment4,RULE-8-9,Yes,Clarification,Yes,Import
c,MISRA-C-2012,Amendment4,RULE-9-4,Yes,Clarification,Yes,Import
c,MISRA-C-2012,Amendment4,RULE-10-1,Yes,Clarification,Yes,Import
c,MISRA-C-2012,Amendment4,RULE-18-3,Yes,Clarification,Yes,Import
c,MISRA-C-2012,Amendment4,RULE-1-4,Yes,Replace,No,Easy
c,MISRA-C-2012,Amendment4,RULE-9-1,Yes,Refine,No,Easy
c,MISRA-C-2012,Amendment4,RULE-9-2,Yes,Refine,No,Import
c,MISRA-C-2012,Corrigendum2,DIR-4-10,Yes,Clarification,Yes,Import
c,MISRA-C-2012,Corrigendum2,RULE-7-4,Yes,Refine,No,Easy
c,MISRA-C-2012,Corrigendum2,RULE-8-2,Yes,Clarification,No,Import
c,MISRA-C-2012,Corrigendum2,RULE-8-2,Yes,Clarification,Yes,Import
c,MISRA-C-2012,Corrigendum2,RULE-8-3,Yes,Refine,No,Easy
c,MISRA-C-2012,Corrigendum2,RULE-8-7,Yes,Clarification,No,Import
c,MISRA-C-2012,Corrigendum2,RULE-8-7,Yes,Clarification,Yes,Import
c,MISRA-C-2012,Corrigendum2,RULE-10-1,Yes,Clarification,Yes,Import
c,MISRA-C-2012,Corrigendum2,RULE-10-2,Yes,Refine,No,Easy
c,MISRA-C-2012,Corrigendum2,RULE-10-3,Yes,Clarification,No,Import
c,MISRA-C-2012,Corrigendum2,RULE-11-3,Yes,Clarification,No,Import
c,MISRA-C-2012,Corrigendum2,RULE-11-6,Yes,Clarification,No,Import
c,MISRA-C-2012,Corrigendum2,RULE-13-2,Yes,Clarification,No,Import
c,MISRA-C-2012,Corrigendum2,RULE-13-6,Yes,Clarification,No,Import
c,MISRA-C-2012,Corrigendum2,RULE-10-3,Yes,Clarification,Yes,Import
c,MISRA-C-2012,Corrigendum2,RULE-11-3,Yes,Clarification,Yes,Import
c,MISRA-C-2012,Corrigendum2,RULE-11-6,Yes,Clarification,Yes,Import
c,MISRA-C-2012,Corrigendum2,RULE-13-2,Yes,Clarification,Yes,Import
c,MISRA-C-2012,Corrigendum2,RULE-13-6,Yes,Clarification,Yes,Import
c,MISRA-C-2012,Corrigendum2,RULE-14-3,Yes,Refine,No,Easy
c,MISRA-C-2012,Corrigendum2,RULE-15-7,Yes,Clarification,No,Import
c,MISRA-C-2012,Corrigendum2,RULE-17-4,Yes,Clarification,No,Import
c,MISRA-C-2012,Corrigendum2,RULE-17-5,Yes,Clarification,No,Import
c,MISRA-C-2012,Corrigendum2,RULE-15-7,Yes,Clarification,Yes,Import
c,MISRA-C-2012,Corrigendum2,RULE-17-4,Yes,Clarification,Yes,Import
c,MISRA-C-2012,Corrigendum2,RULE-17-5,Yes,Clarification,Yes,Import
c,MISRA-C-2012,Corrigendum2,RULE-18-1,Yes,Refine,No,Easy
c,MISRA-C-2012,Corrigendum2,RULE-20-14,No,Clarification,No,Import
c,MISRA-C-2012,Corrigendum2,RULE-21-19,Yes,Clarification,No,Import
c,MISRA-C-2012,Corrigendum2,RULE-20-14,No,Clarification,Yes,Import
c,MISRA-C-2012,Corrigendum2,RULE-21-19,Yes,Clarification,Yes,Import
c,MISRA-C-2012,Corrigendum2,RULE-21-20,Yes,Refine,No,Easy
c,MISRA-C-2012,Corrigendum2,RULE-22-9,Yes,Clarification,No,Import
c,MISRA-C-2012,Corrigendum2,RULE-22-9,Yes,Clarification,Yes,Import
2 changes: 1 addition & 1 deletion c/misra/src/rules/RULE-13-6/SizeofOperandWithSideEffect.ql
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @tags external/misra/id/rule-13-6
* correctness
* external/misra/c/2012/third-edition-first-revision
* external/misra/obligation/mandatory
* external/misra/obligation/required
*/

import cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @tags external/misra/id/rule-17-5
* correctness
* external/misra/c/2012/third-edition-first-revision
* external/misra/obligation/advisory
* external/misra/obligation/required
*/

import cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @tags external/misra/id/rule-21-11
* correctness
* external/misra/c/2012/third-edition-first-revision
* external/misra/obligation/required
* external/misra/obligation/advisory
*/

import cpp
Expand Down
2 changes: 1 addition & 1 deletion cpp/common/src/codingstandards/cpp/exclusions/c/Banned.qll
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ predicate isBannedQueryMetadata(Query query, string queryId, string ruleId, stri
// `@id` for the `standardHeaderFileTgmathhUsed` query
"c/misra/standard-header-file-tgmathh-used" and
ruleId = "RULE-21-11" and
category = "required"
category = "advisory"
or
query =
// `Query` instance for the `exceptionHandlingFeaturesOfFenvhUsed` query
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ predicate isContracts6QueryMetadata(Query query, string queryId, string ruleId,
// `@id` for the `arrayFunctionArgumentNumberOfElements` query
"c/misra/array-function-argument-number-of-elements" and
ruleId = "RULE-17-5" and
category = "advisory"
category = "required"
or
query =
// `Query` instance for the `valueReturnedByAFunctionNotUsed` query
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ predicate isSideEffects1QueryMetadata(Query query, string queryId, string ruleId
// `@id` for the `sizeofOperandWithSideEffect` query
"c/misra/sizeof-operand-with-side-effect" and
ruleId = "RULE-13-6" and
category = "mandatory"
category = "required"
}

module SideEffects1Package {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@
<permit-id>DP2</permit-id>
</deviations-entry>
<deviations-entry>
<rule-id>RULE-13-6</rule-id>
<query-id>c/misra/sizeof-operand-with-side-effect</query-id>
<rule-id>RULE-9-1</rule-id>
<query-id>c/misra/object-with-auto-storage-duration-read-before-init</query-id>
</deviations-entry>
</deviations>
<deviation-permits>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ deviations:
permit-id: non-existing-permit
- permit-id: DP1
- permit-id: DP2
- rule-id: RULE-13-6
query-id: c/misra/sizeof-operand-with-side-effect
- rule-id: RULE-9-1
query-id: c/misra/object-with-auto-storage-duration-read-before-init
deviation-permits:
- permit-id: DP1
justification: foo bar baz
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
| invalid/coding-standards.xml:5:7:8:43 | guideline-recategorizations-entry | guideline_recategorizations/invalid/coding-standards.xml: 'Invalid recategorization from 'required' to 'advisory'.' for rule A0-1-1. |
| invalid/coding-standards.xml:9:7:12:43 | guideline-recategorizations-entry | guideline_recategorizations/invalid/coding-standards.xml: 'Invalid recategorization from 'required' to 'disapplied'.' for rule A0-1-2. |
| invalid/coding-standards.xml:13:7:16:43 | guideline-recategorizations-entry | guideline_recategorizations/invalid/coding-standards.xml: 'Unknown rule id 'A1-4-3'.' for rule A1-4-3. |
| invalid/coding-standards.xml:17:7:20:43 | guideline-recategorizations-entry | guideline_recategorizations/invalid/coding-standards.xml: 'Invalid recategorization from 'mandatory' to 'required'.' for rule RULE-13-6. |
| invalid/coding-standards.xml:17:7:20:43 | guideline-recategorizations-entry | guideline_recategorizations/invalid/coding-standards.xml: 'Invalid recategorization from 'mandatory' to 'required'.' for rule RULE-9-1. |
| invalid/coding-standards.xml:21:7:24:43 | guideline-recategorizations-entry | guideline_recategorizations/invalid/coding-standards.xml: 'Invalid recategorization from 'rule' to 'required'.' for rule CON50-CPP. |
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
| A10-4-1 | advisory | required |
| A11-0-1 | advisory | mandatory |
| CON50-CPP | rule | required |
| RULE-13-6 | mandatory | required |
| RULE-9-1 | mandatory | required |
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<category>mandatory</category>
</guideline-recategorizations-entry>
<guideline-recategorizations-entry>
<rule-id>RULE-13-6</rule-id>
<rule-id>RULE-9-1</rule-id>
<category>required</category>
</guideline-recategorizations-entry>
<guideline-recategorizations-entry>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ guideline-recategorizations:
category: "disapplied"
- rule-id: "A1-4-3"
category: "mandatory"
- rule-id: "RULE-13-6"
- rule-id: "RULE-9-1"
category: "required"
- rule-id: "CON50-CPP"
category: "required"
2 changes: 1 addition & 1 deletion rule_packages/c/Banned.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
},
"RULE-21-11": {
"properties": {
"obligation": "required"
"obligation": "advisory"
},
"queries": [
{
Expand Down
2 changes: 1 addition & 1 deletion rule_packages/c/Contracts6.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"MISRA-C-2012": {
"RULE-17-5": {
"properties": {
"obligation": "advisory"
"obligation": "required"
},
"queries": [
{
Expand Down
2 changes: 1 addition & 1 deletion rule_packages/c/Pointers1.json
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@
]
}
],
"title": "The relational operators >, >=, < and <= shall not be applied to objects of pointer type except where they point into the same object"
"title": "The relational operators >, >=, < and <= shall not be applied to expressions of pointer type except where they point into the same object"
},
"RULE-18-4": {
"properties": {
Expand Down
2 changes: 1 addition & 1 deletion rule_packages/c/SideEffects1.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
},
"RULE-13-6": {
"properties": {
"obligation": "mandatory"
"obligation": "required"
},
"queries": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ deviations:
permit-id: non-existing-permit
- permit-id: DP1
- permit-id: DP2
- rule-id: RULE-13-6
query-id: c/misra/sizeof-operand-with-side-effect
- rule-id: RULE-9-1
query-id: c/misra/object-with-auto-storage-duration-read-before-init
deviation-permits:
- permit-id: DP1
justification: foo bar baz
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
| A0-1-1 | required | advisory |
| A0-1-1 | required | mandatory |
| A0-1-2 | required | disapplied |
| RULE-13-6 | mandatory | required |
| RULE-9-1 | mandatory | required |
| CON50-CPP | rule | required |
| A0-1-6 | advisory | disapplied |
| A10-4-1 | advisory | required |
Expand All @@ -25,5 +25,5 @@
| invalid/coding-standards.xml:5:7:8:43 | 'Invalid recategorization from 'required' to 'advisory'.' for rule A0-1-1. |
| invalid/coding-standards.xml:9:7:12:43 | 'Invalid recategorization from 'required' to 'disapplied'.' for rule A0-1-2. |
| invalid/coding-standards.xml:13:7:16:43 | 'Unknown rule id 'A1-4-3'.' for rule A1-4-3. |
| invalid/coding-standards.xml:17:7:20:43 | 'Invalid recategorization from 'mandatory' to 'required'.' for rule RULE-13-6. |
| invalid/coding-standards.xml:17:7:20:43 | 'Invalid recategorization from 'mandatory' to 'required'.' for rule RULE-9-1. |
| invalid/coding-standards.xml:21:7:24:43 | 'Invalid recategorization from 'rule' to 'required'.' for rule CON50-CPP. |
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ guideline-recategorizations:
category: "disapplied"
- rule-id: "A1-4-3"
category: "mandatory"
- rule-id: "RULE-13-6"
- rule-id: "RULE-9-1"
category: "required"
- rule-id: "CON50-CPP"
category: "required"
Loading