Skip to content

Commit 5b5777f

Browse files
Fix formatting
1 parent dd475be commit 5b5777f

File tree

5 files changed

+17
-19
lines changed

5 files changed

+17
-19
lines changed

c/misra/src/rules/RULE-18-10/PointersToVariablyModifiedArrayTypesUsed.ql

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ import codingstandards.cpp.VariablyModifiedTypes
2222
* Check that the declaration entry, which may be a parameter or a variable
2323
* etc., seems to subsume the location of `inner`, including the declaration
2424
* type text.
25-
*
25+
*
2626
* The location of the `DeclarationEntry` itself points to the _identifier_
2727
* that is declared. This range will not include the type of the declaration.
28-
*
28+
*
2929
* For parameters, the `before` and `end` `Location` objects will be
3030
* constrained to the closest earlier element (parameter or function body),
3131
* these values can therefore be captured and inspected for debugging.
32-
*
32+
*
3333
* For declarations which occur in statements, the `before` and `end`
3434
* `Location` objects will be both constrained to be equal, and equal to,
3535
* the `Location` of the containing `DeclStmt`.
@@ -71,7 +71,6 @@ predicate declarationSubsumes(
7171
class InvalidDeclaration extends DeclarationEntry {
7272
Expr sizeExpr;
7373
CandidateVlaType vlaType;
74-
7574
// `before` and `after` are captured for debugging, see doc comment for
7675
// `declarationSubsumes`.
7776
Location before;
@@ -84,9 +83,9 @@ class InvalidDeclaration extends DeclarationEntry {
8483
if this instanceof ParameterDeclarationEntry
8584
then vlaType = this.getType().(VariablyModifiedTypeIfAdjusted).getInnerVlaType()
8685
else vlaType = this.getType().(VariablyModifiedTypeIfUnadjusted).getInnerVlaType()
87-
)
86+
) and
8887
// Capture only pointers to VLA types, not raw VLA types.
89-
and not vlaType = this.getType()
88+
not vlaType = this.getType()
9089
}
9190

9291
Expr getSizeExpr() { result = sizeExpr }

c/misra/src/rules/RULE-18-9/ModifiableLValueSubscriptedWithTemporaryLifetime.ql

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ predicate usedAsModifiableLvalue(Expr expr) {
4545
exists(AddressOfExpr parent | parent.getOperand() = expr)
4646
or
4747
exists(FieldAccess parent | parent.getQualifier() = expr and usedAsModifiableLvalue(parent))
48-
4948
}
5049

5150
from TemporaryLifetimeArrayExpr expr, TemporaryLifetimeArrayAccess member

c/misra/test/rules/RULE-18-10/PointersToVariablyModifiedArrayTypesUsed.expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
| test.c:25:13:25:15 | definition of p10 | Parameter p10 is declared with variably-modified type, with inner variable length array of non constant size $@ and element type 'int *' | test.c:25:18:25:19 | p0 | p0 |
88
| test.c:28:12:28:14 | definition of p11 | Parameter p11 is adjusted to variably-modified type, with inner variable length array of non constant size $@ and element type 'int' | test.c:28:21:28:22 | p0 | p0 |
99
| test.c:32:17:32:19 | definition of p13 | Parameter p13 is declared with variably-modified type, pointer to variable length array of non constant size $@ and element type 'const int' | test.c:32:22:32:23 | p0 | p0 |
10-
| test.c:33:18:33:20 | definition of p14 | Parameter p14 is declared with variably-modified type, with inner variable length array of non constant size $@ and element type 'int' | test.c:33:23:33:24 | p0 | p0 |
10+
| test.c:33:17:33:19 | definition of p14 | Parameter p14 is declared with variably-modified type, with inner variable length array of non constant size $@ and element type 'int' | test.c:33:22:33:23 | p0 | p0 |
1111
| test.c:40:12:40:14 | definition of p17 | Parameter p17 is declared with variably-modified type, with inner variable length array of non constant size $@ and element type 'int' | test.c:40:24:40:25 | p0 | p0 |
1212
| test.c:41:14:41:16 | definition of p18 | Parameter p18 is declared with variably-modified type, with inner variable length array of non constant size $@ and element type 'int' | test.c:41:27:41:28 | p0 | p0 |
1313
| test.c:68:9:68:11 | definition of p27 | Parameter p27 is adjusted to variably-modified type, with inner variable length array of non constant size $@ and element type 'int' | test.c:68:13:68:14 | p0 | p0 |
1414
| test.c:68:9:68:11 | definition of p27 | Parameter p27 is adjusted to variably-modified type, with inner variable length array of non constant size $@ and element type 'int' | test.c:68:17:68:18 | p0 | p0 |
1515
| test.c:74:8:74:9 | definition of l3 | Variable l3 is declared with variably-modified type, pointer to variable length array of non constant size $@ and element type 'int' | test.c:74:12:74:13 | p0 | p0 |
1616
| test.c:79:15:79:16 | definition of l4 | Variable l4 is declared with variably-modified type, pointer to variable length array of non constant size $@ and element type 'int' | test.c:79:19:79:20 | p0 | p0 |
17-
| test.c:84:17:84:19 | declaration of td3 | Declaration td3 is declared with variably-modified type, with inner variable length array of non constant size $@ and element type 'int' | test.c:84:22:84:23 | p0 | p0 |
17+
| test.c:84:16:84:18 | declaration of td3 | Declaration td3 is declared with variably-modified type, with inner variable length array of non constant size $@ and element type 'int' | test.c:84:21:84:22 | p0 | p0 |

