aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2014-10-08 15:41:20 +0200
committerHans Bolinder <[email protected]>2014-10-08 15:48:05 +0200
commit4b49314bb58de1bd1a0b35a218def99ed500f49a (patch)
treeb3901735531f96be7f25fe3efd96ea8e9b62d34e
parent9990e4a86be55436fa153284a2791abd7f642a30 (diff)
downloadotp-4b49314bb58de1bd1a0b35a218def99ed500f49a.tar.gz
otp-4b49314bb58de1bd1a0b35a218def99ed500f49a.tar.bz2
otp-4b49314bb58de1bd1a0b35a218def99ed500f49a.zip
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.
-rw-r--r--lib/dialyzer/src/dialyzer_utils.erl4
1 files changed, 2 insertions, 2 deletions
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