From 4b49314bb58de1bd1a0b35a218def99ed500f49a Mon Sep 17 00:00:00 2001 From: Hans Bolinder Date: Wed, 8 Oct 2014 15:41:20 +0200 Subject: dialyzer: Ignore ERL_COMPILER_OPTIONS when compiling If, for instance, 'warn_unused_import' is present in ERL_COMPILER_OPTIONS then many files in Erlang/OTP (Kernel, STDLIB, ...) cannot be analyzed by Dialyzer since the option is not present when compiling Erlang/OTP, but 'warnings_as_errors' is. The case that ERL_COMPILER_OPTIONS contains 'warnings_as_errors' can only be handled by ignoring ERL_COMPILER_OPTIONS. --- lib/dialyzer/src/dialyzer_utils.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/dialyzer/src') diff --git a/lib/dialyzer/src/dialyzer_utils.erl b/lib/dialyzer/src/dialyzer_utils.erl index a81670b117..5b744a4bd3 100644 --- a/lib/dialyzer/src/dialyzer_utils.erl +++ b/lib/dialyzer/src/dialyzer_utils.erl @@ -98,7 +98,7 @@ get_abstract_code_from_src(File) -> {'ok', abstract_code()} | {'error', [string()]}. get_abstract_code_from_src(File, Opts) -> - case compile:file(File, [to_pp, binary|Opts]) of + case compile:noenv_file(File, [to_pp, binary|Opts]) of error -> {error, []}; {error, Errors, _} -> {error, format_errors(Errors)}; {ok, _, AbstrCode} -> {ok, AbstrCode} @@ -173,7 +173,7 @@ get_core_from_abstract_code(AbstrCode, Opts) -> AbstrCode1 = cleanup_parse_transforms(AbstrCode), %% Remove parse_transforms (and other options) from compile options. Opts2 = cleanup_compile_options(Opts), - try compile:forms(AbstrCode1, Opts2 ++ src_compiler_opts()) of + try compile:noenv_forms(AbstrCode1, Opts2 ++ src_compiler_opts()) of {ok, _, Core} -> {ok, Core}; _What -> error catch -- cgit v1.2.3