Skip to content

Commit 9243c93

Browse files
committed
work
1 parent f8ed9b7 commit 9243c93

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

cpp/common/src/codingstandards/cpp/Concurrency.qll

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,3 +806,22 @@ class ConditionalFunction extends Function {
806806
exists(ConditionalVariable cv | cv.getAnAccess().getEnclosingFunction() = this)
807807
}
808808
}
809+
810+
/**
811+
* Models calls to thread specific storage function calls.
812+
*/
813+
abstract class ThreadSpecificStorageFunctionCall extends FunctionCall { }
814+
815+
/**
816+
* Models calls to `tss_get`.
817+
*/
818+
class TSSGetFunctionCall extends ThreadSpecificStorageFunctionCall {
819+
TSSGetFunctionCall() { getTarget().getName() = "tss_get" }
820+
}
821+
822+
/**
823+
* Models calls to `tss_set`.
824+
*/
825+
class TSSSetFunctionCall extends ThreadSpecificStorageFunctionCall {
826+
TSSSetFunctionCall() { getTarget().getName() = "tss_set" }
827+
}

cpp/common/src/codingstandards/cpp/exclusions/c/Concurrency4.qll

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import codingstandards.cpp.exclusions.RuleMetadata
66
newtype Concurrency4Query =
77
TCleanUpThreadSpecificStorageQuery() or
88
TAppropriateThreadObjectStorageDurationsQuery() or
9+
TThreadObjectStorageDurationsNotInitializedQuery() or
910
TThreadWasPreviouslyJoinedOrDetachedQuery() or
1011
TDoNotReferToAnAtomicVariableTwiceInExpressionQuery()
1112

@@ -26,6 +27,14 @@ predicate isConcurrency4QueryMetadata(Query query, string queryId, string ruleId
2627
"c/cert/appropriate-thread-object-storage-durations" and
2728
ruleId = "CON34-C"
2829
or
30+
query =
31+
// `Query` instance for the `threadObjectStorageDurationsNotInitialized` query
32+
Concurrency4Package::threadObjectStorageDurationsNotInitializedQuery() and
33+
queryId =
34+
// `@id` for the `threadObjectStorageDurationsNotInitialized` query
35+
"c/cert/thread-object-storage-durations-not-initialized" and
36+
ruleId = "CON34-C"
37+
or
2938
query =
3039
// `Query` instance for the `threadWasPreviouslyJoinedOrDetached` query
3140
Concurrency4Package::threadWasPreviouslyJoinedOrDetachedQuery() and
@@ -58,6 +67,13 @@ module Concurrency4Package {
5867
TQueryC(TConcurrency4PackageQuery(TAppropriateThreadObjectStorageDurationsQuery()))
5968
}
6069

70+
Query threadObjectStorageDurationsNotInitializedQuery() {
71+
//autogenerate `Query` type
72+
result =
73+
// `Query` type for `threadObjectStorageDurationsNotInitialized` query
74+
TQueryC(TConcurrency4PackageQuery(TThreadObjectStorageDurationsNotInitializedQuery()))
75+
}
76+
6177
Query threadWasPreviouslyJoinedOrDetachedQuery() {
6278
//autogenerate `Query` type
6379
result =

0 commit comments

Comments
 (0)