-
Notifications
You must be signed in to change notification settings - Fork 76
Expand file tree
/
Copy pathBannedDynamicThreadCreation.ql
More file actions
29 lines (27 loc) · 1.02 KB
/
BannedDynamicThreadCreation.ql
File metadata and controls
29 lines (27 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
* @id c/misra/banned-dynamic-thread-creation
* @name DIR-5-3: There shall be no dynamic thread creation
* @description Creating threads outside of a well-defined program start-up phase creates
* uncertainty in program behavior and concurrency overhead costs.
* @kind problem
* @precision low
* @problem.severity error
* @tags external/misra/id/dir-5-3
* external/misra/c/2012/amendment4
* external/misra/c/audit
* correctness
* maintainability
* concurrency
* performance
* external/misra/obligation/required
*/
import cpp
import codingstandards.c.misra
import codingstandards.cpp.Concurrency
from CThreadCreateCall tc, Function enclosingFunction
where
not isExcluded(tc, Concurrency6Package::bannedDynamicThreadCreationQuery()) and
enclosingFunction = tc.getEnclosingFunction() and
not enclosingFunction.getName() = "main"
select tc, "Possible dynamic creation of thread outside initialization in function '$@'.",
enclosingFunction, enclosingFunction.toString()