Skip to content

Commit 6169352

Browse files
Query formatting
1 parent f73df15 commit 6169352

9 files changed

+16
-14
lines changed

c/cert/src/rules/CON34-C/AppropriateThreadObjectStorageDurations.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ where
3232
(
3333
addrNode = DataFlow::exprNode(any(AddressOfExpr e | e.getOperand() = acc))
3434
or
35-
addrNode = DataFlow::exprNode(acc) and exists(ArrayToPointerConversion c | c.getExpr() = acc)
35+
addrNode = DataFlow::exprNode(acc) and
36+
exists(ArrayToPointerConversion c | c.getExpr() = acc)
3637
) and
3738
TaintTracking::localTaint(addrNode, DataFlow::exprNode(arg))
3839
)

c/cert/src/rules/DCL30-C/AppropriateStorageDurationsFunctionReturn.ql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ import codingstandards.cpp.dataflow.DataFlow
1818

1919
class Source extends Expr {
2020
ObjectIdentity rootObject;
21+
2122
Source() {
22-
rootObject.getStorageDuration().isAutomatic()
23-
and this = rootObject.getASubobjectAddressExpr()
23+
rootObject.getStorageDuration().isAutomatic() and
24+
this = rootObject.getASubobjectAddressExpr()
2425
}
2526
}
2627

c/cert/src/rules/MEM33-C/AllocStructsWithAFlexibleArrayMemberDynamically.ql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,15 @@ class FlexibleArrayStructDynamicAlloc extends FlexibleArrayAlloc, FunctionCall {
6262
*/
6363
class FlexibleArrayNonDynamicAlloc extends FlexibleArrayAlloc {
6464
ObjectIdentity object;
65+
6566
FlexibleArrayNonDynamicAlloc() {
6667
this = object and
6768
not object.getStorageDuration().isAllocated() and
6869
// Exclude temporaries. Though they should violate this rule, in practice these results are
6970
// often spurious and redundant, such as (*x = *x) which creates an unused temporary object.
7071
not object.hasTemporaryLifetime() and
71-
object.getType().getUnspecifiedType() instanceof FlexibleArrayStructType
72-
and not exists(Variable v | v.getInitializer().getExpr() = this)
72+
object.getType().getUnspecifiedType() instanceof FlexibleArrayStructType and
73+
not exists(Variable v | v.getInitializer().getExpr() = this)
7374
}
7475

7576
override Element getReportElement() { result = object }

c/common/src/codingstandards/c/UninitializedMutex.qll

Whitespace-only changes.

c/common/test/library/objects/ObjectIdentity.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ import codingstandards.c.Objects
22

33
from ObjectIdentity obj
44
where obj.getFile().getBaseName() = "objectidentity.c"
5-
select obj, obj.getStorageDuration(), obj.getType()
5+
select obj, obj.getStorageDuration(), obj.getType()

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,7 @@ Expr temporaryObjectFlowStep(Expr e) {
5858
e = result.(ConditionalExpr).getElse()
5959
}
6060

61-
from
62-
FieldAccess fa, TemporaryObjectIdentity temporary,
63-
ArrayToPointerConversion conversion
61+
from FieldAccess fa, TemporaryObjectIdentity temporary, ArrayToPointerConversion conversion
6462
where
6563
not isExcluded(conversion, InvalidMemory3Package::arrayToPointerConversionOfTemporaryObjectQuery()) and
6664
fa = temporary.getASubobjectAccess() and

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ predicate usedAsModifiableLvalue(Expr expr, Boolean allowArrayAccess) {
2626
exists(AddressOfExpr parent | parent.getOperand() = expr)
2727
or
2828
// Don't report `x.y[0].m[0]++` twice. Recurse with `allowArrayAccess` set to false.
29-
exists(FieldAccess parent | parent.getQualifier() = expr and usedAsModifiableLvalue(parent, false))
29+
exists(FieldAccess parent |
30+
parent.getQualifier() = expr and usedAsModifiableLvalue(parent, false)
31+
)
3032
or
3133
allowArrayAccess = true and
3234
exists(ArrayExpr parent | parent.getArrayBase() = expr and usedAsModifiableLvalue(parent, true))

c/misra/src/rules/RULE-22-14/MutexInitializedInsideThread.ql

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,5 @@ from C11MutexSource mutexCreate, ThreadedFunction thread
2222
where
2323
not isExcluded(mutexCreate, Concurrency8Package::mutexInitializedInsideThreadQuery()) and
2424
thread.calls*(mutexCreate.getEnclosingFunction())
25-
select
26-
mutexCreate, "Mutex initialization reachable from threaded function '$@'.",
27-
thread, thread.getName()
25+
select mutexCreate, "Mutex initialization reachable from threaded function '$@'.", thread,
26+
thread.getName()

c/misra/src/rules/RULE-22-14/MutexNotInitializedBeforeUse.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class ThreadObjectInitialization extends FunctionCall {
5050
class ThreadObjectUse extends Expr {
5151
ObjectIdentity owningObject;
5252
string typeString;
53+
5354
ThreadObjectUse() {
5455
owningObject.getASubobjectAddressExpr() = this and
5556
(
@@ -78,7 +79,6 @@ class ThreadObjectUse extends Expr {
7879
}
7980
}
8081

81-
8282
predicate requiresInitializedMutexObject(
8383
Function func, ThreadObjectUse mutexUse, ObjectIdentity owningObject
8484
) {

0 commit comments

Comments
 (0)