From 9c3e92d9fd02d4e24428e0e91c5d75452256d689 Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Tue, 16 May 2017 08:57:54 -0700 Subject: [PATCH] [toplevel] small changes in the stdout output Summary: After: ``` $ infer run -- clang -c examples/hello.c Capturing in make/cc mode... Found 1 source file to analyze in /home/jul/infer/infer-out Starting analysis... legend: "F" analyzing a file "." analyzing a procedure F. Found 1 issue examples/hello.c:14: error: NULL_DEREFERENCE pointer `s` last assigned on line 13 could be null and is dereferenced at line 14, column 3 12. void test() { 13. int* s = NULL; 14. > *s = 42; 15. } Summary of the reports NULL_DEREFERENCE: 1 ``` Before, legend and analysis run were separated by 2 lines, one is now before and the other is in the log files only: ``` Capturing in make/cc mode... Starting analysis... legend: "F" analyzing a file "." analyzing a procedure Found 1 (out of 1) source files to be analyzed in /home/jul/infer/infer-out per-procedure parallelism jobs:4 F. Found 1 issue examples/hello.c:14: error: NULL_DEREFERENCE pointer `s` last assigned on line 13 could be null and is dereferenced at line 14, column 3 12. void test() { 13. int* s = NULL; 14. > *s = 42; 15. } Summary of the reports NULL_DEREFERENCE: 1 ``` Reviewed By: mbouaziz Differential Revision: D5069590 fbshipit-source-id: 8843422 --- infer/src/backend/InferAnalyze.re | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/infer/src/backend/InferAnalyze.re b/infer/src/backend/InferAnalyze.re index b200bd457..ac228a7ef 100644 --- a/infer/src/backend/InferAnalyze.re +++ b/infer/src/backend/InferAnalyze.re @@ -136,7 +136,6 @@ let main makefile => { switch Config.cluster_cmdline { | Some fname => process_cluster_cmdline fname | None => - print_stdout_legend (); if Config.allow_specs_cleanup { DB.Results_dir.clean_specs_dir () }; @@ -145,19 +144,34 @@ let main makefile => { }; let all_clusters = DB.find_source_dirs (); let clusters_to_analyze = List.filter f::cluster_should_be_analyzed all_clusters; + let n_clusters_to_analyze = List.length clusters_to_analyze; L.stdout - "Found %d (out of %d) source files to be analyzed in %s@." - (List.length clusters_to_analyze) - (List.length all_clusters) + "Found %d%s source file%s to analyze in %s@." + n_clusters_to_analyze + ( + if (Config.reactive_mode || Option.is_some Ondemand.dirs_to_analyze) { + " (out of " ^ string_of_int (List.length all_clusters) ^ ")" + } else { + "" + } + ) + ( + if (Int.equal n_clusters_to_analyze 1) { + "" + } else { + "s" + } + ) Config.results_dir; let is_java () => List.exists f::(fun cl => DB.string_crc_has_extension ext::"java" (DB.source_dir_to_string cl)) all_clusters; + print_stdout_legend (); if (Config.per_procedure_parallelism && not (is_java ())) { /* Java uses ZipLib which is incompatible with forking */ /* per-procedure parallelism */ - L.stdout "per-procedure parallelism jobs:%d@." Config.jobs; + L.out "Per-procedure parallelism jobs: %d@." Config.jobs; if (makefile != "") { ClusterMakefile.create_cluster_makefile [] makefile };