diff options
Diffstat (limited to 'lib/dialyzer/src/dialyzer_cl.erl')
-rw-r--r-- | lib/dialyzer/src/dialyzer_cl.erl | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/lib/dialyzer/src/dialyzer_cl.erl b/lib/dialyzer/src/dialyzer_cl.erl index 1e06d6e974..403fcb6279 100644 --- a/lib/dialyzer/src/dialyzer_cl.erl +++ b/lib/dialyzer/src/dialyzer_cl.erl @@ -40,6 +40,7 @@ output = standard_io :: io:device(), output_format = formatted :: format(), filename_opt = basename :: fopt(), + indent_opt = ?INDENT_OPT :: iopt(), output_plt = none :: 'none' | file:filename(), plt_info = none :: 'none' | dialyzer_plt:plt_info(), report_mode = normal :: rep_mode(), @@ -488,10 +489,20 @@ expand_dependent_modules_1([], Included, _ModDeps) -> -spec hipe_compile([file:filename()], #options{}) -> 'ok'. -hipe_compile(Files, #options{erlang_mode = ErlangMode} = Options) -> - NoNative = (get(dialyzer_options_native) =:= false), +hipe_compile(Files, #options{erlang_mode = ErlangMode, + native = Native, + native_cache = NativeCache} = Options) -> + NoNative = + case ErlangMode of + true -> + %% In Erlang mode, native compilation must be explicitly enabled + Native =/= true; + false -> + %% In CLI mode, perform native compilation unless disabled + Native =:= false + end, FewFiles = (length(Files) < ?MIN_FILES_FOR_NATIVE_COMPILE), - case NoNative orelse FewFiles orelse ErlangMode of + case NoNative orelse FewFiles of true -> ok; false -> case erlang:system_info(hipe_architecture) of @@ -507,8 +518,7 @@ hipe_compile(Files, #options{erlang_mode = ErlangMode} = Options) -> dialyzer_worker], report_native_comp(Options), {T1, _} = statistics(wall_clock), - Cache = (get(dialyzer_options_native_cache) =/= false), - native_compile(Mods, Cache), + native_compile(Mods, NativeCache), {T2, _} = statistics(wall_clock), report_elapsed_time(T1, T2, Options) end @@ -588,8 +598,11 @@ new_state() -> init_output(State0, #options{output_file = OutFile, output_format = OutFormat, - filename_opt = FOpt}) -> - State = State0#cl_state{output_format = OutFormat, filename_opt = FOpt}, + filename_opt = FOpt, + indent_opt = IOpt}) -> + State = State0#cl_state{output_format = OutFormat, + filename_opt = FOpt, + indent_opt = IOpt}, case OutFile =:= none of true -> State; @@ -818,6 +831,7 @@ print_warnings(#cl_state{stored_warnings = []}) -> print_warnings(#cl_state{output = Output, output_format = Format, filename_opt = FOpt, + indent_opt = IOpt, stored_warnings = Warnings}) -> PrWarnings = process_warnings(Warnings), case PrWarnings of @@ -825,7 +839,8 @@ print_warnings(#cl_state{output = Output, [_|_] -> S = case Format of formatted -> - [dialyzer:format_warning(W, FOpt) || W <- PrWarnings]; + Opts = [{filename_opt, FOpt}, {indent_opt, IOpt}], + [dialyzer:format_warning(W, Opts) || W <- PrWarnings]; raw -> [io_lib:format("~tp. \n", [W]) || W <- set_warning_id(PrWarnings)] |