c/misra/test/rules/RULE-18-10/test.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ void f1(
2121

2222
// Types referring to pointers to VMTs:
2323
// - pointer to pointer to VMT
24-
int(*(*p9)[p0]), // NON-COMPLIANT
24+
int(*(*p9)[p0]), // NON-COMPLIANT
2525
int(*(**p10)[p0]), // NON-COMPLIANT
2626

2727
// - array of pointers to VMT
2828
int (*(p11[3]))[p0], // NON-COMPLIANT
2929

3030
// - const VMTs, const array-to-pointer adjustment
31-
const int p12[p0], // COMPLIANT
32-
const int (*p13)[p0], // NON-COMPLIANT
33-
int (* const p14)[p0], // NON-COMPLIANT
31+
const int p12[p0], // COMPLIANT
32+
const int (*p13)[p0], // NON-COMPLIANT
33+
int (*const p14)[p0], // NON-COMPLIANT
3434

3535
// - function types with argument that is a pointer to a VMT
3636
int p15(int (*inner)[p0]), // NON-COMPLIANT[FALSE_NEGATIVE]
@@ -58,7 +58,7 @@ void f1(
5858

5959
// Unknown array length types:
6060
int p21[], // COMPLIANT
61-
int p22[][], // COMPLIANT
61+
int p22[][], // COMPLIANT
6262
int (*p23)[], // COMPLIANT
6363
int (*p24)[2][], // COMPLIANT
6464
int (*p25)[][2], // COMPLIANT
@@ -68,7 +68,7 @@ void f1(
6868
int p27[p0][p0] // NON-COMPLIANT
6969
) {
7070
// Local variables may contain pointers to VMTs:
71-
int l0[p0]; // COMPLIANT
71+
int l0[p0]; // COMPLIANT
7272
int(*l1)[]; // COMPLIANT
7373
int(*l2)[3]; // COMPLIANT
7474
int(*l3)[p0]; // NON-COMPLIANT
@@ -79,9 +79,9 @@ void f1(
7979
static int(*l4)[p0]; // NON-COMPLIANT
8080

8181
// Block scope typedefs may refer to VMTs
82-
typedef int (*td1)[3]; // COMPLIANT
83-
typedef int (*td2)[]; // COMPLIANT
84-
typedef int (*td3)[p0]; // NON-COMPLIANT
82+
typedef int(*td1)[3]; // COMPLIANT
83+
typedef int(*td2)[]; // COMPLIANT
84+
typedef int(*td3)[p0]; // NON-COMPLIANT
8585

8686
td3 l5; // NON-COMPLIANT
8787
}

cpp/common/src/codingstandards/cpp/Clvalues.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ predicate isCLValue(Expr expr) {
1414
not expr instanceof AssignExpr and
1515
not expr instanceof CommaExpr and
1616
not exists(Cast c | c = expr.getConversion*())
17-
}
17+
}

0 commit comments

Comments
 (0)