From 047bb6796a59034567e36e2887b75011a3201d2d Mon Sep 17 00:00:00 2001 From: Jeremy Dubreil Date: Wed, 15 Mar 2017 22:58:50 -0700 Subject: [PATCH] [infer][threadsafety] Run ThreadSafety as part of the checkers Summary: Now, running `infer -a checkers -- ...` will also run the ThreadSafety checker Reviewed By: sblackshear Differential Revision: D4691330 fbshipit-source-id: 04fc781 --- infer/src/checkers/registerCheckers.ml | 17 ++++++++--------- .../codetoanalyze/java/threadsafety/Makefile | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/infer/src/checkers/registerCheckers.ml b/infer/src/checkers/registerCheckers.ml index 950c77946..43f8c17cf 100644 --- a/infer/src/checkers/registerCheckers.ml +++ b/infer/src/checkers/registerCheckers.ml @@ -16,7 +16,6 @@ module F = Format (** Flags to activate checkers. *) let active_procedure_checkers () = - let checkers_enabled = Config.checkers_enabled in let java_checkers = let l = @@ -29,18 +28,18 @@ let active_procedure_checkers () = Checkers.callback_find_deserialization, false; CheckTraceCallSequence.callback_check_trace_call_sequence, false; Dataflow.callback_test_dataflow, false; - FragmentRetainsViewChecker.callback_fragment_retains_view, checkers_enabled; + FragmentRetainsViewChecker.callback_fragment_retains_view, Config.checkers_enabled; SqlChecker.callback_sql, false; Eradicate.callback_eradicate, Config.eradicate; BoundedCallTree.checker, Config.crashcontext; JavaTaintAnalysis.checker, Config.quandary; Checkers.callback_check_field_access, false; - ImmutableChecker.callback_check_immutable_cast, checkers_enabled; - RepeatedCallsChecker.callback_check_repeated_calls, checkers_enabled; - PrintfArgs.callback_printf_args, checkers_enabled; - AnnotationReachability.checker, checkers_enabled; + ImmutableChecker.callback_check_immutable_cast, Config.checkers_enabled; + RepeatedCallsChecker.callback_check_repeated_calls, Config.checkers_enabled; + PrintfArgs.callback_printf_args, Config.checkers_enabled; + AnnotationReachability.checker, Config.checkers_enabled; BufferOverrunChecker.checker, Config.bufferoverrun; - ThreadSafety.checker, Config.threadsafety; + ThreadSafety.checker, Config.threadsafety || Config.checkers_enabled; ] in (* make sure SimpleChecker.ml is not dead code *) if false then (let module SC = SimpleChecker.Make in ()); @@ -52,7 +51,7 @@ let active_procedure_checkers () = CheckDeadCode.callback_check_dead_code, false; Checkers.callback_print_access_to_globals, false; ClangTaintAnalysis.checker, Config.quandary; - Siof.checker, checkers_enabled; + Siof.checker, Config.checkers_enabled; BufferOverrunChecker.checker, Config.bufferoverrun; ] in List.map ~f:(fun (x, y) -> (x, y, Some Config.Clang)) l in @@ -61,7 +60,7 @@ let active_procedure_checkers () = let active_cluster_checkers () = [(Checkers.callback_check_cluster_access, false, Some Config.Java); - (ThreadSafety.file_analysis, Config.threadsafety, Some Config.Java) + (ThreadSafety.file_analysis, Config.threadsafety || Config.checkers_enabled, Some Config.Java) ] let register () = diff --git a/infer/tests/codetoanalyze/java/threadsafety/Makefile b/infer/tests/codetoanalyze/java/threadsafety/Makefile index 39be70c0b..c6f9135f2 100644 --- a/infer/tests/codetoanalyze/java/threadsafety/Makefile +++ b/infer/tests/codetoanalyze/java/threadsafety/Makefile @@ -7,7 +7,7 @@ TESTS_DIR = ../../.. -ANALYZER = threadsafety +ANALYZER = checkers INFER_OPTIONS = --no-filtering --debug-exceptions INFERPRINT_OPTIONS = --issues-tests SOURCES = $(wildcard *.java)