From 4e3433640ebd33773c0d348091a665d7f87bd04c Mon Sep 17 00:00:00 2001 From: Kostis Sagonas Date: Fri, 5 Feb 2010 16:36:52 +0100 Subject: compile.erl: eliminate compiler warning --- lib/compiler/src/compile.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/compiler/src/compile.erl b/lib/compiler/src/compile.erl index d73c9cd762..b853800d73 100644 --- a/lib/compiler/src/compile.erl +++ b/lib/compiler/src/compile.erl @@ -1055,7 +1055,7 @@ test_native(#compile{options=Opts}) -> is_native_enabled([native|_]) -> true; is_native_enabled([no_native|_]) -> false; -is_native_enabled([H|T]) -> is_native_enabled(T); +is_native_enabled([_|Opts]) -> is_native_enabled(Opts); is_native_enabled([]) -> false. native_compile(#compile{code=none}=St) -> {ok,St}; -- cgit v1.2.3 From 054b4fdf69fbbdf4e47b555b4c73f524fc3eeec2 Mon Sep 17 00:00:00 2001 From: Kostis Sagonas Date: Fri, 5 Feb 2010 16:50:41 +0100 Subject: compiler Makefile: alphabetize module names --- lib/compiler/src/Makefile | 56 +++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'lib') diff --git a/lib/compiler/src/Makefile b/lib/compiler/src/Makefile index fde2b1a655..2f870e1667 100644 --- a/lib/compiler/src/Makefile +++ b/lib/compiler/src/Makefile @@ -45,46 +45,46 @@ RELSYSDIR = $(RELEASE_PATH)/lib/compiler-$(VSN) # Target Specs # ---------------------------------------------------- MODULES = \ - compile \ - sys_pre_attributes \ - sys_pre_expand \ - sys_expand_pmod \ - v3_core \ - sys_core_fold \ - sys_core_inline \ - sys_core_dsetel \ - core_lib \ - core_scan \ - core_parse \ - core_lint \ - core_pp \ - v3_kernel \ - v3_kernel_pp \ - v3_life \ - v3_codegen \ + beam_asm \ beam_block \ beam_bool \ - beam_dead \ - beam_jump \ - beam_type \ - beam_clean \ - beam_peep \ beam_bsm \ - beam_trim \ + beam_clean \ + beam_dead \ + beam_dict \ + beam_disasm \ beam_flatten \ + beam_jump \ beam_listing \ - beam_asm \ - beam_dict \ beam_opcodes \ - beam_disasm \ + beam_peep \ + beam_trim \ + beam_type \ beam_utils \ beam_validator \ - erl_bifs \ cerl \ cerl_clauses \ cerl_inline \ cerl_trees \ - rec_env + compile \ + core_lib \ + core_lint \ + core_parse \ + core_pp \ + core_scan \ + erl_bifs \ + rec_env \ + sys_core_dsetel \ + sys_core_fold \ + sys_core_inline \ + sys_expand_pmod \ + sys_pre_attributes \ + sys_pre_expand \ + v3_codegen \ + v3_core \ + v3_kernel \ + v3_kernel_pp \ + v3_life BEAM_H = $(wildcard ../priv/beam_h/*.h) -- cgit v1.2.3 From a612e99fb5aaa934fe5a8591db0f083d7fa0b20a Mon Sep 17 00:00:00 2001 From: Kostis Sagonas Date: Fri, 5 Feb 2010 16:43:30 +0100 Subject: compiler: keep line numbers for attributes In the future, we might want to generate warnings for attributes, referring to them with line numbers. sys_pre_expand used to replace line number for attributes with 0. Change sys_pre_expand to retain the real line number. v3_core used to throw away the line numbers. Change v3_core so that it retains the line numbers in annotations. While at it, do some tidying as suggested by tidier. --- lib/compiler/src/sys_pre_expand.erl | 50 ++++++++++++++++++------------------- lib/compiler/src/v3_core.erl | 4 +-- 2 files changed, 27 insertions(+), 27 deletions(-) (limited to 'lib') diff --git a/lib/compiler/src/sys_pre_expand.erl b/lib/compiler/src/sys_pre_expand.erl index 78dd73e0a2..04c45a8c5d 100644 --- a/lib/compiler/src/sys_pre_expand.erl +++ b/lib/compiler/src/sys_pre_expand.erl @@ -114,7 +114,7 @@ expand_pmod(Fs0, St0) -> St1 = St0#expand{exports=Xs, defined=Ds}, {Fs2,St2} = add_instance(Ps, Fs1, St1), {Fs3,St3} = ensure_new(Base, Ps0, Fs2, St2), - {Fs3,St3#expand{attributes = [{abstract, [true]} + {Fs3,St3#expand{attributes = [{abstract, 0, [true]} | St3#expand.attributes]}} end. @@ -173,7 +173,7 @@ define_functions(Forms, #expand{defined=Predef}=St) -> St#expand{defined=ordsets:from_list(Fs)}. module_attrs(St) -> - {[{attribute,0,Name,Val} || {Name,Val} <- St#expand.attributes],St}. + {[{attribute,Line,Name,Val} || {Name,Line,Val} <- St#expand.attributes],St}. module_predef_funcs(St) -> PreDef = [{module_info,0},{module_info,1}], @@ -197,8 +197,8 @@ module_predef_funcs(St) -> forms([{attribute,_,file,_File}=F|Fs0], St0) -> {Fs,St1} = forms(Fs0, St0), {[F|Fs],St1}; -forms([{attribute,_,Name,Val}|Fs0], St0) -> - St1 = attribute(Name, Val, St0), +forms([{attribute,Line,Name,Val}|Fs0], St0) -> + St1 = attribute(Name, Val, Line, St0), forms(Fs0, St1); forms([{function,L,N,A,Cs}|Fs0], St0) -> {Ff,St1} = function(L, N, A, Cs, St0), @@ -207,30 +207,30 @@ forms([{function,L,N,A,Cs}|Fs0], St0) -> forms([_|Fs], St) -> forms(Fs, St); forms([], St) -> {[],St}. -%% attribute(Attribute, Value, State) -> State'. +%% attribute(Attribute, Value, Line, State) -> State'. %% Process an attribute, this just affects the state. -attribute(module, {Module, As}, St) -> +attribute(module, {Module, As}, _L, St) -> M = package_to_string(Module), St#expand{module=list_to_atom(M), - package = packages:strip_last(M), + package=packages:strip_last(M), parameters=As}; -attribute(module, Module, St) -> +attribute(module, Module, _L, St) -> M = package_to_string(Module), St#expand{module=list_to_atom(M), - package = packages:strip_last(M)}; -attribute(export, Es, St) -> + package=packages:strip_last(M)}; +attribute(export, Es, _L, St) -> St#expand{exports=union(from_list(Es), St#expand.exports)}; -attribute(import, Is, St) -> +attribute(import, Is, _L, St) -> import(Is, St); -attribute(compile, C, St) when is_list(C) -> +attribute(compile, C, _L, St) when is_list(C) -> St#expand{compile=St#expand.compile ++ C}; -attribute(compile, C, St) -> +attribute(compile, C, _L, St) -> St#expand{compile=St#expand.compile ++ [C]}; -attribute(Name, Val, St) when is_list(Val) -> - St#expand{attributes=St#expand.attributes ++ [{Name,Val}]}; -attribute(Name, Val, St) -> - St#expand{attributes=St#expand.attributes ++ [{Name,[Val]}]}. +attribute(Name, Val, Line, St) when is_list(Val) -> + St#expand{attributes=St#expand.attributes ++ [{Name,Line,Val}]}; +attribute(Name, Val, Line, St) -> + St#expand{attributes=St#expand.attributes ++ [{Name,Line,[Val]}]}. function(L, N, A, Cs0, St0) -> {Cs,St} = clauses(Cs0, St0#expand{func=N,arity=A,fcount=0}), @@ -299,10 +299,10 @@ pattern({match,Line,Pat1, Pat2}, St0) -> {TT,St2} = pattern(Pat1, St1), {{match,Line,TT,TH},St2}; %% Compile-time pattern expressions, including unary operators. -pattern({op,Line,Op,A}, St) -> - {erl_eval:partial_eval({op,Line,Op,A}),St}; -pattern({op,Line,Op,L,R}, St) -> - {erl_eval:partial_eval({op,Line,Op,L,R}),St}. +pattern({op,_Line,_Op,_A}=Op, St) -> + {erl_eval:partial_eval(Op),St}; +pattern({op,_Line,_Op,_L,_R}=Op, St) -> + {erl_eval:partial_eval(Op),St}. pattern_list([P0|Ps0], St0) -> {P,St1} = pattern(P0, St0), @@ -400,18 +400,18 @@ expr({'receive',Line,Cs0,To0,ToEs0}, St0) -> {{'receive',Line,Cs,To,ToEs},St3}; expr({'fun',Line,Body}, St) -> fun_tq(Line, Body, St); -expr({call,Line,{atom,La,N},As0}, St0) -> +expr({call,Line,{atom,La,N}=Atom,As0}, St0) -> {As,St1} = expr_list(As0, St0), Ar = length(As), case erl_internal:bif(N, Ar) of true -> - {{call,Line,{remote,La,{atom,La,erlang},{atom,La,N}},As},St1}; + {{call,Line,{remote,La,{atom,La,erlang},Atom},As},St1}; false -> case imported(N, Ar, St1) of {yes,Mod} -> - {{call,Line,{remote,La,{atom,La,Mod},{atom,La,N}},As},St1}; + {{call,Line,{remote,La,{atom,La,Mod},Atom},As},St1}; no -> - {{call,Line,{atom,La,N},As},St1} + {{call,Line,Atom,As},St1} end end; expr({call,Line,{record_field,_,_,_}=M,As0}, St0) -> diff --git a/lib/compiler/src/v3_core.erl b/lib/compiler/src/v3_core.erl index a39a3c538f..746fce7578 100644 --- a/lib/compiler/src/v3_core.erl +++ b/lib/compiler/src/v3_core.erl @@ -164,8 +164,8 @@ form({attribute,_,file,{File,_Line}}, {Fs,As,Es,Ws,_}, _Opts) -> form({attribute,_,_,_}=F, {Fs,As,Es,Ws,File}, _Opts) -> {Fs,[attribute(F)|As],Es,Ws,File}. -attribute({attribute,_,Name,Val}) -> - {#c_literal{val=Name},#c_literal{val=Val}}. +attribute({attribute,Line,Name,Val}) -> + {#c_literal{val=Name, anno=[Line]}, #c_literal{val=Val, anno=[Line]}}. function({function,_,Name,Arity,Cs0}, Es0, Ws0, File, Opts) -> %%ok = io:fwrite("~p - ", [{Name,Arity}]), -- cgit v1.2.3