aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2014-10-10 10:19:55 +0200
committerHans Bolinder <[email protected]>2014-10-10 10:19:55 +0200
commit197a8467f465930372f31c8f8b7340f8339aa23a (patch)
treec010ccda5b3f18555e094c7d3e2d7e0959d6f539 /lib/dialyzer
parent1aa1a4f6173e9ef59ac0b6bb054368c141000062 (diff)
parent72e3e9892cb8cbc1aa6ea32095be2b0aebb0f25b (diff)
downloadotp-197a8467f465930372f31c8f8b7340f8339aa23a.tar.gz
otp-197a8467f465930372f31c8f8b7340f8339aa23a.tar.bz2
otp-197a8467f465930372f31c8f8b7340f8339aa23a.zip
Merge branch 'hb/dialyzer/warnings_as_errors/OTP-12225' into maint
* hb/dialyzer/warnings_as_errors/OTP-12225: dialyzer: do a minor re-factoring dialyzer: Ignore ERL_COMPILER_OPTIONS when compiling dialyzer: fix bug concerning compiler option 'warnings_as_errors'
Diffstat (limited to 'lib/dialyzer')
-rw-r--r--lib/dialyzer/src/dialyzer_utils.erl29
1 files changed, 13 insertions, 16 deletions
diff --git a/lib/dialyzer/src/dialyzer_utils.erl b/lib/dialyzer/src/dialyzer_utils.erl
index 4e2ec67b35..5297a3a7b4 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
@@ -444,21 +444,18 @@ cleanup_parse_transforms([]) ->
-spec cleanup_compile_options([compile:option()]) -> [compile:option()].
+cleanup_compile_options(Opts) ->
+ lists:filter(fun keep_compile_option/1, Opts).
+
%% Using abstract, not asm or core.
-cleanup_compile_options([from_asm|Opts]) ->
- Opts;
-cleanup_compile_options([asm|Opts]) ->
- Opts;
-cleanup_compile_options([from_core|Opts]) ->
- Opts;
-%% The parse transform will already have been applied, may cause problems if it
-%% is re-applied.
-cleanup_compile_options([{parse_transform, _}|Opts]) ->
- Opts;
-cleanup_compile_options([Other|Opts]) ->
- [Other|cleanup_compile_options(Opts)];
-cleanup_compile_options([]) ->
- [].
+keep_compile_option(from_asm) -> false;
+keep_compile_option(asm) -> false;
+keep_compile_option(from_core) -> false;
+%% The parse transform will already have been applied, may cause
+%% problems if it is re-applied.
+keep_compile_option({parse_transform, _}) -> false;
+keep_compile_option(warnings_as_errors) -> false;
+keep_compile_option(_) -> true.
-spec format_errors([{module(), string()}]) -> [string()].