From 9e4cbc919b6760c0b289bb75ffeb54439a075931 Mon Sep 17 00:00:00 2001 From: Jeremy Dubreil Date: Mon, 8 May 2017 16:32:21 -0700 Subject: [PATCH] [infer][checkers] Using the same filtering mechanisim for the biabduction analysis for the main Infer analysis and when using the checkers framework Summary: Now, infer -a infer -- ... and infer -a checkers --biabduction -- ... will return the same list of errors Reviewed By: sblackshear Differential Revision: D5023223 fbshipit-source-id: f52ce5d --- infer/src/backend/InferPrint.re | 2 +- infer/src/checkers/registerCheckers.ml | 2 +- infer/tests/codetoanalyze/c/biabduction/example.c | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/infer/src/backend/InferPrint.re b/infer/src/backend/InferPrint.re index 0e3aa94be..c0f82e156 100644 --- a/infer/src/backend/InferPrint.re +++ b/infer/src/backend/InferPrint.re @@ -269,10 +269,10 @@ let should_report (issue_kind: Exceptions.err_kind) issue_type error_desc eclass } else { let analyzer_is_whitelisted = switch Config.analyzer { - | Checkers | Eradicate | Tracing => true | Capture + | Checkers | Compile | Crashcontext | Infer diff --git a/infer/src/checkers/registerCheckers.ml b/infer/src/checkers/registerCheckers.ml index e93911ba3..c5c8a53d4 100644 --- a/infer/src/checkers/registerCheckers.ml +++ b/infer/src/checkers/registerCheckers.ml @@ -17,7 +17,7 @@ module F = Format let enabled_by_default = (* True when no checker is explicitely enabled from the command line *) let open Config in - not (bufferoverrun || checkers_repeated_calls || crashcontext + not (biabduction || bufferoverrun || checkers_repeated_calls || crashcontext || eradicate || quandary || siof || threadsafety) (** Flags to activate checkers. *) diff --git a/infer/tests/codetoanalyze/c/biabduction/example.c b/infer/tests/codetoanalyze/c/biabduction/example.c index 66dd7e5ea..b77c3953f 100644 --- a/infer/tests/codetoanalyze/c/biabduction/example.c +++ b/infer/tests/codetoanalyze/c/biabduction/example.c @@ -6,7 +6,13 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ + void foo() { int* p = 0; *p = 42; } + +int bar() { + /* The division by zero should be found but filtered out by default */ + return 1 / 0; +}