From 6580899813891583f224b053bb310a619802edff Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Wed, 11 Jan 2017 03:33:37 -0800 Subject: [PATCH] [driver] do not warn about nothing to analyze when not analyzing Summary: Sometimes we don't want to analyze but a message gets printed that there was nothing to analyze and we exit with error, which is confusing. Reviewed By: jberdine Differential Revision: D4398120 fbshipit-source-id: 43ce3ab --- infer/src/backend/infer.ml | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/infer/src/backend/infer.ml b/infer/src/backend/infer.ml index 74c6ca6ab..a9bd184ed 100644 --- a/infer/src/backend/infer.ml +++ b/infer/src/backend/infer.ml @@ -319,19 +319,20 @@ let analyze = function separate Analyze invocation is necessary, depending on the buck flavor used. *) () | _ -> - if (Sys.file_exists Config.(results_dir ^/ captured_dir_name)) <> `Yes then ( - L.stderr "There was nothing to analyze, exiting" ; - Config.print_usage_exit () + let should_analyze, should_report = match Config.analyzer with + | Infer | Eradicate | Checkers | Tracing | Crashcontext | Quandary | Threadsafety -> + true, true + | Linters -> + false, true + | Capture | Compile -> + false, false in + if (should_analyze || should_report) + && (Sys.file_exists Config.(results_dir ^/ captured_dir_name)) <> `Yes then ( + L.stderr "There was nothing to analyze, exiting@." ; + exit 1 ); - (match Config.analyzer with - | Infer | Eradicate | Checkers | Tracing | Crashcontext | Quandary | Threadsafety -> - execute_analyze () ; - report () - | Linters -> - report () - | Capture | Compile -> - () - ) + if should_analyze then execute_analyze (); + if should_report then report () (** as the Config.fail_on_bug flag mandates, exit with error when an issue is reported *) let fail_on_issue_epilogue () =