Skip to content

Commit f0a7764

Browse files
committed
Add "shared_implementation_short_name" and check in all files
1 parent e0362b7 commit f0a7764

File tree

6 files changed

+78
-0
lines changed

6 files changed

+78
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//** THIS FILE IS AUTOGENERATED, DO NOT MODIFY DIRECTLY. **/
2+
import cpp
3+
import RuleMetadata
4+
import codingstandards.cpp.exclusions.RuleMetadata
5+
6+
newtype Memory3Query = TPointerComparedBetweenDifferentArraysQuery()
7+
8+
predicate isMemory3QueryMetadata(Query query, string queryId, string ruleId, string category) {
9+
query =
10+
// `Query` instance for the `pointerComparedBetweenDifferentArrays` query
11+
Memory3Package::pointerComparedBetweenDifferentArraysQuery() and
12+
queryId =
13+
// `@id` for the `pointerComparedBetweenDifferentArrays` query
14+
"cpp/misra/pointer-compared-between-different-arrays" and
15+
ruleId = "RULE-8-9-1" and
16+
category = "required"
17+
}
18+
19+
module Memory3Package {
20+
Query pointerComparedBetweenDifferentArraysQuery() {
21+
//autogenerate `Query` type
22+
result =
23+
// `Query` type for `pointerComparedBetweenDifferentArrays` query
24+
TQueryCPP(TMemory3PackageQuery(TPointerComparedBetweenDifferentArraysQuery()))
25+
}
26+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* @id cpp/misra/pointer-compared-between-different-arrays
3+
* @name RULE-8-9-1: The built-in relational operators >, >=, < and <= shall not be applied to objects of pointer type
4+
* @description Pointer comparison should be done between ones that belong to a same array.
5+
* @kind problem
6+
* @precision very-high
7+
* @problem.severity error
8+
* @tags external/misra/id/rule-8-9-1
9+
* scope/system
10+
* external/misra/enforcement/undecidable
11+
* external/misra/obligation/required
12+
*/
13+
14+
import cpp
15+
import codingstandards.cpp.misra
16+
import codingstandards.cpp.rules.donotuserelationaloperatorswithdifferingarrays.DoNotUseRelationalOperatorsWithDifferingArrays
17+
18+
class PointerComparedBetweenDifferentArraysQuery extends DoNotUseRelationalOperatorsWithDifferingArraysSharedQuery
19+
{
20+
PointerComparedBetweenDifferentArraysQuery() {
21+
this = Memory3Package::pointerComparedBetweenDifferentArraysQuery()
22+
}
23+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
No expected results have yet been specified
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rules/RULE-8-9-1/PointerComparedBetweenDifferentArrays.ql

rule_packages/cpp/Memory2.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"precision": "very-high",
1414
"severity": "error",
1515
"short_name": "PointerDifferenceTakenBetweenDifferentArrays",
16+
"shared_implementation_short_name": "DoNotSubtractPointersAddressingDifferentArrays",
1617
"tags": [
1718
"scope/system"
1819
]

rule_packages/cpp/Memory3.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"MISRA-C++-2023": {
3+
"RULE-8-9-1": {
4+
"properties": {
5+
"enforcement": "undecidable",
6+
"obligation": "required"
7+
},
8+
"queries": [
9+
{
10+
"description": "Pointer comparison should be done between ones that belong to a same array.",
11+
"kind": "problem",
12+
"name": "The built-in relational operators >, >=, < and <= shall not be applied to objects of pointer type",
13+
"precision": "very-high",
14+
"severity": "error",
15+
"short_name": "PointerComparedBetweenDifferentArrays",
16+
"shared_implementation_short_name": "DoNotUseRelationalOperatorsWithDifferingArrays",
17+
"shared_implementation_short_name": "",
18+
"tags": [
19+
"scope/system"
20+
]
21+
}
22+
],
23+
"title": "Pointer comparison should be done between ones that belong to a same array."
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)