aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/compile.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2013-12-10 08:51:02 +0100
committerBjörn Gustavsson <[email protected]>2014-01-08 15:08:55 +0100
commitb2812193cfc8f0e98520984080a4cb87230b1f0b (patch)
tree0b473b9f9446cd1a8ce12ac021d988e22f289184 /lib/compiler/src/compile.erl
parent017037352cf3992c0510b138a6e28de6032a4b27 (diff)
downloadotp-b2812193cfc8f0e98520984080a4cb87230b1f0b.tar.gz
otp-b2812193cfc8f0e98520984080a4cb87230b1f0b.tar.bz2
otp-b2812193cfc8f0e98520984080a4cb87230b1f0b.zip
Ignore warnings when running sys_core_fold after inlining
The new inliner (cerl_inline) does not mark inlined code as compiler generated. Therefore, when sys_core_fold is run after inlining, it may generate spurious warnings. The easiest way out (for now, at least) is to discard all warnings found when running sys_core_fold after inlining.
Diffstat (limited to 'lib/compiler/src/compile.erl')
-rw-r--r--lib/compiler/src/compile.erl8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/compiler/src/compile.erl b/lib/compiler/src/compile.erl
index 38a733751a..3db7ffc4d2 100644
--- a/lib/compiler/src/compile.erl
+++ b/lib/compiler/src/compile.erl
@@ -612,7 +612,7 @@ core_passes() ->
?pass(core_fold_module),
{core_inline_module,fun test_core_inliner/1,fun core_inline_module/1},
{iff,dinline,{listing,"inline"}},
- {core_fold_after_inline,fun test_core_inliner/1,fun core_fold_module/1},
+ {core_fold_after_inlining,fun test_core_inliner/1,fun core_fold_module_after_inlining/1},
?pass(core_transforms)]},
{iff,dcopt,{listing,"copt"}},
{iff,'to_core',{done,"core"}}]}
@@ -1134,6 +1134,12 @@ core_fold_module(#compile{code=Code0,options=Opts,warnings=Warns}=St) ->
{ok,Code,Ws} = sys_core_fold:module(Code0, Opts),
{ok,St#compile{code=Code,warnings=Warns ++ Ws}}.
+core_fold_module_after_inlining(#compile{code=Code0,options=Opts}=St) ->
+ %% Inlining may produce code that generates spurious warnings.
+ %% Ignore all warnings.
+ {ok,Code,_Ws} = sys_core_fold:module(Code0, Opts),
+ {ok,St#compile{code=Code}}.
+
test_old_inliner(#compile{options=Opts}) ->
%% The point of this test is to avoid loading the old inliner
%% if we know that it will not be used.