Skip to content

Commit 6f36b1c

Browse files
Fix query metadata, format
1 parent 8a2076e commit 6f36b1c

File tree

3 files changed

+17
-15
lines changed

3 files changed

+17
-15
lines changed

c/misra/src/rules/RULE-21-26/TimedlockOnInappropriateMutexType.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @id c/misra/timedlock-on-inappropriate-mutex-type
33
* @name RULE-21-26: The Standard Library function mtx_timedlock() shall only be invoked on mutexes of type mtx_timed
44
* @description The Standard Library function mtx_timedlock() shall only be invoked on mutex objects
5-
* of appropriate mutex type
5+
* of appropriate mutex type.
66
* @kind path-problem
77
* @precision high
88
* @problem.severity error

c/misra/src/rules/RULE-9-7/UninitializedAtomicObject.ql

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@ import semmle.code.cpp.controlflow.Dominance
1818

1919
class ThreadSpawningFunction extends Function {
2020
ThreadSpawningFunction() {
21-
this.hasName("pthread_create") or
22-
this.hasName("thrd_create") or
21+
this.hasName("pthread_create")
22+
or
23+
this.hasName("thrd_create")
24+
or
2325
exists(FunctionCall fc |
2426
fc.getTarget() instanceof ThreadSpawningFunction and
25-
fc.getEnclosingFunction() = this)
27+
fc.getEnclosingFunction() = this
28+
)
2629
}
2730
}
2831

@@ -37,21 +40,20 @@ class AtomicInitAddressOfExpr extends FunctionCall {
3740
)
3841
}
3942

40-
Expr getAddressedExpr() {
41-
result = addressedExpr
42-
}
43+
Expr getAddressedExpr() { result = addressedExpr }
4344
}
4445

4546
ControlFlowNode getARequiredInitializationPoint(LocalScopeVariable v) {
4647
result = v.getParentScope().(BlockStmt).getFollowingStmt()
4748
or
4849
exists(DeclStmt decl |
4950
decl.getADeclaration() = v and
50-
result = any(FunctionCall fc
51-
| fc.getTarget() instanceof ThreadSpawningFunction and
52-
fc.getEnclosingBlock().getEnclosingBlock*() = v.getParentScope() and
53-
fc.getAPredecessor*() = decl
54-
)
51+
result =
52+
any(FunctionCall fc |
53+
fc.getTarget() instanceof ThreadSpawningFunction and
54+
fc.getEnclosingBlock().getEnclosingBlock*() = v.getParentScope() and
55+
fc.getAPredecessor*() = decl
56+
)
5557
)
5658
}
5759

@@ -63,8 +65,8 @@ where
6365
not v.isTopLevel() and
6466
not exists(v.getInitializer()) and
6567
exists(ControlFlowNode missingInitPoint |
66-
missingInitPoint = getARequiredInitializationPoint(v)
67-
and not exists(AtomicInitAddressOfExpr initialization |
68+
missingInitPoint = getARequiredInitializationPoint(v) and
69+
not exists(AtomicInitAddressOfExpr initialization |
6870
initialization.getAddressedExpr().(VariableAccess).getTarget() = v and
6971
dominates(initialization, missingInitPoint)
7072
)

rule_packages/c/Concurrency7.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
},
2727
"queries": [
2828
{
29-
"description": "The Standard Library function mtx_timedlock() shall only be invoked on mutex objects of appropriate mutex type",
29+
"description": "The Standard Library function mtx_timedlock() shall only be invoked on mutex objects of appropriate mutex type.",
3030
"kind": "path-problem",
3131
"name": "The Standard Library function mtx_timedlock() shall only be invoked on mutexes of type mtx_timed",
3232
"precision": "high",

0 commit comments

Comments
 (0)