From 8064ac2614e7abefd55e89f4d98032f59a720c5d Mon Sep 17 00:00:00 2001 From: Jeremy Dubreil Date: Sun, 7 May 2017 19:56:17 -0700 Subject: [PATCH] [infer][checkers] remove the siof analyzer option and rely on the --siof flag only Summary: The Siof checkers can now be run with: infer -a checkers --siof -- ... and also runs by default using: infer -a checkers -- ... Reviewed By: jberdine Differential Revision: D5009731 fbshipit-source-id: e0e2168 --- infer/src/backend/InferPrint.re | 1 - infer/src/backend/infer.ml | 3 +-- infer/src/base/Config.ml | 23 +++++++++------------ infer/src/base/Config.mli | 2 +- infer/src/checkers/registerCheckers.ml | 2 +- infer/src/integration/Buck.ml | 2 +- infer/tests/codetoanalyze/cpp/siof/Makefile | 4 ++-- 7 files changed, 16 insertions(+), 21 deletions(-) diff --git a/infer/src/backend/InferPrint.re b/infer/src/backend/InferPrint.re index cb82b70b1..abc8a0f8e 100644 --- a/infer/src/backend/InferPrint.re +++ b/infer/src/backend/InferPrint.re @@ -271,7 +271,6 @@ let should_report (issue_kind: Exceptions.err_kind) issue_type error_desc eclass switch Config.analyzer { | Checkers | Eradicate - | Siof | Tracing => true | Bufferoverrun | Capture diff --git a/infer/src/backend/infer.ml b/infer/src/backend/infer.ml index a28ac928e..e7c240987 100644 --- a/infer/src/backend/infer.ml +++ b/infer/src/backend/infer.ml @@ -375,8 +375,7 @@ let analyze driver_mode = false, false | _, (Capture | Compile) -> false, false - | _, (Infer | Eradicate | Checkers | Tracing | Crashcontext | Quandary | Siof - | Bufferoverrun) -> + | _, (Infer | Eradicate | Checkers | Tracing | Crashcontext | Quandary | Bufferoverrun) -> true, true | _, Linters -> false, true in diff --git a/infer/src/base/Config.ml b/infer/src/base/Config.ml index a6632cda7..d67d96d55 100644 --- a/infer/src/base/Config.ml +++ b/infer/src/base/Config.ml @@ -37,7 +37,7 @@ let frontend_parse_modes = CLOpt.(Infer [Clang]) type analyzer = | Capture | Compile | Infer | Eradicate | Checkers | Tracing | Crashcontext | Linters | Quandary - | Siof | Bufferoverrun + | Bufferoverrun [@@deriving compare] let equal_analyzer = [%compare.equal : analyzer] @@ -46,7 +46,7 @@ let string_to_analyzer = [("capture", Capture); ("compile", Compile); ("infer", Infer); ("eradicate", Eradicate); ("checkers", Checkers); ("tracing", Tracing); ("crashcontext", Crashcontext); ("linters", Linters); - ("quandary", Quandary); ("siof", Siof); ("bufferoverrun", Bufferoverrun)] + ("quandary", Quandary); ("bufferoverrun", Bufferoverrun)] let string_of_analyzer a = List.find_exn ~f:(fun (_, a') -> equal_analyzer a a') string_to_analyzer |> fst @@ -482,7 +482,7 @@ and analyzer = (* NOTE: if compilation fails here, it means you have added a new analyzer without updating the documentation of this option *) | Capture | Compile | Infer | Eradicate | Checkers | Tracing | Crashcontext | Linters - | Quandary | Siof | Bufferoverrun -> () in + | Quandary | Bufferoverrun -> () in CLOpt.mk_symbol_opt ~deprecated:["analyzer"] ~long:"analyzer" ~short:'a' ~parse_mode:CLOpt.(Infer [Driver]) "Specify which analyzer to run (only one at a time is supported):\n\ @@ -490,8 +490,7 @@ and analyzer = - capture: run capture phase only (no analysis)\n\ - compile: run compilation command without interfering (not supported by all frontends)\n\ - crashcontext, tracing: experimental (see --crashcontext and --tracing)\n\ - - linters: run linters based on the ast only (Objective-C and Objective-C++ only)\n\ - - siof: check for Static Initialization Order Fiasco (C++ only)" + - linters: run linters based on the ast only (Objective-C and Objective-C++ only)" ~symbols:string_to_analyzer and android_harness = @@ -593,7 +592,7 @@ and changed_files_index = start. Source files should be specified relative to project root or be absolute" and bufferoverrun, checkers, checkers_repeated_calls, - eradicate, quandary, siof = + eradicate, quandary = let checkers = CLOpt.mk_bool ~deprecated:["checkers"] ~long:"checkers" "Activate the checkers instead of the full analysis" @@ -618,13 +617,8 @@ and bufferoverrun, checkers, checkers_repeated_calls, "Activate the quandary taint analysis" [checkers] [] in - let siof = - CLOpt.mk_bool_group ~long:"siof" - "Activate the Static Initialization Order Fiasco analysis" - [checkers] [] - in (bufferoverrun, checkers, checkers_repeated_calls, - eradicate, quandary, siof) + eradicate, quandary) and clang_biniou_file = CLOpt.mk_path_opt ~long:"clang-biniou-file" ~parse_mode:CLOpt.(Infer [Clang]) ~meta:"file" @@ -1246,6 +1240,10 @@ and seconds_per_iteration = CLOpt.mk_float_opt ~deprecated:["seconds_per_iteration"] ~long:"seconds-per-iteration" ~meta:"float" "Set the number of seconds per iteration (see --iterations)" +and siof = + CLOpt.mk_bool ~long:"siof" ~parse_mode:CLOpt.(Infer [Checkers]) + "Activate the Static Initialization Order Fiasco analysis (C++ only)" + and siof_safe_methods = CLOpt.mk_string_list ~long:"siof-safe-methods" ~parse_mode:CLOpt.(Infer [Checkers]) @@ -1557,7 +1555,6 @@ let post_parsing_initialization () = | Some Eradicate -> checkers := true; eradicate := true | Some Quandary -> checkers := true; quandary := true | Some Bufferoverrun -> checkers := true; bufferoverrun := true - | Some Siof -> checkers := true; siof := true | Some Tracing -> tracing := true | Some (Capture | Compile | Infer | Linters) | None -> () diff --git a/infer/src/base/Config.mli b/infer/src/base/Config.mli index 09db8818c..10a81b7e3 100644 --- a/infer/src/base/Config.mli +++ b/infer/src/base/Config.mli @@ -20,7 +20,7 @@ val exe_name : exe -> string (** Various kind of analyzers *) type analyzer = | Capture | Compile | Infer | Eradicate | Checkers | Tracing | Crashcontext | Linters | Quandary - | Siof | Bufferoverrun + | Bufferoverrun [@@deriving compare] val equal_analyzer : analyzer -> analyzer -> bool diff --git a/infer/src/checkers/registerCheckers.ml b/infer/src/checkers/registerCheckers.ml index b878c2a36..e93911ba3 100644 --- a/infer/src/checkers/registerCheckers.ml +++ b/infer/src/checkers/registerCheckers.ml @@ -44,7 +44,7 @@ let active_procedure_checkers () = let l = [ ClangTaintAnalysis.checker, Config.quandary; - Siof.checker, Config.siof; + Siof.checker, enabled_by_default || Config.siof; ThreadSafety.analyze_procedure, Config.threadsafety; BufferOverrunChecker.checker, Config.bufferoverrun; Interproc.analyze_procedure, Config.biabduction; diff --git a/infer/src/integration/Buck.ml b/infer/src/integration/Buck.ml index 8d71f1c2b..63d6b1921 100644 --- a/infer/src/integration/Buck.ml +++ b/infer/src/integration/Buck.ml @@ -51,7 +51,7 @@ let add_flavor_to_target target = target | None, (Linters | Capture) -> add "infer-capture-all" - | None, (Bufferoverrun | Checkers | Infer | Quandary | Siof) -> + | None, (Bufferoverrun | Checkers | Infer | Quandary) -> add "infer" | None, (Eradicate | Tracing | Crashcontext) -> failwithf "Analyzer %s is Java-only; not supported with Buck flavors" diff --git a/infer/tests/codetoanalyze/cpp/siof/Makefile b/infer/tests/codetoanalyze/cpp/siof/Makefile index d5532d2c7..2da3a4b73 100644 --- a/infer/tests/codetoanalyze/cpp/siof/Makefile +++ b/infer/tests/codetoanalyze/cpp/siof/Makefile @@ -7,10 +7,10 @@ TESTS_DIR = ../../.. -ANALYZER = siof +ANALYZER = checkers # see explanations in cpp/errors/Makefile for the custom isystem CLANG_OPTIONS = -x c++ -std=c++11 -nostdinc++ -isystem$(MODELS_DIR)/cpp/include -isystem$(CLANG_INCLUDES)/c++/v1/ -c -INFER_OPTIONS = --ml-buckets cpp --no-filtering --debug-exceptions --project-root $(TESTS_DIR) --no-failures-allowed +INFER_OPTIONS = --siof --ml-buckets cpp --no-filtering --debug-exceptions --project-root $(TESTS_DIR) --no-failures-allowed INFERPRINT_OPTIONS = --issues-tests SOURCES = \