Skip to content

Commit

Permalink
[static-ctor-stall] Rename the issue type
Browse files Browse the repository at this point in the history
Summary: Making the name of the issue type more general.

Reviewed By: ngorogiannis

Differential Revision: D66756711

fbshipit-source-id: 8c45b2f5e7a4c1edb707d6f5c3fddd96a0530f72
  • Loading branch information
dulmarod authored and facebook-github-bot committed Dec 4, 2024
1 parent 19264a6 commit 4727b67
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion infer/man/man1/infer-full.txt
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,6 @@ OPTIONS
DATA_FLOW_TO_SINK (disabled by default),
DEADLOCK (enabled by default),
DEAD_STORE (enabled by default),
DISPATCH_ONCE_IN_STATIC_INIT (disabled by default),
DIVIDE_BY_ZERO (disabled by default),
DO_NOT_REPORT (enabled by default),
EMPTY_VECTOR_ACCESS (enabled by default),
Expand Down Expand Up @@ -747,6 +746,7 @@ OPTIONS
SKIP_FUNCTION (disabled by default),
STACK_VARIABLE_ADDRESS_ESCAPE (enabled by default),
STARVATION (enabled by default),
STATIC_CONSTRUCTOR_STALL (disabled by default),
STATIC_INITIALIZATION_ORDER_FIASCO (enabled by default),
STRICT_MODE_VIOLATION (enabled by default),
STRONG_SELF_NOT_CHECKED (enabled by default),
Expand Down
2 changes: 1 addition & 1 deletion infer/man/man1/infer-report.txt
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ OPTIONS
DATA_FLOW_TO_SINK (disabled by default),
DEADLOCK (enabled by default),
DEAD_STORE (enabled by default),
DISPATCH_ONCE_IN_STATIC_INIT (disabled by default),
DIVIDE_BY_ZERO (disabled by default),
DO_NOT_REPORT (enabled by default),
EMPTY_VECTOR_ACCESS (enabled by default),
Expand Down Expand Up @@ -262,6 +261,7 @@ OPTIONS
SKIP_FUNCTION (disabled by default),
STACK_VARIABLE_ADDRESS_ESCAPE (enabled by default),
STARVATION (enabled by default),
STATIC_CONSTRUCTOR_STALL (disabled by default),
STATIC_INITIALIZATION_ORDER_FIASCO (enabled by default),
STRICT_MODE_VIOLATION (enabled by default),
STRONG_SELF_NOT_CHECKED (enabled by default),
Expand Down
2 changes: 1 addition & 1 deletion infer/man/man1/infer.txt
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,6 @@ OPTIONS
DATA_FLOW_TO_SINK (disabled by default),
DEADLOCK (enabled by default),
DEAD_STORE (enabled by default),
DISPATCH_ONCE_IN_STATIC_INIT (disabled by default),
DIVIDE_BY_ZERO (disabled by default),
DO_NOT_REPORT (enabled by default),
EMPTY_VECTOR_ACCESS (enabled by default),
Expand Down Expand Up @@ -747,6 +746,7 @@ OPTIONS
SKIP_FUNCTION (disabled by default),
STACK_VARIABLE_ADDRESS_ESCAPE (enabled by default),
STARVATION (enabled by default),
STATIC_CONSTRUCTOR_STALL (disabled by default),
STATIC_INITIALIZATION_ORDER_FIASCO (enabled by default),
STRICT_MODE_VIOLATION (enabled by default),
STRONG_SELF_NOT_CHECKED (enabled by default),
Expand Down
11 changes: 6 additions & 5 deletions infer/src/base/IssueType.ml
Original file line number Diff line number Diff line change
Expand Up @@ -571,12 +571,13 @@ let deadlock =
~user_documentation:[%blob "./documentation/issues/DEADLOCK.md"]


let dispatch_once_in_static_init =
register ~category:Concurrency ~enabled:false ~id:"DISPATCH_ONCE_IN_STATIC_INIT"
~hum:"dispatch_once in static init" Error StaticConstructorStallChecker
let static_constructor_stall =
register ~category:Concurrency ~enabled:false ~id:"STATIC_CONSTRUCTOR_STALL" Error
StaticConstructorStallChecker
~user_documentation:
"Calling dispatch_once during the static initialization of objects is risky, for example it \
could cause deadlocks, because other objects might not have been initialized yet."
"Calling certain methods, for instance dispatch_once, during the static initialization of \
objects is risky. It could cause deadlocks, because other objects might not have been \
initialized yet."


let divide_by_zero =
Expand Down
2 changes: 1 addition & 1 deletion infer/src/base/IssueType.mli
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ val dead_store : t

val deadlock : t

val dispatch_once_in_static_init : t
val static_constructor_stall : t

val divide_by_zero : t

Expand Down
4 changes: 2 additions & 2 deletions infer/src/checkers/StaticConstructorStallChecker.ml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module TransferFunctions = struct

type analysis_data = Summary.t InterproceduralAnalysis.t

let pp_session_name _node fmt = F.pp_print_string fmt "DispatchOnceStaticInit"
let pp_session_name _node fmt = F.pp_print_string fmt "StaticConstructorStallChecker"

let exec_instr (astate : Summary.t) {InterproceduralAnalysis.analyze_dependency} _cfg_node _
(instr : Sil.instr) =
Expand Down Expand Up @@ -88,7 +88,7 @@ let report_issue proc_desc err_log trace_elems =
(kind_to_string kind) Location.pp loc
in
Reporting.log_issue proc_desc err_log ~ltr ~loc StaticConstructorStallChecker
IssueType.dispatch_once_in_static_init message
IssueType.static_constructor_stall message


let checker ({InterproceduralAnalysis.proc_desc; err_log} as analysis_data) =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
codetoanalyze/objc/static-constructor-stall/DispatchOnceInStaticInit.m, initializer_test_interproc_bad, 1, DISPATCH_ONCE_IN_STATIC_INIT, no_bucket, ERROR, [Call to Manager.getInstance,macro expanded here,Call to _dispatch_once]
codetoanalyze/objc/static-constructor-stall/DispatchOnceInStaticInit.m, initializer_test_intraproc_bad, 3, DISPATCH_ONCE_IN_STATIC_INIT, no_bucket, ERROR, [macro expanded here,Call to _dispatch_once]
codetoanalyze/objc/static-constructor-stall/DispatchOnceInStaticInit.m, initializer_test_interproc_condition_bad, 3, DISPATCH_ONCE_IN_STATIC_INIT, no_bucket, ERROR, [Call to Manager.getInstance,macro expanded here,Call to _dispatch_once]
codetoanalyze/objc/static-constructor-stall/DispatchOnceInStaticInit.m, initializer_test_interproc_bad, 1, STATIC_CONSTRUCTOR_STALL, no_bucket, ERROR, [Call to Manager.getInstance,macro expanded here,Call to _dispatch_once]
codetoanalyze/objc/static-constructor-stall/DispatchOnceInStaticInit.m, initializer_test_intraproc_bad, 3, STATIC_CONSTRUCTOR_STALL, no_bucket, ERROR, [macro expanded here,Call to _dispatch_once]
codetoanalyze/objc/static-constructor-stall/DispatchOnceInStaticInit.m, initializer_test_interproc_condition_bad, 3, STATIC_CONSTRUCTOR_STALL, no_bucket, ERROR, [Call to Manager.getInstance,macro expanded here,Call to _dispatch_once]

0 comments on commit 4727b67

Please sign in to comment.