diff --git a/configure.ac b/configure.ac index aa2a1fc2d..a03dff6ee 100644 --- a/configure.ac +++ b/configure.ac @@ -71,7 +71,7 @@ case "${OS}" in BUILD_PLATFORM=Windows ;; *) - AC_MSG_ERROR(["OS $unamestr is not supported"]) + AC_MSG_ERROR(["OS $uname_str is not supported"]) ;; esac esac diff --git a/infer/man/man1/infer-full.txt b/infer/man/man1/infer-full.txt index 1991d24c6..a7533fc9b 100644 --- a/infer/man/man1/infer-full.txt +++ b/infer/man/man1/infer-full.txt @@ -1611,6 +1611,11 @@ INTERNAL OPTIONS --costs-previous-reset Cancel the effect of --costs-previous. + --no-dbwriter + Deactivates: Use a separate process to serialize writes to sqlite. + Disabling this will degrade performance. Note that this is always + disabled on Windows and WSL. (Conversely: --dbwriter) + --debug-exceptions Activates: Generate lightweight debugging information: just print the internal exceptions during analysis (also sets diff --git a/infer/src/base/Config.ml b/infer/src/base/Config.ml index 382d21323..a47e01518 100644 --- a/infer/src/base/Config.ml +++ b/infer/src/base/Config.ml @@ -127,6 +127,15 @@ let fail_on_issue_exit_code = 2 (** If true, treat calls to no-arg getters as idempotent w.r.t non-nullness *) let idempotent_getters = true +let is_WSL = + match Utils.read_file "/proc/version" with + | Ok [line] -> + let re = Str.regexp "Linux.+-Microsoft" in + Str.string_match re line 0 + | _ -> + false + + let ivar_attributes = "ivar_attributes" let java_lambda_marker_infix = "$Lambda$" @@ -1286,6 +1295,12 @@ and ( biabduction_write_dotty , write_html ) +and dbwriter = + CLOpt.mk_bool ~default:true ~long:"dbwriter" + "Use a separate process to serialize writes to sqlite. Disabling this will degrade \ + performance. Note that this is always disabled on Windows and WSL." + + and dependencies = CLOpt.mk_bool ~deprecated:["dependencies"] ~long:"dependencies" ~in_help:InferCommand.[(Capture, manual_java)] @@ -2464,13 +2479,8 @@ and sqlite_lock_timeout = and sqlite_vfs = let default = - match Utils.read_file "/proc/version" with - | Result.Ok [line] -> - let re = Str.regexp "Linux.+-Microsoft" in - (* on WSL (bash on Windows) standard SQLite VFS can't be used, see WSL/issues/1927 WSL/issues/2395 *) - if Str.string_match re line 0 then Some "unix-excl" else None - | _ -> - None + (* on WSL (bash on Windows) standard SQLite VFS can't be used, see WSL/issues/1927 WSL/issues/2395 *) + if is_WSL then Some "unix-excl" else None in CLOpt.mk_string_opt ?default ~long:"sqlite-vfs" "VFS for SQLite" @@ -3026,6 +3036,8 @@ and cxx = !cxx and cxx_scope_guards = !cxx_scope_guards +and dbwriter = !dbwriter + and debug_level_analysis = !debug_level_analysis and debug_level_capture = !debug_level_capture diff --git a/infer/src/base/Config.mli b/infer/src/base/Config.mli index 3e9f9858e..7eeed0c67 100644 --- a/infer/src/base/Config.mli +++ b/infer/src/base/Config.mli @@ -72,6 +72,9 @@ val idempotent_getters : bool val initial_analysis_time : float +val is_WSL : bool +(** Windows Subsystem for Linux *) + val ivar_attributes : string val java_lambda_marker_infix : string @@ -258,6 +261,8 @@ val cxx : bool val cxx_scope_guards : Yojson.Basic.t +val dbwriter : bool + val deduplicate : bool val debug_exceptions : bool diff --git a/infer/src/base/DBWriter.ml b/infer/src/base/DBWriter.ml index cd0df81b5..2f368b23b 100644 --- a/infer/src/base/DBWriter.ml +++ b/infer/src/base/DBWriter.ml @@ -385,7 +385,10 @@ module Server = struct send Command.Handshake end -let use_daemon = Config.((not (buck || genrule_mode)) && jobs > 1) +let use_daemon = + let is_windows = match Version.build_platform with Windows -> true | Linux | Darwin -> false in + Config.((not is_windows) && (not is_WSL) && dbwriter && (not (buck || genrule_mode)) && jobs > 1) + let perform cmd = if use_daemon then Server.send cmd else Command.execute cmd