Skip to content

Commit c91971c

Browse files
committed
Apply suggestions from Copilot
1 parent f3fdbea commit c91971c

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

cpp/common/src/codingstandards/cpp/rules/objectassignedtoanoverlappingobject/ObjectAssignedToAnOverlappingObject.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ query predicate problems(
5959
*/
6060

6161
exists(Expr lhs, Expr rhs |
62+
not isExcluded(assignExpr, getQuery()) and
6263
lhs.getType() instanceof Union and
6364
rhs.getType() instanceof Union and
6465
lhs = getAQualifier(assignExpr.getLValue()) and

cpp/misra/src/rules/RULE-8-18-1/ObjectAssignedToAnOverlappingObjectMisraCpp.ql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @id cpp/misra/object-assigned-to-an-overlapping-object-misra-cpp
33
* @name RULE-8-18-1: A member of a union must not be copied to its another member
4-
* @description Copying a member of a union to another causes undefined behavior.
4+
* @description Copying a member of a union to another member causes undefined behavior.
55
* @kind problem
66
* @precision high
77
* @problem.severity error
@@ -16,7 +16,8 @@ import cpp
1616
import codingstandards.cpp.misra
1717
import codingstandards.cpp.rules.objectassignedtoanoverlappingobject.ObjectAssignedToAnOverlappingObject
1818

19-
class ObjectAssignedToAnOverlappingObjectMisraCppQuery extends ObjectAssignedToAnOverlappingObjectSharedQuery {
19+
class ObjectAssignedToAnOverlappingObjectMisraCppQuery extends ObjectAssignedToAnOverlappingObjectSharedQuery
20+
{
2021
ObjectAssignedToAnOverlappingObjectMisraCppQuery() {
2122
this = Memory4Package::objectAssignedToAnOverlappingObjectMisraCppQuery()
2223
}

cpp/misra/src/rules/RULE-8-18-1/ObjectCopiedToAnOverlappingObjectMisraCpp.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @id cpp/misra/object-copied-to-an-overlapping-object-misra-cpp
3-
* @name RULE-8-18-1: An slice of an array must not be copied to an overlapping region of itself
3+
* @name RULE-8-18-1: A slice of an array must not be copied to an overlapping region of itself
44
* @description Copying a slice of an array to an overlapping region of the same array causes
55
* undefined behavior.
66
* @kind problem

rule_packages/cpp/Memory4.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
},
88
"queries": [
99
{
10-
"description": "Copying a member of a union to another causes undefined behavior.",
10+
"description": "Copying a member of a union to another member causes undefined behavior.",
1111
"kind": "problem",
1212
"name": "A member of a union must not be copied to its another member",
1313
"precision": "high",
@@ -22,7 +22,7 @@
2222
{
2323
"description": "Copying a slice of an array to an overlapping region of the same array causes undefined behavior.",
2424
"kind": "problem",
25-
"name": "An slice of an array must not be copied to an overlapping region of itself",
25+
"name": "A slice of an array must not be copied to an overlapping region of itself",
2626
"precision": "high",
2727
"severity": "error",
2828
"short_name": "ObjectCopiedToAnOverlappingObjectMisraCpp",

0 commit comments

Comments
 (0)