Skip to content

Commit

Permalink
Fix query formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelRFairhurst committed Nov 1, 2024
1 parent 14b7c61 commit 3259d17
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
3 changes: 2 additions & 1 deletion c/misra/src/rules/DIR-5-2/NotNoDeadlocksBetweenThreads.ql
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import cpp
import codingstandards.c.misra
import codingstandards.cpp.rules.preventdeadlockbylockinginpredefinedorder.PreventDeadlockByLockingInPredefinedOrder

class NotNoDeadlocksBetweenThreadsQuery extends PreventDeadlockByLockingInPredefinedOrderSharedQuery {
class NotNoDeadlocksBetweenThreadsQuery extends PreventDeadlockByLockingInPredefinedOrderSharedQuery
{
NotNoDeadlocksBetweenThreadsQuery() {
this = Concurrency6Package::notNoDeadlocksBetweenThreadsQuery()
}
Expand Down
2 changes: 1 addition & 1 deletion c/misra/src/rules/DIR-5-3/ThreadCreatedByThread.ql
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ where
enclosingFunction = tc.getEnclosingFunction() and
threadRoot = enclosingFunction.getThreadRoot()
select tc, "Thread creation call reachable from threaded function '$@'.", threadRoot,
threadRoot.toString()
threadRoot.toString()
16 changes: 6 additions & 10 deletions c/misra/src/rules/RULE-21-25/InvalidMemoryOrderArgument.ql
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,13 @@ class MemoryOrderConstantExpr extends Expr {
MemoryOrder ord;

MemoryOrderConstantExpr() {
if
this instanceof MemoryOrderConstantAccess
then
ord = this.(MemoryOrderConstantAccess).getTarget()
else
ord.getIntValue() = getValue().toInt()
if this instanceof MemoryOrderConstantAccess
then ord = this.(MemoryOrderConstantAccess).getTarget()
else ord.getIntValue() = getValue().toInt()
}

/* Get the name of the `MemoryOrder` this expression is valued as. */
string getMemoryOrderString() {
result = ord.toString()
}
string getMemoryOrderString() { result = ord.toString() }
}

/**
Expand All @@ -75,7 +70,8 @@ class MemoryOrderedStdAtomicFunction extends Function {
baseParamIdx = 1 and
baseParams = 2
or
getName().regexpMatch(prefix + ["atomic_store", "atomic_fetch_.*", "atomic_exchange"] + suffix) and
getName()
.regexpMatch(prefix + ["atomic_store", "atomic_fetch_.*", "atomic_exchange"] + suffix) and
baseParamIdx = 2 and
baseParams = 3
or
Expand Down

0 comments on commit 3259d17

Please sign in to comment.