diff options
Diffstat (limited to 'lib')
125 files changed, 1148 insertions, 1679 deletions
diff --git a/lib/appmon/src/Makefile b/lib/appmon/src/Makefile index 9dc47ab84e..c42ce068b4 100644 --- a/lib/appmon/src/Makefile +++ b/lib/appmon/src/Makefile @@ -83,10 +83,10 @@ docs: # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Release Target diff --git a/lib/asn1/c_src/Makefile b/lib/asn1/c_src/Makefile index dc926947af..70238335c4 100644 --- a/lib/asn1/c_src/Makefile +++ b/lib/asn1/c_src/Makefile @@ -94,10 +94,10 @@ docs: $(OBJDIR)/%.o: %.c - $(CC) -c $(CFLAGS) -O3 -o $@ $< + $(V_CC) -c $(CFLAGS) -O3 -o $@ $< $(NIF_SHARED_OBJ_FILE): $(NIF_OBJ_FILES) - $(LD) $(LDFLAGS) -o $(NIF_SHARED_OBJ_FILE) $(NIF_OBJ_FILES) $(CLIB_FLAGS) $(LIBS) + $(V_LD) $(LDFLAGS) -o $(NIF_SHARED_OBJ_FILE) $(NIF_OBJ_FILES) $(CLIB_FLAGS) $(LIBS) # ---------------------------------------------------- # Release Target diff --git a/lib/asn1/src/Makefile b/lib/asn1/src/Makefile index 8d9422144e..03e18c565b 100644 --- a/lib/asn1/src/Makefile +++ b/lib/asn1/src/Makefile @@ -136,13 +136,13 @@ info: # ---------------------------------------------------- $(EBIN)/asn1ct.$(EMULATOR):asn1ct.erl - $(ERLC) -b$(EMULATOR) -o$(EBIN) $(ERL_COMPILE_FLAGS) -Dvsn=\"$(VSN)\" $< + $(V_ERLC) -b$(EMULATOR) -o$(EBIN) $(ERL_COMPILE_FLAGS) -Dvsn=\"$(VSN)\" $< $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- diff --git a/lib/common_test/priv/Makefile.in b/lib/common_test/priv/Makefile.in index 4372ab124e..5a9fabbe45 100644 --- a/lib/common_test/priv/Makefile.in +++ b/lib/common_test/priv/Makefile.in @@ -68,15 +68,15 @@ JS = jquery-latest.js jquery.tablesorter.min.js include ../../test_server/vsn.mk debug opt: - sed -e 's;@CT_VSN@;$(VSN);' \ + $(V_at)sed -e 's;@CT_VSN@;$(VSN);' \ -e 's;@TS_VSN@;$(TEST_SERVER_VSN);' \ ../install.sh.in > install.sh - chmod 775 install.sh + $(V_at)chmod 775 install.sh docs: clean: - rm -f $(SCRIPTS) + $(V_at)rm -f $(SCRIPTS) # ---------------------------------------------------- diff --git a/lib/common_test/src/Makefile b/lib/common_test/src/Makefile index dd2923ece9..eb35a43d99 100644 --- a/lib/common_test/src/Makefile +++ b/lib/common_test/src/Makefile @@ -127,10 +127,10 @@ clean: # Special Build Targets # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Release Target diff --git a/lib/compiler/doc/src/compile.xml b/lib/compiler/doc/src/compile.xml index 27d750f929..ddaae2655d 100644 --- a/lib/compiler/doc/src/compile.xml +++ b/lib/compiler/doc/src/compile.xml @@ -816,6 +816,32 @@ pi() -> 3.1416. </section> <section> + <title>Inlining of list functions</title> + <p>The compiler can also inline a variety of list manipulation functions + from the stdlib's lists module.</p> + + <p>This feature must be explicitly enabled with a compiler option or a + <c>-compile()</c> attribute in the source module.</p> + + <p>To enable inlining of list functions, use the <c>inline_list_funcs</c> + option.</p> + + <p>The following functions are inlined:</p> + <list type="bulleted"> + <item><seealso marker="stdlib:lists#all/2">lists:all/2</seealso></item> + <item><seealso marker="stdlib:lists#any/2">lists:any/2</seealso></item> + <item><seealso marker="stdlib:lists#foreach/2">lists:foreach/2</seealso></item> + <item><seealso marker="stdlib:lists#map/2">lists:map/2</seealso></item> + <item><seealso marker="stdlib:lists#flatmap/2">lists:flatmap/2</seealso></item> + <item><seealso marker="stdlib:lists#filter/2">lists:filter/2</seealso></item> + <item><seealso marker="stdlib:lists#foldl/3">lists:foldl/3</seealso></item> + <item><seealso marker="stdlib:lists#foldr/3">lists:foldr/3</seealso></item> + <item><seealso marker="stdlib:lists#mapfoldl/3">lists:mapfoldl/3</seealso></item> + <item><seealso marker="stdlib:lists#mapfoldr/3">lists:mapfoldr/3</seealso></item> + </list> + </section> + + <section> <title>Parse Transformations</title> <p>Parse transformations are used when a programmer wants to use diff --git a/lib/compiler/src/Makefile b/lib/compiler/src/Makefile index cbcbf79839..8d54dffd73 100644 --- a/lib/compiler/src/Makefile +++ b/lib/compiler/src/Makefile @@ -82,7 +82,6 @@ MODULES = \ sys_core_dsetel \ sys_core_fold \ sys_core_inline \ - sys_expand_pmod \ sys_pre_attributes \ sys_pre_expand \ v3_codegen \ @@ -145,19 +144,19 @@ clean: # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(EGEN)/beam_opcodes.erl $(EGEN)/beam_opcodes.hrl: genop.tab - $(PERL) $(ERL_TOP)/erts/emulator/utils/beam_makeops -compiler -outdir $(EGEN) $< + $(gen_verbose)$(PERL) $(ERL_TOP)/erts/emulator/utils/beam_makeops -compiler -outdir $(EGEN) $< $(EBIN)/beam_asm.beam: $(ESRC)/beam_asm.erl $(EGEN)/beam_opcodes.hrl - $(ERLC) $(ERL_COMPILE_FLAGS) -DCOMPILER_VSN='"$(VSN)"' -o$(EBIN) $< + $(V_ERLC) $(ERL_COMPILE_FLAGS) -DCOMPILER_VSN='"$(VSN)"' -o$(EBIN) $< $(EBIN)/cerl_inline.beam: $(ESRC)/cerl_inline.erl - $(ERLC) $(ERL_COMPILE_FLAGS) +nowarn_shadow_vars -o$(EBIN) $< + $(V_ERLC) $(ERL_COMPILE_FLAGS) +nowarn_shadow_vars -o$(EBIN) $< # ---------------------------------------------------- # Release Target diff --git a/lib/compiler/src/beam_dict.erl b/lib/compiler/src/beam_dict.erl index 531968b3c8..ff6c7c11dc 100644 --- a/lib/compiler/src/beam_dict.erl +++ b/lib/compiler/src/beam_dict.erl @@ -138,7 +138,17 @@ string(Str, Dict) when is_list(Str) -> -spec lambda(label(), non_neg_integer(), bdict()) -> {non_neg_integer(), bdict()}. -lambda(Lbl, NumFree, #asm{lambdas=Lambdas0}=Dict) -> +lambda(Lbl, 0, #asm{lambdas=Lambdas0}=Dict) -> + case lists:keyfind(Lbl, 1, Lambdas0) of + {Lbl,{OldIndex,_,_,_,_}} -> + {OldIndex,Dict}; + false -> + new_lambda(Lbl, 0, Dict) + end; +lambda(Lbl, NumFree, Dict) -> + new_lambda(Lbl, NumFree, Dict). + +new_lambda(Lbl, NumFree, #asm{lambdas=Lambdas0}=Dict) -> OldIndex = length(Lambdas0), %% Set Index the same as OldIndex. Index = OldIndex, @@ -235,10 +245,12 @@ string_table(#asm{strings=Strings,string_offset=Size}) -> -spec lambda_table(bdict()) -> {non_neg_integer(), [<<_:192>>]}. -lambda_table(#asm{locals=Loc0,lambdas=Lambdas0}) -> +lambda_table(#asm{exports=Ext0,locals=Loc0,lambdas=Lambdas0}) -> Lambdas1 = sofs:relation(Lambdas0), Loc = sofs:relation([{Lbl,{F,A}} || {F,A,Lbl} <- Loc0]), - Lambdas2 = sofs:relative_product1(Lambdas1, Loc), + Ext = sofs:relation([{Lbl,{F,A}} || {F,A,Lbl} <- Ext0]), + All = sofs:union(Loc, Ext), + Lambdas2 = sofs:relative_product1(Lambdas1, All), Lambdas = [<<F:32,A:32,Lbl:32,Index:32,NumFree:32,OldUniq:32>> || {{_,Lbl,Index,NumFree,OldUniq},{F,A}} <- sofs:to_external(Lambdas2)], {length(Lambdas),Lambdas}. diff --git a/lib/compiler/src/compile.erl b/lib/compiler/src/compile.erl index 2d1557fa5b..5f394f0b65 100644 --- a/lib/compiler/src/compile.erl +++ b/lib/compiler/src/compile.erl @@ -895,7 +895,6 @@ foldl_core_transforms(St, []) -> {ok,St}. %%% Fetches the module name from a list of forms. The module attribute must %%% be present. -get_module([{attribute,_,module,{M,_As}} | _]) -> M; get_module([{attribute,_,module,M} | _]) -> M; get_module([_ | Rest]) -> get_module(Rest). diff --git a/lib/compiler/src/compiler.app.src b/lib/compiler/src/compiler.app.src index 94c78e68f9..9a02121d8b 100644 --- a/lib/compiler/src/compiler.app.src +++ b/lib/compiler/src/compiler.app.src @@ -57,7 +57,6 @@ sys_core_dsetel, sys_core_fold, sys_core_inline, - sys_expand_pmod, sys_pre_attributes, sys_pre_expand, v3_codegen, diff --git a/lib/compiler/src/core_lint.erl b/lib/compiler/src/core_lint.erl index b513a8965c..21296a8b66 100644 --- a/lib/compiler/src/core_lint.erl +++ b/lib/compiler/src/core_lint.erl @@ -247,7 +247,8 @@ gbody(E, Def, Rt, St0) -> false -> St1 end. -gexpr(#c_var{name=N}, Def, _Rt, St) -> expr_var(N, Def, St); +gexpr(#c_var{name=N}, Def, _Rt, St) when is_atom(N); is_integer(N) -> + expr_var(N, Def, St); gexpr(#c_literal{}, _Def, _Rt, St) -> St; gexpr(#c_cons{hd=H,tl=T}, Def, _Rt, St) -> gexpr_list([H,T], Def, St); diff --git a/lib/compiler/src/sys_core_fold.erl b/lib/compiler/src/sys_core_fold.erl index 18fba7962b..f17b0bd130 100644 --- a/lib/compiler/src/sys_core_fold.erl +++ b/lib/compiler/src/sys_core_fold.erl @@ -686,11 +686,14 @@ call_1(#c_call{anno=Anno}, lists, all, [Arg1,Arg2], Sub) -> C1 = #c_clause{pats=[#c_cons{hd=X, tl=Xs}], guard=#c_literal{val=true}, body=#c_case{arg=#c_apply{anno=Anno, op=F, args=[X]}, clauses = [CC1, CC2, CC3]}}, - C2 = #c_clause{pats=[#c_literal{val=[]}], guard=#c_literal{val=true}, + C2 = #c_clause{pats=[#c_literal{val=[]}], + guard=#c_call{module=#c_literal{val=erlang}, + name=#c_literal{val=is_function}, + args=[F, #c_literal{val=1}]}, body=#c_literal{val=true}}, - Err2 = #c_tuple{es=[#c_literal{val='function_clause'}, Xs]}, + Err2 = #c_tuple{es=[#c_literal{val='function_clause'}, F, Xs]}, C3 = #c_clause{pats=[Xs], guard=#c_literal{val=true}, - body=match_fail(Anno, Err2)}, + body=match_fail([{function_name,{'lists^all',1}}|Anno], Err2)}, Fun = #c_fun{vars=[Xs], body=#c_case{arg=Xs, clauses=[C1, C2, C3]}}, L = #c_var{name='L'}, @@ -713,11 +716,14 @@ call_1(#c_call{anno=Anno}, lists, any, [Arg1,Arg2], Sub) -> C1 = #c_clause{pats=[#c_cons{hd=X, tl=Xs}], guard=#c_literal{val=true}, body=#c_case{arg=#c_apply{anno=Anno, op=F, args=[X]}, clauses = [CC1, CC2, CC3]}}, - C2 = #c_clause{pats=[#c_literal{val=[]}], guard=#c_literal{val=true}, + C2 = #c_clause{pats=[#c_literal{val=[]}], + guard=#c_call{module=#c_literal{val=erlang}, + name=#c_literal{val=is_function}, + args=[F, #c_literal{val=1}]}, body=#c_literal{val=false}}, - Err2 = #c_tuple{es=[#c_literal{val='function_clause'}, Xs]}, + Err2 = #c_tuple{es=[#c_literal{val='function_clause'}, F, Xs]}, C3 = #c_clause{pats=[Xs], guard=#c_literal{val=true}, - body=match_fail(Anno, Err2)}, + body=match_fail([{function_name,{'lists^any',1}}|Anno], Err2)}, Fun = #c_fun{vars=[Xs], body=#c_case{arg=Xs, clauses=[C1, C2, C3]}}, L = #c_var{name='L'}, @@ -733,11 +739,14 @@ call_1(#c_call{anno=Anno}, lists, foreach, [Arg1,Arg2], Sub) -> C1 = #c_clause{pats=[#c_cons{hd=X, tl=Xs}], guard=#c_literal{val=true}, body=#c_seq{arg=#c_apply{anno=Anno, op=F, args=[X]}, body=#c_apply{anno=Anno, op=Loop, args=[Xs]}}}, - C2 = #c_clause{pats=[#c_literal{val=[]}], guard=#c_literal{val=true}, + C2 = #c_clause{pats=[#c_literal{val=[]}], + guard=#c_call{module=#c_literal{val=erlang}, + name=#c_literal{val=is_function}, + args=[F, #c_literal{val=1}]}, body=#c_literal{val=ok}}, - Err = #c_tuple{es=[#c_literal{val='function_clause'}, Xs]}, + Err = #c_tuple{es=[#c_literal{val='function_clause'}, F, Xs]}, C3 = #c_clause{pats=[Xs], guard=#c_literal{val=true}, - body=match_fail(Anno, Err)}, + body=match_fail([{function_name,{'lists^foreach',1}}|Anno], Err)}, Fun = #c_fun{vars=[Xs], body=#c_case{arg=Xs, clauses=[C1, C2, C3]}}, L = #c_var{name='L'}, @@ -756,14 +765,18 @@ call_1(#c_call{anno=Anno}, lists, map, [Arg1,Arg2], Sub) -> op=F, args=[X]}, body=#c_cons{hd=H, + anno=[compiler_generated], tl=#c_apply{anno=Anno, op=Loop, args=[Xs]}}}}, - C2 = #c_clause{pats=[#c_literal{val=[]}], guard=#c_literal{val=true}, + C2 = #c_clause{pats=[#c_literal{val=[]}], + guard=#c_call{module=#c_literal{val=erlang}, + name=#c_literal{val=is_function}, + args=[F, #c_literal{val=1}]}, body=#c_literal{val=[]}}, - Err = #c_tuple{es=[#c_literal{val='function_clause'}, Xs]}, + Err = #c_tuple{es=[#c_literal{val='function_clause'}, F, Xs]}, C3 = #c_clause{pats=[Xs], guard=#c_literal{val=true}, - body=match_fail(Anno, Err)}, + body=match_fail([{function_name,{'lists^map',1}}|Anno], Err)}, Fun = #c_fun{vars=[Xs], body=#c_case{arg=Xs, clauses=[C1, C2, C3]}}, L = #c_var{name='L'}, @@ -780,18 +793,21 @@ call_1(#c_call{anno=Anno}, lists, flatmap, [Arg1,Arg2], Sub) -> C1 = #c_clause{pats=[#c_cons{hd=X, tl=Xs}], guard=#c_literal{val=true}, body=#c_let{vars=[H], arg=#c_apply{anno=Anno, op=F, args=[X]}, - body=#c_call{anno=Anno, + body=#c_call{anno=[compiler_generated|Anno], module=#c_literal{val=erlang}, name=#c_literal{val='++'}, args=[H, #c_apply{anno=Anno, op=Loop, args=[Xs]}]}}}, - C2 = #c_clause{pats=[#c_literal{val=[]}], guard=#c_literal{val=true}, + C2 = #c_clause{pats=[#c_literal{val=[]}], + guard=#c_call{module=#c_literal{val=erlang}, + name=#c_literal{val=is_function}, + args=[F, #c_literal{val=1}]}, body=#c_literal{val=[]}}, - Err = #c_tuple{es=[#c_literal{val='function_clause'}, Xs]}, + Err = #c_tuple{es=[#c_literal{val='function_clause'}, F, Xs]}, C3 = #c_clause{pats=[Xs], guard=#c_literal{val=true}, - body=match_fail(Anno, Err)}, + body=match_fail([{function_name,{'lists^flatmap',1}}|Anno], Err)}, Fun = #c_fun{vars=[Xs], body=#c_case{arg=Xs, clauses=[C1, C2, C3]}}, L = #c_var{name='L'}, @@ -807,7 +823,7 @@ call_1(#c_call{anno=Anno}, lists, filter, [Arg1,Arg2], Sub) -> B = #c_var{name='B'}, Err1 = #c_tuple{es=[#c_literal{val='case_clause'}, X]}, CC1 = #c_clause{pats=[#c_literal{val=true}], guard=#c_literal{val=true}, - body=#c_cons{hd=X, tl=Xs}}, + body=#c_cons{anno=[compiler_generated], hd=X, tl=Xs}}, CC2 = #c_clause{pats=[#c_literal{val=false}], guard=#c_literal{val=true}, body=Xs}, CC3 = #c_clause{pats=[X], guard=#c_literal{val=true}, @@ -821,11 +837,14 @@ call_1(#c_call{anno=Anno}, lists, filter, [Arg1,Arg2], Sub) -> op=Loop, args=[Xs]}, body=Case}}}, - C2 = #c_clause{pats=[#c_literal{val=[]}], guard=#c_literal{val=true}, + C2 = #c_clause{pats=[#c_literal{val=[]}], + guard=#c_call{module=#c_literal{val=erlang}, + name=#c_literal{val=is_function}, + args=[F, #c_literal{val=1}]}, body=#c_literal{val=[]}}, - Err2 = #c_tuple{es=[#c_literal{val='function_clause'}, Xs]}, + Err2 = #c_tuple{es=[#c_literal{val='function_clause'}, F, Xs]}, C3 = #c_clause{pats=[Xs], guard=#c_literal{val=true}, - body=match_fail(Anno, Err2)}, + body=match_fail([{function_name,{'lists^filter',1}}|Anno], Err2)}, Fun = #c_fun{vars=[Xs], body=#c_case{arg=Xs, clauses=[C1, C2, C3]}}, L = #c_var{name='L'}, @@ -845,10 +864,14 @@ call_1(#c_call{anno=Anno}, lists, foldl, [Arg1,Arg2,Arg3], Sub) -> args=[Xs, #c_apply{anno=Anno, op=F, args=[X, A]}]}}, - C2 = #c_clause{pats=[#c_literal{val=[]}], guard=#c_literal{val=true}, body=A}, - Err = #c_tuple{es=[#c_literal{val='function_clause'}, Xs]}, + C2 = #c_clause{pats=[#c_literal{val=[]}], + guard=#c_call{module=#c_literal{val=erlang}, + name=#c_literal{val=is_function}, + args=[F, #c_literal{val=2}]}, + body=A}, + Err = #c_tuple{es=[#c_literal{val='function_clause'}, F, A, Xs]}, C3 = #c_clause{pats=[Xs], guard=#c_literal{val=true}, - body=match_fail(Anno, Err)}, + body=match_fail([{function_name,{'lists^foldl',2}}|Anno], Err)}, Fun = #c_fun{vars=[Xs, A], body=#c_case{arg=Xs, clauses=[C1, C2, C3]}}, L = #c_var{name='L'}, @@ -868,10 +891,14 @@ call_1(#c_call{anno=Anno}, lists, foldr, [Arg1,Arg2,Arg3], Sub) -> args=[X, #c_apply{anno=Anno, op=Loop, args=[Xs, A]}]}}, - C2 = #c_clause{pats=[#c_literal{val=[]}], guard=#c_literal{val=true}, body=A}, - Err = #c_tuple{es=[#c_literal{val='function_clause'}, Xs]}, + C2 = #c_clause{pats=[#c_literal{val=[]}], + guard=#c_call{module=#c_literal{val=erlang}, + name=#c_literal{val=is_function}, + args=[F, #c_literal{val=2}]}, + body=A}, + Err = #c_tuple{es=[#c_literal{val='function_clause'}, F, A, Xs]}, C3 = #c_clause{pats=[Xs], guard=#c_literal{val=true}, - body=match_fail(Anno, Err)}, + body=match_fail([{function_name,{'lists^foldr',2}}|Anno], Err)}, Fun = #c_fun{vars=[Xs, A], body=#c_case{arg=Xs, clauses=[C1, C2, C3]}}, L = #c_var{name='L'}, @@ -901,7 +928,10 @@ call_1(#c_call{anno=Anno}, lists, mapfoldl, [Arg1,Arg2,Arg3], Sub) -> op=Loop, args=[Xs, Avar]}, #c_tuple{es=[Xs, Avar]}, - #c_tuple{es=[#c_cons{hd=X, tl=Xs}, Avar]}) + #c_tuple{anno=[compiler_generated], + es=[#c_cons{anno=[compiler_generated], + hd=X, tl=Xs}, + Avar]}) %%% Multiple-value version %%% #c_let{vars=[Xs,A], %%% %% The tuple here will be optimised @@ -910,14 +940,18 @@ call_1(#c_call{anno=Anno}, lists, mapfoldl, [Arg1,Arg2,Arg3], Sub) -> %%% body=#c_values{es=[#c_cons{hd=X, tl=Xs}, %%% A]}} )}, - C2 = #c_clause{pats=[#c_literal{val=[]}], guard=#c_literal{val=true}, + C2 = #c_clause{pats=[#c_literal{val=[]}], + guard=#c_call{module=#c_literal{val=erlang}, + name=#c_literal{val=is_function}, + args=[F, #c_literal{val=2}]}, %%% Tuple passing version - body=#c_tuple{es=[#c_literal{val=[]}, Avar]}}, + body=#c_tuple{anno=[compiler_generated], + es=[#c_literal{val=[]}, Avar]}}, %%% Multiple-value version %%% body=#c_values{es=[#c_literal{val=[]}, A]}}, - Err = #c_tuple{es=[#c_literal{val='function_clause'}, Xs]}, + Err = #c_tuple{es=[#c_literal{val='function_clause'}, F, Avar, Xs]}, C3 = #c_clause{pats=[Xs], guard=#c_literal{val=true}, - body=match_fail(Anno, Err)}, + body=match_fail([{function_name,{'lists^mapfoldl',2}}|Anno], Err)}, Fun = #c_fun{vars=[Xs, Avar], body=#c_case{arg=Xs, clauses=[C1, C2, C3]}}, L = #c_var{name='L'}, @@ -955,7 +989,9 @@ call_1(#c_call{anno=Anno}, lists, mapfoldr, [Arg1,Arg2,Arg3], Sub) -> #c_tuple{es=[Xs, Avar]}, Match(#c_apply{anno=Anno, op=F, args=[X, Avar]}, #c_tuple{es=[X, Avar]}, - #c_tuple{es=[#c_cons{hd=X, tl=Xs}, Avar]})) + #c_tuple{anno=[compiler_generated], + es=[#c_cons{anno=[compiler_generated], + hd=X, tl=Xs}, Avar]})) %%% Multiple-value version %%% body=#c_let{vars=[Xs,A], %%% %% The tuple will be optimised away @@ -965,14 +1001,18 @@ call_1(#c_call{anno=Anno}, lists, mapfoldr, [Arg1,Arg2,Arg3], Sub) -> %%% #c_values{es=[#c_cons{hd=X, tl=Xs}, %%% A]})} }, - C2 = #c_clause{pats=[#c_literal{val=[]}], guard=#c_literal{val=true}, + C2 = #c_clause{pats=[#c_literal{val=[]}], + guard=#c_call{module=#c_literal{val=erlang}, + name=#c_literal{val=is_function}, + args=[F, #c_literal{val=2}]}, %%% Tuple passing version - body=#c_tuple{es=[#c_literal{val=[]}, Avar]}}, + body=#c_tuple{anno=[compiler_generated], + es=[#c_literal{val=[]}, Avar]}}, %%% Multiple-value version %%% body=#c_values{es=[#c_literal{val=[]}, A]}}, - Err = #c_tuple{es=[#c_literal{val='function_clause'}, Xs]}, + Err = #c_tuple{es=[#c_literal{val='function_clause'}, F, Avar, Xs]}, C3 = #c_clause{pats=[Xs], guard=#c_literal{val=true}, - body=match_fail(Anno, Err)}, + body=match_fail([{function_name,{'lists^mapfoldr',2}}|Anno], Err)}, Fun = #c_fun{vars=[Xs, Avar], body=#c_case{arg=Xs, clauses=[C1, C2, C3]}}, L = #c_var{name='L'}, diff --git a/lib/compiler/src/sys_expand_pmod.erl b/lib/compiler/src/sys_expand_pmod.erl deleted file mode 100644 index da644b4f0b..0000000000 --- a/lib/compiler/src/sys_expand_pmod.erl +++ /dev/null @@ -1,433 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2004-2011. All Rights Reserved. -%% -%% The contents of this file are subject to the Erlang Public License, -%% Version 1.1, (the "License"); you may not use this file except in -%% compliance with the License. You should have received a copy of the -%% Erlang Public License along with this software. If not, it can be -%% retrieved online at http://www.erlang.org/. -%% -%% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -%% the License for the specific language governing rights and limitations -%% under the License. -%% -%% %CopyrightEnd% -%% --module(sys_expand_pmod). - -%% Expand function definition forms of parameterized module. We assume -%% all record definitions, imports, queries, etc., have been expanded -%% away. Any calls on the form 'foo(...)' must be calls to local -%% functions. Auto-generated functions (module_info,...) have not yet -%% been added to the function definitions, but are listed in 'defined' -%% and 'exports'. The automatic 'new/N' function is neither added to the -%% definitions nor to the 'exports'/'defines' lists yet. - --export([forms/4]). - --record(pmod, {parameters, exports, defined, predef}). - -%% TODO: more abstract handling of predefined/static functions. - -forms(Fs0, Ps, Es0, Ds0) -> - PreDef = [{module_info,0},{module_info,1}], - forms(Fs0, Ps, Es0, Ds0, PreDef). - -forms(Fs0, Ps, Es0, Ds0, PreDef) -> - St0 = #pmod{parameters=Ps,exports=Es0,defined=Ds0, predef=PreDef}, - {Fs1, St1} = forms(Fs0, St0), - Es1 = update_function_names(Es0, St1), - Ds1 = update_function_names(Ds0, St1), - Fs2 = update_forms(Fs1, St1), - {Fs2,Es1,Ds1}. - -%% This is extremely simplistic for now; all functions get an extra -%% parameter, whether they need it or not, except for static functions. - -update_function_names(Es, St) -> - [update_function_name(E, St) || E <- Es]. - -update_function_name(E={F,A}, St) when F =/= new -> - case ordsets:is_element(E, St#pmod.predef) of - true -> E; - false -> {F, A + 1} - end; -update_function_name(E, _St) -> - E. - -update_forms([{function,L,N,A,Cs}|Fs],St) when N =/= new -> - [{function,L,N,A+1,Cs}|update_forms(Fs,St)]; -update_forms([F|Fs],St) -> - [F|update_forms(Fs,St)]; -update_forms([],_St) -> - []. - -%% Process the program forms. - -forms([F0|Fs0],St0) -> - {F1,St1} = form(F0,St0), - {Fs1,St2} = forms(Fs0,St1), - {[F1|Fs1],St2}; -forms([], St0) -> - {[], St0}. - -%% Only function definitions are of interest here. State is not updated. -form({function,Line,Name0,Arity0,Clauses0},St) when Name0 =/= new -> - {Name,Arity,Clauses} = function(Name0, Arity0, Clauses0, St), - {{function,Line,Name,Arity,Clauses},St}; -%% Pass anything else through -form(F,St) -> {F,St}. - -function(Name, Arity, Clauses0, St) -> - Clauses1 = clauses(Clauses0,St), - {Name,Arity,Clauses1}. - -clauses([C|Cs],St) -> - {clause,L,H,G,B} = clause(C,St), - T = {tuple,L,[{var,L,V} || V <- ['_'|St#pmod.parameters]]}, - [{clause,L,H++[{match,L,T,{var,L,'THIS'}}],G,B}|clauses(Cs,St)]; -clauses([],_St) -> []. - -clause({clause,Line,H0,G0,B0},St) -> - H1 = head(H0,St), - G1 = guard(G0,St), - B1 = exprs(B0,St), - {clause,Line,H1,G1,B1}. - -head(Ps,St) -> patterns(Ps,St). - -patterns([P0|Ps],St) -> - P1 = pattern(P0,St), - [P1|patterns(Ps,St)]; -patterns([],_St) -> []. - -string_to_conses([], _Line, Tail) -> - Tail; -string_to_conses([E|Rest], Line, Tail) -> - {cons, Line, {integer, Line, E}, string_to_conses(Rest, Line, Tail)}. - -pattern({var,_Line,_V}=Var,_St) -> Var; -pattern({match,Line,L0,R0},St) -> - L1 = pattern(L0,St), - R1 = pattern(R0,St), - {match,Line,L1,R1}; -pattern({integer,_Line,_I}=Integer,_St) -> Integer; -pattern({char,_Line,_C}=Char,_St) -> Char; -pattern({float,_Line,_F}=Float,_St) -> Float; -pattern({atom,_Line,_A}=Atom,_St) -> Atom; -pattern({string,_Line,_S}=String,_St) -> String; -pattern({nil,_Line}=Nil,_St) -> Nil; -pattern({cons,Line,H0,T0},St) -> - H1 = pattern(H0,St), - T1 = pattern(T0,St), - {cons,Line,H1,T1}; -pattern({tuple,Line,Ps0},St) -> - Ps1 = pattern_list(Ps0,St), - {tuple,Line,Ps1}; -pattern({bin,Line,Fs},St) -> - Fs2 = pattern_grp(Fs,St), - {bin,Line,Fs2}; -pattern({op,_Line,'++',{nil,_},R},St) -> - pattern(R,St); -pattern({op,_Line,'++',{cons,Li,{char,_C2,_I}=Char,T},R},St) -> - pattern({cons,Li,Char,{op,Li,'++',T,R}},St); -pattern({op,_Line,'++',{cons,Li,{integer,_L2,_I}=Integer,T},R},St) -> - pattern({cons,Li,Integer,{op,Li,'++',T,R}},St); -pattern({op,_Line,'++',{string,Li,L},R},St) -> - pattern(string_to_conses(L, Li, R),St); -pattern({op,_Line,_Op,_A}=Op4,_St) -> Op4; -pattern({op,_Line,_Op,_L,_R}=Op5,_St) -> Op5. - -pattern_grp([{bin_element,L1,E1,S1,T1} | Fs],St) -> - S2 = case S1 of - default -> - default; - _ -> - expr(S1,St) - end, - T2 = case T1 of - default -> - default; - _ -> - bit_types(T1) - end, - [{bin_element,L1,expr(E1,St),S2,T2} | pattern_grp(Fs,St)]; -pattern_grp([],_St) -> - []. - -bit_types([]) -> - []; -bit_types([Atom | Rest]) when is_atom(Atom) -> - [Atom | bit_types(Rest)]; -bit_types([{Atom, Integer} | Rest]) when is_atom(Atom), is_integer(Integer) -> - [{Atom, Integer} | bit_types(Rest)]. - -pattern_list([P0|Ps],St) -> - P1 = pattern(P0,St), - [P1|pattern_list(Ps,St)]; -pattern_list([],_St) -> []. - -guard([G0|Gs],St) when is_list(G0) -> - [guard0(G0,St) | guard(Gs,St)]; -guard(L,St) -> - guard0(L,St). - -guard0([G0|Gs],St) -> - G1 = guard_test(G0,St), - [G1|guard0(Gs,St)]; -guard0([],_St) -> []. - -guard_test(Expr={call,Line,{atom,La,F},As0},St) -> - case erl_internal:type_test(F, length(As0)) of - true -> - As1 = gexpr_list(As0,St), - {call,Line,{atom,La,F},As1}; - _ -> - gexpr(Expr,St) - end; -guard_test(Any,St) -> - gexpr(Any,St). - -gexpr({var,_L,_V}=Var,_St) -> Var; -% %% alternative implementation of accessing module parameters -% case index(V,St#pmod.parameters) of -% N when N > 0 -> -% {call,L,{remote,L,{atom,L,erlang},{atom,L,element}}, -% [{integer,L,N+1},{var,L,'THIS'}]}; -% _ -> -% Var -% end; -gexpr({integer,_Line,_I}=Integer,_St) -> Integer; -gexpr({char,_Line,_C}=Char,_St) -> Char; -gexpr({float,_Line,_F}=Float,_St) -> Float; -gexpr({atom,_Line,_A}=Atom,_St) -> Atom; -gexpr({string,_Line,_S}=String,_St) -> String; -gexpr({nil,_Line}=Nil,_St) -> Nil; -gexpr({cons,Line,H0,T0},St) -> - H1 = gexpr(H0,St), - T1 = gexpr(T0,St), - {cons,Line,H1,T1}; -gexpr({tuple,Line,Es0},St) -> - Es1 = gexpr_list(Es0,St), - {tuple,Line,Es1}; -gexpr({call,Line,{atom,_La,F}=Atom,As0},St) -> - true = erl_internal:guard_bif(F, length(As0)), - As1 = gexpr_list(As0,St), - {call,Line,Atom,As1}; -%% Pre-expansion generated calls to erlang:is_record/3 must also be handled -gexpr({call,Line,{remote,La,{atom,Lb,erlang},{atom,Lc,is_record}},[_,_,_]=As0},St) -> - As1 = gexpr_list(As0,St), - {call,Line,{remote,La,{atom,Lb,erlang},{atom,Lc,is_record}},As1}; -%% Guard BIFs can be remote, but only in the module erlang... -gexpr({call,Line,{remote,La,{atom,Lb,erlang},{atom,Lc,F}},As0},St) -> - A = length(As0), - true = - erl_internal:guard_bif(F, A) orelse erl_internal:arith_op(F, A) orelse - erl_internal:comp_op(F, A) orelse erl_internal:bool_op(F, A), - As1 = gexpr_list(As0,St), - {call,Line,{remote,La,{atom,Lb,erlang},{atom,Lc,F}},As1}; -%% Unfortunately, writing calls as {M,F}(...) is also allowed. -gexpr({call,Line,{tuple,La,[{atom,Lb,erlang},{atom,Lc,F}]},As0},St) -> - A = length(As0), - true = - erl_internal:guard_bif(F, A) orelse erl_internal:arith_op(F, A) orelse - erl_internal:comp_op(F, A) orelse erl_internal:bool_op(F, A), - As1 = gexpr_list(As0,St), - {call,Line,{tuple,La,[{atom,Lb,erlang},{atom,Lc,F}]},As1}; -gexpr({bin,Line,Fs},St) -> - Fs2 = pattern_grp(Fs,St), - {bin,Line,Fs2}; -gexpr({op,Line,Op,A0},St) -> - true = erl_internal:arith_op(Op, 1) orelse erl_internal:bool_op(Op, 1), - A1 = gexpr(A0,St), - {op,Line,Op,A1}; -gexpr({op,Line,Op,L0,R0},St) -> - true = - Op =:= 'andalso' orelse Op =:= 'orelse' orelse - erl_internal:arith_op(Op, 2) orelse - erl_internal:bool_op(Op, 2) orelse erl_internal:comp_op(Op, 2), - L1 = gexpr(L0,St), - R1 = gexpr(R0,St), - {op,Line,Op,L1,R1}. - -gexpr_list([E0|Es],St) -> - E1 = gexpr(E0,St), - [E1|gexpr_list(Es,St)]; -gexpr_list([],_St) -> []. - -exprs([E0|Es],St) -> - E1 = expr(E0,St), - [E1|exprs(Es,St)]; -exprs([],_St) -> []. - -expr({var,_L,_V}=Var,_St) -> - Var; -% case index(V,St#pmod.parameters) of -% N when N > 0 -> -% {call,L,{remote,L,{atom,L,erlang},{atom,L,element}}, -% [{integer,L,N+1},{var,L,'THIS'}]}; -% _ -> -% Var -% end; -expr({integer,_Line,_I}=Integer,_St) -> Integer; -expr({float,_Line,_F}=Float,_St) -> Float; -expr({atom,_Line,_A}=Atom,_St) -> Atom; -expr({string,_Line,_S}=String,_St) -> String; -expr({char,_Line,_C}=Char,_St) -> Char; -expr({nil,_Line}=Nil,_St) -> Nil; -expr({cons,Line,H0,T0},St) -> - H1 = expr(H0,St), - T1 = expr(T0,St), - {cons,Line,H1,T1}; -expr({lc,Line,E0,Qs0},St) -> - Qs1 = lc_bc_quals(Qs0,St), - E1 = expr(E0,St), - {lc,Line,E1,Qs1}; -expr({bc,Line,E0,Qs0},St) -> - Qs1 = lc_bc_quals(Qs0,St), - E1 = expr(E0,St), - {bc,Line,E1,Qs1}; -expr({tuple,Line,Es0},St) -> - Es1 = expr_list(Es0,St), - {tuple,Line,Es1}; -expr({block,Line,Es0},St) -> - Es1 = exprs(Es0,St), - {block,Line,Es1}; -expr({'if',Line,Cs0},St) -> - Cs1 = icr_clauses(Cs0,St), - {'if',Line,Cs1}; -expr({'case',Line,E0,Cs0},St) -> - E1 = expr(E0,St), - Cs1 = icr_clauses(Cs0,St), - {'case',Line,E1,Cs1}; -expr({'receive',Line,Cs0},St) -> - Cs1 = icr_clauses(Cs0,St), - {'receive',Line,Cs1}; -expr({'receive',Line,Cs0,To0,ToEs0},St) -> - To1 = expr(To0,St), - ToEs1 = exprs(ToEs0,St), - Cs1 = icr_clauses(Cs0,St), - {'receive',Line,Cs1,To1,ToEs1}; -expr({'try',Line,Es0,Scs0,Ccs0,As0},St) -> - Es1 = exprs(Es0,St), - Scs1 = icr_clauses(Scs0,St), - Ccs1 = icr_clauses(Ccs0,St), - As1 = exprs(As0,St), - {'try',Line,Es1,Scs1,Ccs1,As1}; -expr({'fun',_,{function,_,_,_}}=ExtFun,_St) -> - ExtFun; -expr({'fun',Line,Body,Info},St) -> - case Body of - {clauses,Cs0} -> - Cs1 = fun_clauses(Cs0,St), - {'fun',Line,{clauses,Cs1},Info}; - {function,F,A} = Function -> - {F1,A1} = update_function_name({F,A},St), - if A1 =:= A -> - {'fun',Line,Function,Info}; - true -> - %% Must rewrite local fun-name to a fun that does a - %% call with the extra THIS parameter. - As = make_vars(A, Line), - As1 = As ++ [{var,Line,'THIS'}], - Call = {call,Line,{atom,Line,F1},As1}, - Cs = [{clause,Line,As,[],[Call]}], - {'fun',Line,{clauses,Cs},Info} - end; - {function,_M,_F,_A} = Fun4 -> %This is an error in lint! - {'fun',Line,Fun4,Info} - end; -expr({call,Lc,{atom,_,instance}=Name,As0},St) -> - %% All local functions 'instance(...)' are static by definition, - %% so they do not take a 'THIS' argument when called - As1 = expr_list(As0,St), - {call,Lc,Name,As1}; -expr({call,Lc,{atom,_,new}=Name,As0},St) -> - %% All local functions 'new(...)' are static by definition, - %% so they do not take a 'THIS' argument when called - As1 = expr_list(As0,St), - {call,Lc,Name,As1}; -expr({call,Lc,{atom,_,module_info}=Name,As0},St) - when length(As0) =:= 0; length(As0) =:= 1 -> - %% The module_info/0 and module_info/1 functions are also static. - As1 = expr_list(As0,St), - {call,Lc,Name,As1}; -expr({call,Lc,{atom,_Lf,_F}=Atom,As0},St) -> - %% Local function call - needs THIS parameter. - As1 = expr_list(As0,St), - {call,Lc,Atom,As1 ++ [{var,0,'THIS'}]}; -expr({call,Line,F0,As0},St) -> - %% Other function call - F1 = expr(F0,St), - As1 = expr_list(As0,St), - {call,Line,F1,As1}; -expr({'catch',Line,E0},St) -> - E1 = expr(E0,St), - {'catch',Line,E1}; -expr({match,Line,P0,E0},St) -> - E1 = expr(E0,St), - P1 = pattern(P0,St), - {match,Line,P1,E1}; -expr({bin,Line,Fs},St) -> - Fs2 = pattern_grp(Fs,St), - {bin,Line,Fs2}; -expr({op,Line,Op,A0},St) -> - A1 = expr(A0,St), - {op,Line,Op,A1}; -expr({op,Line,Op,L0,R0},St) -> - L1 = expr(L0,St), - R1 = expr(R0,St), - {op,Line,Op,L1,R1}; -%% The following are not allowed to occur anywhere! -expr({remote,Line,M0,F0},St) -> - M1 = expr(M0,St), - F1 = expr(F0,St), - {remote,Line,M1,F1}. - -expr_list([E0|Es],St) -> - E1 = expr(E0,St), - [E1|expr_list(Es,St)]; -expr_list([],_St) -> []. - -icr_clauses([C0|Cs],St) -> - C1 = clause(C0,St), - [C1|icr_clauses(Cs,St)]; -icr_clauses([],_St) -> []. - -lc_bc_quals([{generate,Line,P0,E0}|Qs],St) -> - E1 = expr(E0,St), - P1 = pattern(P0,St), - [{generate,Line,P1,E1}|lc_bc_quals(Qs,St)]; -lc_bc_quals([{b_generate,Line,P0,E0}|Qs],St) -> - E1 = expr(E0,St), - P1 = pattern(P0,St), - [{b_generate,Line,P1,E1}|lc_bc_quals(Qs,St)]; -lc_bc_quals([E0|Qs],St) -> - E1 = expr(E0,St), - [E1|lc_bc_quals(Qs,St)]; -lc_bc_quals([],_St) -> []. - -fun_clauses([C0|Cs],St) -> - C1 = clause(C0,St), - [C1|fun_clauses(Cs,St)]; -fun_clauses([],_St) -> []. - -%% %% Return index from 1 upwards, or 0 if not in the list. -%% -%% index(X,Ys) -> index(X,Ys,1). -%% -%% index(X,[X|Ys],A) -> A; -%% index(X,[Y|Ys],A) -> index(X,Ys,A+1); -%% index(X,[],A) -> 0. - -make_vars(N, L) -> - make_vars(1, N, L). - -make_vars(N, M, L) when N =< M -> - V = list_to_atom("X"++integer_to_list(N)), - [{var,L,V} | make_vars(N + 1, M, L)]; -make_vars(_, _, _) -> - []. diff --git a/lib/compiler/src/sys_pre_expand.erl b/lib/compiler/src/sys_pre_expand.erl index a8c69c3cb1..7d918a55ed 100644 --- a/lib/compiler/src/sys_pre_expand.erl +++ b/lib/compiler/src/sys_pre_expand.erl @@ -28,13 +28,12 @@ %% Main entry point. -export([module/2]). --import(ordsets, [from_list/1,add_element/2,union/2]). +-import(ordsets, [from_list/1,union/2]). -import(lists, [member/2,foldl/3,foldr/3]). -include("../include/erl_bits.hrl"). -record(expand, {module=[], %Module name - parameters=undefined, %Module parameters exports=[], %Exports imports=[], %Imports compile=[], %Compile flags @@ -74,88 +73,20 @@ module(Fs0, Opts0) -> }, %% Expand the functions. {Tfs,St1} = forms(Fs, define_functions(Fs, St0)), - {Efs,St2} = expand_pmod(Tfs, St1), %% Get the correct list of exported functions. - Exports = case member(export_all, St2#expand.compile) of - true -> gb_sets:to_list(St2#expand.defined); - false -> St2#expand.exports + Exports = case member(export_all, St1#expand.compile) of + true -> gb_sets:to_list(St1#expand.defined); + false -> St1#expand.exports end, %% Generate all functions from stored info. - {Ats,St3} = module_attrs(St2#expand{exports = Exports}), + {Ats,St3} = module_attrs(St1#expand{exports = Exports}), {Mfs,St4} = module_predef_funcs(St3), - {St4#expand.module, St4#expand.exports, Ats ++ Efs ++ Mfs, + {St4#expand.module, St4#expand.exports, Ats ++ Tfs ++ Mfs, St4#expand.compile}. compiler_options(Forms) -> lists:flatten([C || {attribute,_,compile,C} <- Forms]). -expand_pmod(Fs0, St0) -> - case St0#expand.parameters of - undefined -> - {Fs0,St0}; - Ps0 -> - Base = get_base(St0#expand.attributes), - Ps = if is_atom(Base) -> - ['BASE' | Ps0]; - true -> - Ps0 - end, - Def = gb_sets:to_list(St0#expand.defined), - {Fs1,Xs,Ds} = sys_expand_pmod:forms(Fs0, Ps, - St0#expand.exports, - Def), - St1 = St0#expand{exports=Xs,defined=gb_sets:from_list(Ds)}, - {Fs2,St2} = add_instance(Ps, Fs1, St1), - {Fs3,St3} = ensure_new(Base, Ps0, Fs2, St2), - {Fs3,St3#expand{attributes = [{abstract, 0, [true]} - | St3#expand.attributes]}} - end. - -get_base(As) -> - case lists:keyfind(extends, 1, As) of - {extends,_,[Base]} when is_atom(Base) -> - Base; - _ -> - [] - end. - -ensure_new(Base, Ps, Fs, St) -> - case has_new(Fs) of - true -> - {Fs, St}; - false -> - add_new(Base, Ps, Fs, St) - end. - -has_new([{function,_L,new,_A,_Cs} | _Fs]) -> - true; -has_new([_ | Fs]) -> - has_new(Fs); -has_new([]) -> - false. - -add_new(Base, Ps, Fs, St) -> - Vs = [{var,0,V} || V <- Ps], - As = if is_atom(Base) -> - [{call,0,{remote,0,{atom,0,Base},{atom,0,new}},Vs} | Vs]; - true -> - Vs - end, - Body = [{call,0,{atom,0,instance},As}], - add_func(new, Vs, Body, Fs, St). - -add_instance(Ps, Fs, St) -> - Vs = [{var,0,V} || V <- Ps], - AbsMod = [{tuple,0,[{atom,0,St#expand.module}|Vs]}], - add_func(instance, Vs, AbsMod, Fs, St). - -add_func(Name, Args, Body, Fs, St) -> - A = length(Args), - F = {function,0,Name,A,[{clause,0,Args,[],Body}]}, - NA = {Name,A}, - {[F|Fs],St#expand{exports=add_element(NA, St#expand.exports), - defined=gb_sets:add_element(NA, St#expand.defined)}}. - %% define_function(Form, State) -> State. %% Add function to defined if form is a function. @@ -235,10 +166,6 @@ forms([], St) -> {[],St}. %% attribute(Attribute, Value, Line, State) -> State'. %% Process an attribute, this just affects the state. -attribute(module, {Module, As}, _L, St) -> - true = is_atom(Module), - St#expand{module=Module, - parameters=As}; attribute(module, Module, _L, St) -> true = is_atom(Module), St#expand{module=Module}; diff --git a/lib/compiler/src/v3_kernel.erl b/lib/compiler/src/v3_kernel.erl index 8ef71e1346..b1bff47f69 100644 --- a/lib/compiler/src/v3_kernel.erl +++ b/lib/compiler/src/v3_kernel.erl @@ -235,16 +235,8 @@ gexpr_test_add(Ke, St0) -> %% expr(Cexpr, Sub, State) -> {Kexpr,[PreKexpr],State}. %% Convert a Core expression, flattening it at the same time. -expr(#c_var{anno=A,name={_Name,Arity}}=Fname, Sub, St) -> - %% A local in an expression. - %% For now, these are wrapped into a fun by reverse - %% etha-conversion, but really, there should be exactly one - %% such "lambda function" for each escaping local name, - %% instead of one for each occurrence as done now. - Vs = [#c_var{name=list_to_atom("V" ++ integer_to_list(V))} || - V <- integers(1, Arity)], - Fun = #c_fun{anno=A,vars=Vs,body=#c_apply{anno=A,op=Fname,args=Vs}}, - expr(Fun, Sub, St); +expr(#c_var{anno=A,name={Name,Arity}}, Sub, St) -> + {#k_local{anno=A,name=get_fsub(Name, Arity, Sub),arity=Arity},[],St}; expr(#c_var{anno=A,name=V}, Sub, St) -> {#k_var{anno=A,name=get_vsub(V, Sub)},[],St}; expr(#c_literal{anno=A,val=V}, _Sub, St) -> @@ -1663,6 +1655,19 @@ uexpr(#ifun{anno=A,vars=Vs,body=B0}, {break,Rs}, St0) -> #k_int{val=Index},#k_int{val=Uniq}|Fvs], ret=Rs}, Free,add_local_function(Fun, St)}; +uexpr(#k_local{anno=A,name=Name,arity=Arity}, {break,Rs}, St) -> + Fs = get_free(Name, Arity, St), + FsCount = length(Fs), + Free = lit_list_vars(Fs), + %% Set dummy values for Index and Uniq -- the real values will + %% be assigned by beam_asm. + Index = Uniq = 0, + Bif = #k_bif{anno=#k{us=Free,ns=lit_list_vars(Rs),a=A}, + op=#k_internal{name=make_fun,arity=FsCount+3}, + args=[#k_atom{val=Name},#k_int{val=FsCount+Arity}, + #k_int{val=Index},#k_int{val=Uniq}|Fs], + ret=Rs}, + {Bif,Free,St}; uexpr(Lit, {break,Rs0}, St0) -> %% Transform literals to puts here. %%ok = io:fwrite("uexpr ~w:~p~n", [?LINE,Lit]), @@ -1843,12 +1848,6 @@ make_list(Es) -> #c_cons{hd=E,tl=Acc} end, #c_literal{val=[]}, Es). -%% List of integers in interval [N,M]. Empty list if N > M. - -integers(N, M) when N =< M -> - [N|integers(N + 1, M)]; -integers(_, _) -> []. - %% is_in_guard(State) -> true|false. is_in_guard(#kern{guard_refc=Refc}) -> diff --git a/lib/compiler/test/Makefile b/lib/compiler/test/Makefile index 3b065ec3b9..b9c5be09ce 100644 --- a/lib/compiler/test/Makefile +++ b/lib/compiler/test/Makefile @@ -29,7 +29,6 @@ MODULES= \ match_SUITE \ misc_SUITE \ num_bif_SUITE \ - pmod_SUITE \ receive_SUITE \ record_SUITE \ trycatch_SUITE \ diff --git a/lib/compiler/test/inline_SUITE.erl b/lib/compiler/test/inline_SUITE.erl index e2eb6a0dec..6dc7548437 100644 --- a/lib/compiler/test/inline_SUITE.erl +++ b/lib/compiler/test/inline_SUITE.erl @@ -258,6 +258,49 @@ lists(Config) when is_list(Config) -> %% Cleanup. erase(?MODULE), + + {'EXIT',{function_clause,[{?MODULE,_,[_,not_a_list],_}|_]}} = + (catch lists:map(fun (X) -> X end, not_a_list)), + {'EXIT',{function_clause,[{?MODULE,_,[_,not_a_list],_}|_]}} = + (catch lists:flatmap(fun (X) -> X end, not_a_list)), + {'EXIT',{function_clause,[{?MODULE,_,[_,not_a_list],_}|_]}} = + (catch lists:foreach(fun (X) -> X end, not_a_list)), + {'EXIT',{function_clause,[{?MODULE,_,[_,not_a_list],_}|_]}} = + (catch lists:filter(fun (_) -> true end, not_a_list)), + {'EXIT',{function_clause,[{?MODULE,_,[_,not_a_list],_}|_]}} = + (catch lists:any(fun (_) -> false end, not_a_list)), + {'EXIT',{function_clause,[{?MODULE,_,[_,not_a_list],_}|_]}} = + (catch lists:all(fun (_) -> true end, not_a_list)), + {'EXIT',{function_clause,[{?MODULE,_,[_,acc,not_a_list],_}|_]}} = + (catch lists:foldl(fun (X, Acc) -> {X,Acc} end, acc, not_a_list)), + {'EXIT',{function_clause,[{?MODULE,_,[_,acc,not_a_list],_}|_]}} = + (catch lists:foldr(fun (X, Acc) -> {X,Acc} end, acc, not_a_list)), + {'EXIT',{function_clause,[{?MODULE,_,[_,acc,not_a_list],_}|_]}} = + (catch lists:mapfoldl(fun (X, Acc) -> {X,Acc} end, acc, not_a_list)), + {'EXIT',{function_clause,[{?MODULE,_,[_,acc,not_a_list],_}|_]}} = + (catch lists:mapfoldr(fun (X, Acc) -> {X,Acc} end, acc, not_a_list)), + + {'EXIT',{function_clause,[{?MODULE,_,[not_a_function,[]],_}|_]}} = + (catch lists:map(not_a_function, [])), + {'EXIT',{function_clause,[{?MODULE,_,[not_a_function,[]],_}|_]}} = + (catch lists:flatmap(not_a_function, [])), + {'EXIT',{function_clause,[{?MODULE,_,[not_a_function,[]],_}|_]}} = + (catch lists:foreach(not_a_function, [])), + {'EXIT',{function_clause,[{?MODULE,_,[not_a_function,[]],_}|_]}} = + (catch lists:filter(not_a_function, [])), + {'EXIT',{function_clause,[{?MODULE,_,[not_a_function,[]],_}|_]}} = + (catch lists:any(not_a_function, [])), + {'EXIT',{function_clause,[{?MODULE,_,[not_a_function,[]],_}|_]}} = + (catch lists:all(not_a_function, [])), + {'EXIT',{function_clause,[{?MODULE,_,[not_a_function,acc,[]],_}|_]}} = + (catch lists:foldl(not_a_function, acc, [])), + {'EXIT',{function_clause,[{?MODULE,_,[not_a_function,acc,[]],_}|_]}} = + (catch lists:foldr(not_a_function, acc, [])), + {'EXIT',{function_clause,[{?MODULE,_,[not_a_function,acc,[]],_}|_]}} = + (catch lists:mapfoldl(not_a_function, acc, [])), + {'EXIT',{function_clause,[{?MODULE,_,[not_a_function,acc,[]],_}|_]}} = + (catch lists:mapfoldr(not_a_function, acc, [])), + ok. my_apply(M, F, A, Init) -> diff --git a/lib/compiler/test/pmod_SUITE.erl b/lib/compiler/test/pmod_SUITE.erl deleted file mode 100644 index 5dd09a7245..0000000000 --- a/lib/compiler/test/pmod_SUITE.erl +++ /dev/null @@ -1,121 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2004-2011. All Rights Reserved. -%% -%% The contents of this file are subject to the Erlang Public License, -%% Version 1.1, (the "License"); you may not use this file except in -%% compliance with the License. You should have received a copy of the -%% Erlang Public License along with this software. If not, it can be -%% retrieved online at http://www.erlang.org/. -%% -%% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -%% the License for the specific language governing rights and limitations -%% under the License. -%% -%% %CopyrightEnd% -%% --module(pmod_SUITE). - --export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2, - init_per_testcase/2,end_per_testcase/2, - basic/1, otp_8447/1]). - --include_lib("test_server/include/test_server.hrl"). - -suite() -> [{ct_hooks,[ts_install_cth]}]. - -all() -> - test_lib:recompile(?MODULE), - [basic, otp_8447]. - -groups() -> - []. - -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - -init_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> - Dog = test_server:timetrap(?t:minutes(1)), - [{watchdog,Dog}|Config]. - -end_per_testcase(Case, Config) when is_atom(Case), is_list(Config) -> - Dog = ?config(watchdog, Config), - ?t:timetrap_cancel(Dog), - ok. - -basic(Config) when is_list(Config) -> - ?line basic_1(Config, []), - ?line basic_1(Config, [inline]), - ?line basic_1(Config, [{inline,500},inline]), - ok. - -basic_1(Config, Opts) -> - io:format("Options: ~p\n", [Opts]), - ?line ok = compile_load(pmod_basic, Config, Opts), - - ?line Prop1 = pmod_basic:new([{a,xb},{b,true},{c,false}]), - ?line Prop2 = pmod_basic:new([{y,zz}]), - ?line io:format("Prop1 = ~p\n", [Prop1]), - ?line io:format("Prop2 = ~p\n", [Prop2]), - - ?line {a,xb} = Prop1:lookup(a), - ?line none = Prop1:lookup(glurf), - ?line false = Prop1:or_props([]), - ?line true = Prop1:or_props([b,c]), - ?line true = Prop1:or_props([b,d]), - ?line false = Prop1:or_props([d]), - - ?line none = Prop2:lookup(kalle), - ?line {y,zz} = Prop2:lookup(y), - ?line {a,xb} = Prop1:lookup(a), - - ?line Prop3 = Prop1:prepend({blurf,true}), - ?line io:format("Prop3 = ~p\n", [Prop3]), - ?line {blurf,true} = Prop3:lookup(blurf), - - Prop4 = Prop3:append(42), - ?line io:format("Prop4 = ~p\n", [Prop4]), - ?line {42,5} = Prop4:stupid_sum(), - - %% Some record guards. - ?line ok = Prop4:bar({s,0}), - ?line ok = Prop4:bar_bar({s,blurf}), - ?line error = Prop4:bar_bar({s,a,b}), - ?line error = Prop4:bar_bar([]), - - %% Call from a fun. - Fun = fun(Arg) -> Prop4:bar(Arg) end, - ?line ok = Fun({s,0}), - - [{y,[1,2]},{x,[5,19]}] = Prop4:collapse([{y,[2,1]},{x,[19,5]}]), - ok. - -otp_8447(Config) when is_list(Config) -> - ?line P = pmod_basic:new(foo), - ?line [0,0,1,1,1,0,0,1] = P:bc1(), - ?line <<10:4>> = P:bc2(), - ok. - -compile_load(Module, Conf, Opts) -> - ?line Dir = ?config(data_dir,Conf), - ?line Src = filename:join(Dir, atom_to_list(Module)), - ?line Out = ?config(priv_dir,Conf), - ?line CompRc = compile:file(Src, [report,{outdir,Out}|Opts]), - ?line {ok,Module} = CompRc, - ?line code:purge(Module), - ?line {module,Module} = - code:load_abs(filename:join(Out, atom_to_list(Module))), - ok. diff --git a/lib/compiler/test/pmod_SUITE_data/pmod_basic.erl b/lib/compiler/test/pmod_SUITE_data/pmod_basic.erl deleted file mode 100644 index 19cce452dc..0000000000 --- a/lib/compiler/test/pmod_SUITE_data/pmod_basic.erl +++ /dev/null @@ -1,83 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2004-2011. All Rights Reserved. -%% -%% The contents of this file are subject to the Erlang Public License, -%% Version 1.1, (the "License"); you may not use this file except in -%% compliance with the License. You should have received a copy of the -%% Erlang Public License along with this software. If not, it can be -%% retrieved online at http://www.erlang.org/. -%% -%% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -%% the License for the specific language governing rights and limitations -%% under the License. -%% -%% %CopyrightEnd% -%% --module(pmod_basic, [Props]). - --export([lookup/1,or_props/1,prepend/1,append/1,stupid_sum/0]). --export([bar/1,bar_bar/1]). --export([bc1/0, bc2/0]). --export([collapse/1]). - -lookup(Key) -> - proplists:lookup(Key, Props). - -or_props(Keys) -> - Res = or_props_1(Keys, false), - true = is_bool(Res), %is_bool/1 does not use Props. - Res. - -prepend(Term) -> - new([Term|Props]). - -append(Term) -> - pmod_basic:new(Props++[Term]). - -or_props_1([K|Ks], Acc) -> - or_props_1(Ks, proplists:get_bool(K, Props) or Acc); -or_props_1([], Acc) -> Acc. - -is_bool(true) -> true; -is_bool(false) -> true; -is_bool(_) -> false. - -stupid_sum() -> - put(counter, 0), - Res = stupid_sum_1(Props, 0), - {Res,get(counter)}. - -stupid_sum_1([H|T], Sum0) -> - try add(Sum0, H) of - Sum -> stupid_sum_1(T, Sum) - catch - error:_ -> stupid_sum_1(T, Sum0) - after - bump() - end; -stupid_sum_1([], Sum) -> Sum. - -bump() -> - put(counter, get(counter)+1). - -add(A, B) -> - A+B. - --record(s, {a}). - -bar(S) when S#s.a == 0 -> ok. - -bar_bar(S) when is_record(S, s) -> ok; -bar_bar(_) -> error. - -bc1() -> - [A || <<A:1>> <= <<"9">> ]. - -bc2() -> - << <<A:1>> || A <- [1,0,1,0] >>. - -collapse(L) -> - lists:keymap(fun lists:sort/1, 2, L). diff --git a/lib/cosEvent/src/Makefile b/lib/cosEvent/src/Makefile index 7787fad786..2864ee0538 100644 --- a/lib/cosEvent/src/Makefile +++ b/lib/cosEvent/src/Makefile @@ -168,9 +168,9 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) - sed -e 's;%VSN%;$(VSN);' $(APP_SRC) > $(APP_TARGET) + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $(APP_SRC) > $(APP_TARGET) $(APPUP_TARGET): $(APPUP_SRC) - sed -e 's;%VSN%;$(VSN);' $(APPUP_SRC) > $(APPUP_TARGET) + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $(APPUP_SRC) > $(APPUP_TARGET) docs: @@ -179,12 +179,12 @@ docs: # ---------------------------------------------------- IDL-GENERATED: CosEventChannelAdmin.idl cosEventApp.idl CosEventComm.idl - erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosEventChannelAdmin.cfg"}' CosEventChannelAdmin.idl - mv $(GEN_HRL_FILES1) $(EXTERNAL_INC_PATH) - erlc $(ERL_IDL_FLAGS) +'{cfgfile,"cosEventApp.cfg"}' cosEventApp.idl - erlc $(ERL_IDL_FLAGS) CosEventComm.idl - mv $(GEN_HRL_FILES3) $(EXTERNAL_INC_PATH) - >IDL-GENERATED + $(gen_verbose)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosEventChannelAdmin.cfg"}' CosEventChannelAdmin.idl + $(V_at)mv $(GEN_HRL_FILES1) $(EXTERNAL_INC_PATH) + $(V_at)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"cosEventApp.cfg"}' cosEventApp.idl + $(V_at)erlc $(ERL_IDL_FLAGS) CosEventComm.idl + $(V_at)mv $(GEN_HRL_FILES3) $(EXTERNAL_INC_PATH) + $(V_at)>IDL-GENERATED $(GEN_FILES): IDL-GENERATED diff --git a/lib/cosEventDomain/src/Makefile b/lib/cosEventDomain/src/Makefile index 213d433c72..b4b74bd192 100644 --- a/lib/cosEventDomain/src/Makefile +++ b/lib/cosEventDomain/src/Makefile @@ -141,9 +141,9 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) - sed -e 's;%VSN%;$(VSN);' $(APP_SRC) > $(APP_TARGET) + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $(APP_SRC) > $(APP_TARGET) $(APPUP_TARGET): $(APPUP_SRC) - sed -e 's;%VSN%;$(VSN);' $(APPUP_SRC) > $(APPUP_TARGET) + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $(APPUP_SRC) > $(APPUP_TARGET) docs: @@ -151,9 +151,9 @@ docs: # Special Build Targets # ---------------------------------------------------- IDL-GENERATED: CosEventDomainAdmin.idl - erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosEventDomainAdmin.cfg"}' CosEventDomainAdmin.idl - mv $(GEN_HRL_FILES) $(EXTERNAL_INC_PATH) - >IDL-GENERATED + $(gen_verbose)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosEventDomainAdmin.cfg"}' CosEventDomainAdmin.idl + $(V_at)mv $(GEN_HRL_FILES) $(EXTERNAL_INC_PATH) + $(V_at)>IDL-GENERATED $(GEN_FILES): IDL-GENERATED diff --git a/lib/cosFileTransfer/src/Makefile b/lib/cosFileTransfer/src/Makefile index d552349ede..9d3abb9bba 100644 --- a/lib/cosFileTransfer/src/Makefile +++ b/lib/cosFileTransfer/src/Makefile @@ -151,10 +151,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ docs: @@ -162,9 +162,9 @@ docs: # Special Build Targets # ---------------------------------------------------- IDL-GENERATED: CosFileTransfer.idl - erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosFileTransfer.cfg"}' CosFileTransfer.idl - mv $(LOCAL_HRL_FILES) $(EXTERNAL_INC_PATH) - >IDL-GENERATED + $(gen_verbose)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosFileTransfer.cfg"}' CosFileTransfer.idl + $(V_at)mv $(LOCAL_HRL_FILES) $(EXTERNAL_INC_PATH) + $(V_at)>IDL-GENERATED $(GEN_FILES): IDL-GENERATED diff --git a/lib/cosNotification/src/Makefile b/lib/cosNotification/src/Makefile index decf598bbf..13153bd7a1 100644 --- a/lib/cosNotification/src/Makefile +++ b/lib/cosNotification/src/Makefile @@ -332,10 +332,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ docs: @@ -344,16 +344,16 @@ docs: # ---------------------------------------------------- IDL-GENERATED: CosNotification.idl CosNotifyChannelAdmin.idl \ CosNotifyFilter.idl cosNotificationAppComm.idl CosNotifyComm.idl - erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosNotification.cfg"}' CosNotification.idl - mv $(GEN_NOTIFICATION_HRL_FILES) $(EXTERNAL_INC_PATH) - erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosNotifyChannelAdmin.cfg"}' CosNotifyChannelAdmin.idl - mv $(GEN_CHANNELADMIN_HRL_FILES) $(EXTERNAL_INC_PATH) - erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosNotifyFilter.cfg"}' CosNotifyFilter.idl - mv $(GEN_NOTIFYFILTER_HRL_FILES) $(EXTERNAL_INC_PATH) - erlc $(ERL_IDL_FLAGS) +'{cfgfile,"cosNotificationComm.cfg"}' cosNotificationAppComm.idl - erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosNotifyComm.cfg"}' CosNotifyComm.idl - mv $(GEN_NOTIFYCOMM_HRL_FILES) $(EXTERNAL_INC_PATH) - >IDL-GENERATED + $(gen_verbose)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosNotification.cfg"}' CosNotification.idl + $(V_at)mv $(GEN_NOTIFICATION_HRL_FILES) $(EXTERNAL_INC_PATH) + $(V_at)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosNotifyChannelAdmin.cfg"}' CosNotifyChannelAdmin.idl + $(V_at)mv $(GEN_CHANNELADMIN_HRL_FILES) $(EXTERNAL_INC_PATH) + $(V_at)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosNotifyFilter.cfg"}' CosNotifyFilter.idl + $(V_at)mv $(GEN_NOTIFYFILTER_HRL_FILES) $(EXTERNAL_INC_PATH) + $(V_at)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"cosNotificationComm.cfg"}' cosNotificationAppComm.idl + $(V_at)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosNotifyComm.cfg"}' CosNotifyComm.idl + $(V_at)mv $(GEN_NOTIFYCOMM_HRL_FILES) $(EXTERNAL_INC_PATH) + $(V_at)>IDL-GENERATED $(IDL_GEN_ERL_FILES) $(IDL_GEN_HRL_FILES): IDL-GENERATED diff --git a/lib/cosProperty/src/Makefile b/lib/cosProperty/src/Makefile index 54d1b6021c..d7b75d8bc5 100644 --- a/lib/cosProperty/src/Makefile +++ b/lib/cosProperty/src/Makefile @@ -151,10 +151,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ docs: @@ -162,9 +162,9 @@ docs: # Special Build Targets # ---------------------------------------------------- IDL-GENERATED: CosProperty.idl - erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosProperty.cfg"}' CosProperty.idl - mv $(LOCAL_HRL_FILES) $(EXTERNAL_INC_PATH) - >IDL-GENERATED + $(gen_verbose)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosProperty.cfg"}' CosProperty.idl + $(V_at)mv $(LOCAL_HRL_FILES) $(EXTERNAL_INC_PATH) + $(V_at)>IDL-GENERATED $(GEN_FILES): IDL-GENERATED diff --git a/lib/cosTime/src/Makefile b/lib/cosTime/src/Makefile index e8536a3f0a..0ab2b414ce 100644 --- a/lib/cosTime/src/Makefile +++ b/lib/cosTime/src/Makefile @@ -166,10 +166,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ docs: @@ -177,13 +177,13 @@ docs: # Special Build Targets # ---------------------------------------------------- IDL-GENERATED: TimeBase.idl CosTime.idl CosTimerEvent.idl - erlc $(ERL_IDL_FLAGS) TimeBase.idl - mv $(GEN_TIMEBASE_HRL_FILES) $(EXTERNAL_INC_PATH) - erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosTime.cfg"}' CosTime.idl - mv $(GEN_COSTIME_HRL_FILES) $(EXTERNAL_INC_PATH) - erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosTimerEvent.cfg"}' CosTimerEvent.idl - mv $(GEN_COSTIMEREVENT_HRL_FILES) $(EXTERNAL_INC_PATH) - >IDL-GENERATED + $(gen_verbose)erlc $(ERL_IDL_FLAGS) TimeBase.idl + $(V_at)mv $(GEN_TIMEBASE_HRL_FILES) $(EXTERNAL_INC_PATH) + $(V_at)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosTime.cfg"}' CosTime.idl + $(V_at)mv $(GEN_COSTIME_HRL_FILES) $(EXTERNAL_INC_PATH) + $(V_at)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosTimerEvent.cfg"}' CosTimerEvent.idl + $(V_at)mv $(GEN_COSTIMEREVENT_HRL_FILES) $(EXTERNAL_INC_PATH) + $(V_at)>IDL-GENERATED $(GEN_FILES): IDL-GENERATED diff --git a/lib/cosTransactions/src/Makefile b/lib/cosTransactions/src/Makefile index 1d935c4d1d..7b4a9cf858 100644 --- a/lib/cosTransactions/src/Makefile +++ b/lib/cosTransactions/src/Makefile @@ -145,10 +145,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) - sed -e 's;%VSN%;$(VSN);' $(APP_SRC) > $(APP_TARGET) + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $(APP_SRC) > $(APP_TARGET) $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ docs: @@ -156,9 +156,9 @@ docs: # Special Build Targets # ---------------------------------------------------- IDL-GENERATED: CosTransactions.idl - erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosTransactions.cfg"}' CosTransactions.idl - mv $(GEN_HRL_FILES) $(EXTERNAL_INC_PATH) - >IDL-GENERATED + $(gen_verbose)erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosTransactions.cfg"}' CosTransactions.idl + $(V_at)mv $(GEN_HRL_FILES) $(EXTERNAL_INC_PATH) + $(V_at)>IDL-GENERATED $(GEN_FILES): IDL-GENERATED diff --git a/lib/crypto/c_src/Makefile.in b/lib/crypto/c_src/Makefile.in index e19d6617f3..a20ddff05c 100644 --- a/lib/crypto/c_src/Makefile.in +++ b/lib/crypto/c_src/Makefile.in @@ -108,16 +108,16 @@ _create_dirs := $(shell mkdir -p $(OBJDIR) $(LIBDIR)) debug opt valgrind: $(NIF_LIB) $(CALLBACK_LIB) $(OBJDIR)/%$(TYPEMARKER).o: %.c - $(INSTALL_DIR) $(OBJDIR) - $(CC) -c -o $@ $(ALL_CFLAGS) $< + $(V_at)$(INSTALL_DIR) $(OBJDIR) + $(V_CC) -c -o $@ $(ALL_CFLAGS) $< $(LIBDIR)/crypto$(TYPEMARKER).so: $(CRYPTO_OBJS) - $(INSTALL_DIR) $(LIBDIR) - $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS) $(CRYPTO_LINK_LIB) + $(V_at)$(INSTALL_DIR) $(LIBDIR) + $(V_LD) $(LDFLAGS) -o $@ $^ $(LDLIBS) $(CRYPTO_LINK_LIB) $(LIBDIR)/crypto$(TYPEMARKER).dll: $(CRYPTO_OBJS) - $(INSTALL_DIR) $(LIBDIR) - $(LD) $(LDFLAGS) -o $@ $(SSL_DED_LD_RUNTIME_LIBRARY_PATH) -L$(SSL_LIBDIR) $(CRYPTO_OBJS) -l$(SSL_CRYPTO_LIBNAME) -l$(SSL_SSL_LIBNAME) + $(V_at)$(INSTALL_DIR) $(LIBDIR) + $(V_LD) $(LDFLAGS) -o $@ $(SSL_DED_LD_RUNTIME_LIBRARY_PATH) -L$(SSL_LIBDIR) $(CRYPTO_OBJS) -l$(SSL_CRYPTO_LIBNAME) -l$(SSL_SSL_LIBNAME) ifeq ($(DYNAMIC_CRYPTO_LIB),yes) $(LIBDIR)/crypto_callback$(TYPEMARKER).so: $(CALLBACK_OBJS) diff --git a/lib/crypto/src/Makefile b/lib/crypto/src/Makefile index 910e89363c..5c200742ac 100644 --- a/lib/crypto/src/Makefile +++ b/lib/crypto/src/Makefile @@ -70,10 +70,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ docs: diff --git a/lib/debugger/src/Makefile b/lib/debugger/src/Makefile index e8b350c0c7..cadde8cd1b 100644 --- a/lib/debugger/src/Makefile +++ b/lib/debugger/src/Makefile @@ -112,10 +112,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ docs: diff --git a/lib/dialyzer/src/Makefile b/lib/dialyzer/src/Makefile index 63cc1c98f1..bb2edd419a 100644 --- a/lib/dialyzer/src/Makefile +++ b/lib/dialyzer/src/Makefile @@ -108,22 +108,22 @@ clean: # ---------------------------------------------------- $(EBIN)/dialyzer_cl_parse.$(EMULATOR): dialyzer_cl_parse.erl ../vsn.mk - erlc -W $(ERL_COMPILE_FLAGS) -DVSN="\"v$(VSN)\"" -o$(EBIN) dialyzer_cl_parse.erl + $(erlc_verbose)erlc -W $(ERL_COMPILE_FLAGS) -DVSN="\"v$(VSN)\"" -o$(EBIN) dialyzer_cl_parse.erl $(EBIN)/dialyzer_plt.$(EMULATOR): dialyzer_plt.erl ../vsn.mk - erlc -W $(ERL_COMPILE_FLAGS) -DVSN="\"v$(VSN)\"" -o$(EBIN) dialyzer_plt.erl + $(erlc_verbose)erlc -W $(ERL_COMPILE_FLAGS) -DVSN="\"v$(VSN)\"" -o$(EBIN) dialyzer_plt.erl $(EBIN)/dialyzer_gui.$(EMULATOR): dialyzer_gui.erl ../vsn.mk - erlc -W $(ERL_COMPILE_FLAGS) -DVSN="\"v$(VSN)\"" -o$(EBIN) dialyzer_gui.erl + $(erlc_verbose)erlc -W $(ERL_COMPILE_FLAGS) -DVSN="\"v$(VSN)\"" -o$(EBIN) dialyzer_gui.erl $(EBIN)/dialyzer_gui_wx.$(EMULATOR): dialyzer_gui_wx.erl ../vsn.mk - erlc -W $(ERL_COMPILE_FLAGS) -DVSN="\"v$(VSN)\"" -o$(EBIN) dialyzer_gui_wx.erl + $(erlc_verbose)erlc -W $(ERL_COMPILE_FLAGS) -DVSN="\"v$(VSN)\"" -o$(EBIN) dialyzer_gui_wx.erl $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # --------------------------------------------------------------------- # dependencies -- I wish they were somehow automatically generated diff --git a/lib/diameter/doc/src/Makefile b/lib/diameter/doc/src/Makefile index 8ad38ba0d5..0cbe1f000f 100644 --- a/lib/diameter/doc/src/Makefile +++ b/lib/diameter/doc/src/Makefile @@ -173,8 +173,8 @@ release_spec: depend.mk: depend.sed Makefile seealso.ent \ $(XML_REF_FILES) $(XML_CHAPTER_FILES) - sed -f seehere.sed seealso.ent > seehere.ent - (for f in $(XML_REF_FILES) $(XML_CHAPTER_FILES); do \ + $(gen_verbose)sed -f seehere.sed seealso.ent > seehere.ent + $(V_at)(for f in $(XML_REF_FILES) $(XML_CHAPTER_FILES); do \ sed -f $< $$f | sed "s@%FILE%@`basename $$f .xml`@g"; \ done) \ > $@ diff --git a/lib/diameter/src/Makefile b/lib/diameter/src/Makefile index 060659bce9..60bb7e6a10 100644 --- a/lib/diameter/src/Makefile +++ b/lib/diameter/src/Makefile @@ -119,7 +119,7 @@ ERL_COMPILE_FLAGS += \ # erl/hrl from dictionary file. gen/diameter_gen_%.erl gen/diameter_gen_%.hrl: dict/%.dia - ../bin/diameterc -o gen -i $(EBIN) $< + $(dia_verbose)../bin/diameterc -o gen -i $(EBIN) $< opt: $(TARGET_FILES) @@ -128,17 +128,17 @@ debug: # The dictionary parser. gen/$(DICT_YRL).erl: compiler/$(DICT_YRL).yrl - $(ERLC) -Werror -o $(@D) $< + $(yecc_verbose)$(ERLC) -Werror -o $(@D) $< # Generate the app file. $(APP_TARGET): $(APP_SRC) ../vsn.mk modules.mk - M=`echo $(notdir $(APP_MODULES)) | tr ' ' ,`; \ + $(gen_verbose)M=`echo $(notdir $(APP_MODULES)) | tr ' ' ,`; \ sed -e 's;%VSN%;$(VSN);' \ -e "s;%MODULES%;$$M;" \ $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ app: $(APP_TARGET) $(APPUP_TARGET) dict: $(DICT_ERLS) @@ -254,7 +254,7 @@ depend: depend.mk # Generate dependencies makefile. depend.mk: depend.sed $(MODULES:%=%.erl) Makefile - (for f in $(MODULES); do \ + $(gen_verbose)(for f in $(MODULES); do \ (echo $$f; cat $$f.erl) | sed -f $<; \ done) \ > $@ diff --git a/lib/diameter/src/base/diameter_service.erl b/lib/diameter/src/base/diameter_service.erl index c0fccd8080..b5584ca0d0 100644 --- a/lib/diameter/src/base/diameter_service.erl +++ b/lib/diameter/src/base/diameter_service.erl @@ -2060,9 +2060,15 @@ request_cb({eval, RC, F}, App, Mask, T, TC, Fs, Pkt) -> %% protocol_error/5 protocol_error(RC, {_, OH, OR}, TPid, Fs, Pkt) -> - #diameter_packet{avps = Avps} = Pkt, + #diameter_packet{avps = Avps, errors = Es} = Pkt, ?LOG({error, RC}, Pkt), - reply(answer_message({OH, OR, RC}, Avps), ?BASE, TPid, Fs, Pkt). + reply(answer_message({OH, OR, RC}, Avps), + ?BASE, + TPid, + Fs, + Pkt#diameter_packet{errors = [RC | Es]}). +%% Note that reply/5 may set the result code once more. It's set in +%% answer_message/2 in case reply/5 doesn't. %% protocol_error/4 @@ -2175,7 +2181,8 @@ is_loop(Code, Vid, OH, Avps) -> %% %% Send a locally originating reply. -%% Skip the setting of Result-Code and Failed-AVP's below. +%% Skip the setting of Result-Code and Failed-AVP's below. This is +%% currently undocumented. reply([Msg], Dict, TPid, Fs, Pkt) when is_list(Msg); is_tuple(Msg) -> diff --git a/lib/diameter/test/diameter_traffic_SUITE.erl b/lib/diameter/test/diameter_traffic_SUITE.erl index b41d1a6f5c..b03a9ce4d1 100644 --- a/lib/diameter/test/diameter_traffic_SUITE.erl +++ b/lib/diameter/test/diameter_traffic_SUITE.erl @@ -40,6 +40,7 @@ send_nok/1, send_eval/1, send_bad_answer/1, + send_protocol_error/1, send_arbitrary/1, send_unknown/1, send_unknown_mandatory/1, @@ -48,6 +49,9 @@ send_unsupported_app/1, send_error_bit/1, send_unsupported_version/1, + send_invalid_avp_bits/1, + send_invalid_avp_length/1, + send_invalid_reject/1, send_long/1, send_nopeer/1, send_noapp/1, @@ -113,12 +117,15 @@ %% Sequence mask for End-to-End and Hop-by-Hop identifiers. -define(CLIENT_MASK, {1,26}). %% 1 in top 6 bits -%% Run tests cases in different encoding variants. Send outgoing -%% messages as lists or records. +%% How to construct messages, as record or list. -define(ENCODINGS, [list, record]). -%% Identifers for client connections. --define(CONNECTIONS, [c1,c2,c3]). +%% How to send answers, in a diameter_packet or not. +-define(CONTAINERS, [pkt, msg]). + +%% Send over multiple connections that are mapped onto +%% [{E,P} || E <- ?ENCODINGS, P <- ?CONTAINERS]. +-define(CONNECTIONS, [c0,c1,c2,c3]). %% Not really what we should be setting unless the message is sent in %% the common application but diameter doesn't care. @@ -162,6 +169,8 @@ ?'DIAMETER_BASE_RESULT-CODE_DIAMETER_REALM_NOT_SERVED'). -define(UNABLE_TO_DELIVER, ?'DIAMETER_BASE_RESULT-CODE_DIAMETER_UNABLE_TO_DELIVER'). +-define(INVALID_AVP_LENGTH, + ?'DIAMETER_BASE_RESULT-CODE_DIAMETER_INVALID_AVP_LENGTH'). -define(EVENT_RECORD, ?'DIAMETER_BASE_ACCOUNTING-RECORD-TYPE_EVENT_RECORD'). @@ -174,6 +183,8 @@ ?'DIAMETER_BASE_TERMINATION-CAUSE_DIAMETER_LOGOUT'). -define(BAD_ANSWER, ?'DIAMETER_BASE_TERMINATION-CAUSE_DIAMETER_BAD_ANSWER'). +-define(USER_MOVED, + ?'DIAMETER_BASE_TERMINATION-CAUSE_DIAMETER_USER_MOVED'). -define(A, list_to_atom). -define(L, atom_to_list). @@ -187,14 +198,17 @@ suite() -> all() -> [start, start_services, add_transports, result_codes] - ++ [{group, ?util:name([E,C]), P} || E <- ?ENCODINGS, - C <- ?CONNECTIONS, - P <- [[], [parallel]]] + ++ [{group, ?util:name([R,C,A]), P} || R <- ?ENCODINGS, + C <- ?CONTAINERS, + A <- ?ENCODINGS, + P <- [[], [parallel]]] ++ [remove_transports, stop_services, stop]. groups() -> Ts = tc(), - [{?util:name([E,C]), [], Ts} || E <- ?ENCODINGS, C <- ?CONNECTIONS]. + [{?util:name([R,C,A]), [], Ts} || R <- ?ENCODINGS, + C <- ?CONTAINERS, + A <- ?ENCODINGS]. init_per_group(Name, Config) -> [{group, Name} | Config]. @@ -215,6 +229,7 @@ tc() -> send_nok, send_eval, send_bad_answer, + send_protocol_error, send_arbitrary, send_unknown, send_unknown_mandatory, @@ -223,6 +238,9 @@ tc() -> send_unsupported_app, send_error_bit, send_unsupported_version, + send_invalid_avp_bits, + send_invalid_avp_length, + send_invalid_reject, send_long, send_nopeer, send_noapp, @@ -265,7 +283,9 @@ start_services(_Config) -> add_transports(Config) -> LRef = ?util:listen(?SERVER, tcp, [{capabilities_cb, fun capx/2}]), - Cs = [?util:connect(?CLIENT, tcp, LRef, [{id, C}]) || C <- ?CONNECTIONS], + Cs = [?util:connect(?CLIENT, tcp, LRef, [{id, C}, + {capabilities, [osi(C)]}]) + || C <- ?CONNECTIONS], ?util:write_priv(Config, "transport", [LRef | Cs]). remove_transports(Config) -> @@ -283,11 +303,15 @@ capx(_, #diameter_caps{origin_host = {OH,DH}}) -> io:format("connection: ~p -> ~p~n", [DH,OH]), ok. +osi(Id) -> + [$c,N] = atom_to_list(Id), + {'Origin-State-Id', N - $0}. + %% =========================================================================== %% Ensure that result codes have the expected values. result_codes(_Config) -> - {2001, 3001, 3002, 3003, 3004, 3007, 3008, 3009, 5001, 5011} + {2001, 3001, 3002, 3003, 3004, 3007, 3008, 3009, 5001, 5011, 5014} = {?SUCCESS, ?COMMAND_UNSUPPORTED, ?UNABLE_TO_DELIVER, @@ -297,13 +321,14 @@ result_codes(_Config) -> ?INVALID_HDR_BITS, ?INVALID_AVP_BITS, ?AVP_UNSUPPORTED, - ?UNSUPPORTED_VERSION}. + ?UNSUPPORTED_VERSION, + ?INVALID_AVP_LENGTH}. %% Send an ACR and expect success. send_ok(Config) -> Req = ['ACR', {'Accounting-Record-Type', ?EVENT_RECORD}, {'Accounting-Record-Number', 1}], - + #diameter_base_accounting_ACA{'Result-Code' = ?SUCCESS} = call(Config, Req). @@ -311,7 +336,7 @@ send_ok(Config) -> send_nok(Config) -> Req = ['ACR', {'Accounting-Record-Type', ?EVENT_RECORD}, {'Accounting-Record-Number', 0}], - + #'diameter_base_answer-message'{'Result-Code' = ?INVALID_AVP_BITS} = call(Config, Req). @@ -331,6 +356,15 @@ send_bad_answer(Config) -> {'Accounting-Record-Number', 2}], {error, timeout} = call(Config, Req). +%% Send an ACR that the server callback answers explicitly with a +%% protocol error. +send_protocol_error(Config) -> + Req = ['ACR', {'Accounting-Record-Type', ?EVENT_RECORD}, + {'Accounting-Record-Number', 4}], + + #'diameter_base_answer-message'{'Result-Code' = ?TOO_BUSY} + = call(Config, Req). + %% Send an ASR with an arbitrary AVP and expect success and the same %% AVP in the reply. send_arbitrary(Config) -> @@ -398,6 +432,29 @@ send_unsupported_version(Config) -> #diameter_base_STA{'Result-Code' = ?UNSUPPORTED_VERSION} = call(Config, Req). +%% Send a request containing an incorrect AVP length. +send_invalid_avp_bits(Config) -> + Req = ['STR', {'Termination-Cause', ?LOGOUT}], + + #'diameter_base_answer-message'{'Result-Code' = ?INVALID_AVP_BITS} + = call(Config, Req). + +%% Send a request containing an AVP length that doesn't match the +%% AVP's type. +send_invalid_avp_length(Config) -> + Req = ['STR', {'Termination-Cause', ?LOGOUT}], + + #'diameter_base_STA'{'Result-Code' = ?INVALID_AVP_LENGTH} + = call(Config, Req). + +%% Send a request containing 5xxx errors that the server rejects with +%% 3xxx. +send_invalid_reject(Config) -> + Req = ['STR', {'Termination-Cause', ?USER_MOVED}], + + #'diameter_base_answer-message'{'Result-Code' = ?TOO_BUSY} + = call(Config, Req). + %% Send something long that will be fragmented by TCP. send_long(Config) -> Req = ['STR', {'Termination-Cause', ?LOGOUT}, @@ -572,17 +629,38 @@ call(Config, Req) -> call(Config, Req, Opts) -> Name = proplists:get_value(testcase, Config), - [Encoding, Client] = ?util:name(proplists:get_value(group, Config)), + [Encoding, C, E] = ?util:name(proplists:get_value(group, Config)), diameter:call(?CLIENT, dict(Req), - req(Req, Encoding), - [{extra, [Name, Client]} | Opts]). + msg(Req, Encoding), + [{extra, [Name, client(E,C)]} | Opts]). + +client(E, C) -> + list_to_atom([$c, $0 + 2*codec(E) + container(C)]). + +client(N) -> + {codec(N bsr 1), container(N rem 2)}. + +codec(record) -> 0; +codec(list) -> 1; +codec(0) -> record; +codec(1) -> list. -req(['ACR' = H | T], record) -> +%% Here we're just mapping booleans but the readable atoms are part of +%% (constructed) group names, so it's good that they're readable. + +container(pkt) -> 0; +container(msg) -> 1; +container(0) -> pkt; +container(1) -> msg. + +msg([H|T], record) + when H == 'ACR'; + H == 'ACA' -> ?ACCT:'#new-'(?ACCT:msg2rec(H), T); -req([H|T], record) -> +msg([H|T], record) -> ?BASE:'#new-'(?BASE:msg2rec(H), T); -req(T, _) -> +msg(T, _) -> T. dict(['ACR' | _]) -> @@ -662,6 +740,40 @@ prepare_request(Pkt, ?CLIENT, {_Ref, Caps}, send_detach, _, _) -> log(#diameter_packet{} = P, T) -> io:format("~p: ~p~n", [T,P]). +%% prepare/3 + +prepare(Pkt, Caps, send_invalid_avp_bits) -> + Req = prepare(Pkt, Caps), + %% Last AVP in our STR is Termination-Cause of type Unsigned32: + %% set its length improperly. + #diameter_packet{header = #diameter_header{length = L}, + bin = B} + = E + = diameter_codec:encode(?BASE, Pkt#diameter_packet{msg = Req}), + Offset = L - 7, %% to AVP Length + <<H:Offset/binary, 12:24/integer, T:4/binary>> = B, + E#diameter_packet{bin = <<H/binary, 13:24/integer, T/binary>>}; + +prepare(Pkt, Caps, N) + when N == send_invalid_avp_length; + N == send_invalid_reject -> + Req = prepare(Pkt, Caps), + %% Second last AVP in our STR is Auth-Application-Id of type + %% Unsigned32: Send a value of length 8. + #diameter_packet{header = #diameter_header{length = L}, + bin = B0} + = E + = diameter_codec:encode(?BASE, Pkt#diameter_packet{msg = Req}), + Offset = L - 7 - 12, %% to AVP Length + <<H0:Offset/binary, 12:24/integer, T:16/binary>> = B0, + <<V, L:24/integer, H/binary>> = H0, %% assert + E#diameter_packet{bin = <<V, + (L+4):24/integer, + H/binary, + 16:24/integer, + 0:32/integer, + T/binary>>}; + prepare(Pkt, Caps, send_unsupported) -> Req = prepare(Pkt, Caps), #diameter_packet{bin = <<H:5/binary, _CmdCode:3/binary, T/binary>>} @@ -693,6 +805,8 @@ prepare(Pkt, Caps, send_anything) -> prepare(Pkt, Caps, _Name) -> prepare(Pkt, Caps). +%% prepare/2 + prepare(#diameter_packet{msg = Req}, Caps) when is_record(Req, diameter_base_accounting_ACR); 'ACR' == hd(Req) -> @@ -757,10 +871,17 @@ handle_answer(Pkt, _Req, ?CLIENT, _Peer, send_detach, _Id, {Pid, Ref}) -> Pid ! {Ref, Pkt}. answer(Pkt, Req, _Peer, Name) -> - #diameter_packet{header = H, msg = Rec, errors = []} = Pkt, + #diameter_packet{header = H, msg = Rec, errors = Es} = Pkt, ApplId = app(Req, Name), #diameter_header{application_id = ApplId} = H, %% assert - + answer(Rec, Es, Name). + +answer(Rec, [_|_], N) + when N == send_invalid_avp_bits; + N == send_invalid_avp_length; + N == send_invalid_reject -> + Rec; +answer(Rec, [], _) -> Rec. app(_, send_unsupported_app) -> @@ -786,7 +907,17 @@ handle_request(#diameter_packet{header = H, msg = M}, ?SERVER, {_Ref, Caps}) -> {V,B} = ?CLIENT_MASK, V = EI bsr B, %% assert V = HI bsr B, %% - request(M, Caps). + #diameter_caps{origin_state_id = {_,[N]}} = Caps, + answer(client(N), request(M, Caps)). + +answer(T, {Tag, Action, Post}) -> + {Tag, answer(T, Action), Post}; +answer({E,C}, {reply, Ans}) -> + answer(C, {reply, msg(Ans, E)}); +answer(pkt, {reply, Ans}) -> + {reply, #diameter_packet{msg = Ans}}; +answer(_, T) -> + T. %% send_nok request(#diameter_base_accounting_ACR{'Accounting-Record-Number' = 0}, @@ -806,7 +937,7 @@ request(#diameter_base_accounting_ACR{'Session-Id' = SId, {'Accounting-Record-Type', RT}, {'Accounting-Record-Number', RN}], - {reply, #diameter_packet{header = #diameter_header{is_error = true},%% not + {reply, #diameter_packet{header = #diameter_header{is_error = true},%% NOT msg = Ans}}; %% send_eval @@ -836,15 +967,28 @@ request(#diameter_base_accounting_ACR{'Session-Id' = SId, {'Accounting-Record-Type', RT}, {'Accounting-Record-Number', RN}]}; +%% send_protocol_error +request(#diameter_base_accounting_ACR{'Accounting-Record-Number' = 4}, + #diameter_caps{origin_host = {OH, _}, + origin_realm = {OR, _}}) -> + Ans = ['answer-message', {'Result-Code', ?TOO_BUSY}, + {'Origin-Host', OH}, + {'Origin-Realm', OR}], + {reply, Ans}; + request(#diameter_base_ASR{'Session-Id' = SId, 'AVP' = Avps}, #diameter_caps{origin_host = {OH, _}, origin_realm = {OR, _}}) -> - {reply, #diameter_base_ASA{'Result-Code' = ?SUCCESS, - 'Session-Id' = SId, - 'Origin-Host' = OH, - 'Origin-Realm' = OR, - 'AVP' = Avps}}; + {reply, ['ASA', {'Result-Code', ?SUCCESS}, + {'Session-Id', SId}, + {'Origin-Host', OH}, + {'Origin-Realm', OR}, + {'AVP', Avps}]}; + +%% send_invalid_reject +request(#diameter_base_STR{'Termination-Cause' = ?USER_MOVED}, _Caps) -> + {protocol_error, ?TOO_BUSY}; %% send_noreply request(#diameter_base_STR{'Termination-Cause' = T}, @@ -867,10 +1011,10 @@ request(#diameter_base_STR{'Destination-Host'= [H]}, request(#diameter_base_STR{'Session-Id' = SId}, #diameter_caps{origin_host = {OH, _}, origin_realm = {OR, _}}) -> - {reply, #diameter_base_STA{'Result-Code' = ?SUCCESS, - 'Session-Id' = SId, - 'Origin-Host' = OH, - 'Origin-Realm' = OR}}; + {reply, ['STA', {'Result-Code', ?SUCCESS}, + {'Session-Id', SId}, + {'Origin-Host', OH}, + {'Origin-Realm', OR}]}; %% send_error request(#diameter_base_RAR{}, _Caps) -> diff --git a/lib/edoc/priv/Makefile b/lib/edoc/priv/Makefile index 73c42c05eb..9873136201 100644 --- a/lib/edoc/priv/Makefile +++ b/lib/edoc/priv/Makefile @@ -27,8 +27,11 @@ GEN_SCRIPT_SRC = edoc_generate.src GEN_SCRIPT = edoc_generate PRIV_FILES = stylesheet.css erlang.png edoc.dtd -debug opt: - sed -e "s/%EDOC_VSN%/$(EDOC_VSN)/g" \ +debug opt: $(GEN_SCRIPT) + +$(GEN_SCRIPT): ../vsn.mk ../../xmerl/vsn.mk ../../syntax_tools/vsn.mk \ + $(GEN_SCRIPT_SRC) + $(vsn_verbose)sed -e "s/%EDOC_VSN%/$(EDOC_VSN)/g" \ -e "s/%XMERL_VSN%/$(XMERL_VSN)/g" \ -e "s/%SYNTAX_TOOLS_VSN%/$(SYNTAX_TOOLS_VSN)/g" \ $(GEN_SCRIPT_SRC) > $(GEN_SCRIPT) diff --git a/lib/edoc/src/Makefile b/lib/edoc/src/Makefile index 72354ac711..4e5a4182da 100644 --- a/lib/edoc/src/Makefile +++ b/lib/edoc/src/Makefile @@ -67,17 +67,17 @@ distclean: clean realclean: clean $(EBIN)/%.$(EMULATOR):%.erl - erlc -W $(ERL_COMPILE_FLAGS) -o$(EBIN) $< + $(erlc_verbose)erlc -W $(ERL_COMPILE_FLAGS) -o$(EBIN) $< # ---------------------------------------------------- # Special Build Targets # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Release Target diff --git a/lib/eldap/src/Makefile b/lib/eldap/src/Makefile index 46fb805bcc..ad93e1087a 100644 --- a/lib/eldap/src/Makefile +++ b/lib/eldap/src/Makefile @@ -75,10 +75,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(ELDAP_VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(ELDAP_VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(ELDAP_VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(ELDAP_VSN);' $< > $@ docs: @@ -88,7 +88,7 @@ $(TARGET_FILES): $(HRL_FILES) # Special Build Targets # ---------------------------------------------------- $(ASN1_HRL): ../asn1/$(ASN1_FILES) - $(ERLC) -o $(EBIN) -bber $(ERL_COMPILE_FLAGS) ../asn1/ELDAPv3.asn1 + $(asn_verbose)$(ERLC) -o $(EBIN) -bber $(ERL_COMPILE_FLAGS) ../asn1/ELDAPv3.asn1 # ---------------------------------------------------- # Release Target diff --git a/lib/erl_docgen/src/Makefile b/lib/erl_docgen/src/Makefile index 6c8b438b25..ef96f5dbf2 100644 --- a/lib/erl_docgen/src/Makefile +++ b/lib/erl_docgen/src/Makefile @@ -78,10 +78,10 @@ docs: # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Release Target diff --git a/lib/erl_interface/aclocal.m4 b/lib/erl_interface/aclocal.m4 index 5d555a5123..918e30a886 100644 --- a/lib/erl_interface/aclocal.m4 +++ b/lib/erl_interface/aclocal.m4 @@ -1861,17 +1861,16 @@ dnl Usage example LM_TRY_ENABLE_CFLAG([-Werror=return-type], [CFLAGS]) dnl dnl AC_DEFUN([LM_TRY_ENABLE_CFLAG], [ - AC_MSG_CHECKING([if we can add $1 to CFLAGS]) + AC_MSG_CHECKING([if we can add $1 to $2 (via CFLAGS)]) saved_CFLAGS=$CFLAGS; - CFLAGS="$1 $CFLAGS"; + CFLAGS="$1 $$2"; AC_TRY_COMPILE([],[return 0;],can_enable_flag=true,can_enable_flag=false) CFLAGS=$saved_CFLAGS; if test "X$can_enable_flag" = "Xtrue"; then AC_MSG_RESULT([yes]) - AS_VAR_SET($2, "$1 $CFLAGS") + AS_VAR_SET($2, "$1 $$2") else AC_MSG_RESULT([no]) - AS_VAR_SET($2, "$CFLAGS") fi ]) diff --git a/lib/erl_interface/src/Makefile b/lib/erl_interface/src/Makefile index 5f0367bec1..03e2ce14f0 100644 --- a/lib/erl_interface/src/Makefile +++ b/lib/erl_interface/src/Makefile @@ -22,10 +22,11 @@ # FIXME let configure put in this last part TARGET +include $(ERL_TOP)/make/output.mk include $(ERL_TOP)/make/target.mk debug opt shared purify quantify purecov gcov: - $(MAKE) -f $(TARGET)/Makefile TYPE=$@ + $(make_verbose)$(MAKE) -f $(TARGET)/Makefile TYPE=$@ clean depend docs release release_docs tests release_tests check: - $(MAKE) -f $(TARGET)/Makefile $@ + $(make_verbose)$(MAKE) -f $(TARGET)/Makefile $@ diff --git a/lib/erl_interface/src/Makefile.in b/lib/erl_interface/src/Makefile.in index cb41391fe9..ebacc1cee0 100644 --- a/lib/erl_interface/src/Makefile.in +++ b/lib/erl_interface/src/Makefile.in @@ -38,6 +38,8 @@ TARGET = @TARGET@ include ../vsn.mk include $(TARGET)/eidefs.mk +include $(ERL_TOP)/make/output.mk + USING_MINGW=@MIXED_CYGWIN_MINGW@ USING_MSYS_VC==@MIXED_MSYS_VC@ USING_CYGWIN_VC==@MIXED_MSYS_VC@ @@ -98,6 +100,12 @@ LD = @LD@ AR = @AR@ RANLIB = @RANLIB@ +ifeq ($(V),0) +AR_FLAGS=rc +else +AR_FLAGS=rcv +endif + INCFLAGS = -I. -I../include -Iconnect -Iencode -Idecode -Imisc -Iepmd \ -Iregistry -I$(TARGET) @@ -552,16 +560,18 @@ distclean: clean ifeq ($(findstring vxworks,$(TARGET)),vxworks) $(TARGET)/config.h: - echo "/* Generated by Makefile */" > $@ - echo "#define HAVE_STRERROR 1" >> $@ - echo "#define HAVE_SOCKLEN_T 1" >> $@ + $(gen_verbose) + $(V_at)echo "/* Generated by Makefile */" > $@ + $(V_at)echo "#define HAVE_STRERROR 1" >> $@ + $(V_at)echo "#define HAVE_SOCKLEN_T 1" >> $@ endif ifeq ($(findstring ose,$(TARGET)),ose) $(TARGET)/config.h: - echo "/* Generated by Makefile */" > $@ - echo "#define HAVE_STRERROR 1" >> $@ - echo "#define HAVE_SOCKLEN_T 1" >> $@ + $(gen_verbose) + $(V_at)echo "/* Generated by Makefile */" > $@ + $(V_at)echo "#define HAVE_STRERROR 1" >> $@ + $(V_at)echo "#define HAVE_SOCKLEN_T 1" >> $@ endif ########################################################################### @@ -569,19 +579,19 @@ endif ########################################################################### $(ST_OBJDIR)/%.o: %.c - $(CC) $(CFLAGS) -c $< -o $@ + $(V_CC) $(CFLAGS) -c $< -o $@ $(MT_OBJDIR)/%.o: %.c - $(CC) $(MTFLAG) $(CFLAGS) $(THR_DEFS) -c $< -o $@ + $(V_CC) $(MTFLAG) $(CFLAGS) $(THR_DEFS) -c $< -o $@ $(MD_OBJDIR)/%.o: %.c - $(CC) -MD $(CFLAGS) $(THR_DEFS) -c $< -o $@ + $(V_CC) -MD $(CFLAGS) $(THR_DEFS) -c $< -o $@ $(MD_OBJDIR)/%.o: %.c - $(CC) -MD $(CFLAGS) $(THR_DEFS) -c $< -o $@ + $(V_CC) -MD $(CFLAGS) $(THR_DEFS) -c $< -o $@ $(MDD_OBJDIR)/%.o: %.c - $(CC) -MDd $(CFLAGS) $(THR_DEFS) -c $< -o $@ + $(V_CC) -MDd $(CFLAGS) $(THR_DEFS) -c $< -o $@ ########################################################################### # Create directories @@ -598,67 +608,67 @@ ifeq ($(TARGET),win32) # Windows archive creation $(ST_EILIB) : $(ST_EIOBJECTS) - $(AR) -out:$@ $(ST_EIOBJECTS) - $(RANLIB) $@ + $(V_AR) -out:$@ $(ST_EIOBJECTS) + $(V_RANLIB) $@ $(ST_ERLLIB) : $(ST_ERLOBJECTS) - $(AR) -out:$@ $(ST_ERLOBJECTS) - $(RANLIB) $@ + $(V_AR) -out:$@ $(ST_ERLOBJECTS) + $(V_RANLIB) $@ $(MT_EILIB) : $(MT_EIOBJECTS) - $(AR) -out:$@ $(MT_EIOBJECTS) - $(RANLIB) $@ + $(V_AR) -out:$@ $(MT_EIOBJECTS) + $(V_RANLIB) $@ $(MT_ERLLIB) : $(MT_ERLOBJECTS) - $(AR) -out:$@ $(MT_ERLOBJECTS) - $(RANLIB) $@ + $(V_AR) -out:$@ $(MT_ERLOBJECTS) + $(V_RANLIB) $@ $(MD_EILIB) : $(MD_EIOBJECTS) - $(AR) -out:$@ $(MD_EIOBJECTS) - $(RANLIB) $@ + $(V_AR) -out:$@ $(MD_EIOBJECTS) + $(V_RANLIB) $@ $(MD_ERLLIB) : $(MD_ERLOBJECTS) - $(AR) -out:$@ $(MD_ERLOBJECTS) - $(RANLIB) $@ + $(V_AR) -out:$@ $(MD_ERLOBJECTS) + $(V_RANLIB) $@ $(MDD_EILIB) : $(MDD_EIOBJECTS) - $(AR) -out:$@ $(MDD_EIOBJECTS) - $(RANLIB) $@ + $(V_AR) -out:$@ $(MDD_EIOBJECTS) + $(V_RANLIB) $@ $(MDD_ERLLIB) : $(MDD_ERLOBJECTS) - $(AR) -out:$@ $(MDD_ERLOBJECTS) - $(RANLIB) $@ + $(V_AR) -out:$@ $(MDD_ERLOBJECTS) + $(V_RANLIB) $@ else # Unix archive creation $(ST_EILIB) : $(ST_EIOBJECTS) - rm -f $@ - $(AR) rcv $@ $(ST_EIOBJECTS) + $(V_at)rm -f $@ + $(V_AR) $(AR_FLAGS) $@ $(ST_EIOBJECTS) ifdef RANLIB - $(RANLIB) $@ + $(V_RANLIB) $@ endif $(ST_ERLLIB) : $(ST_ERLOBJECTS) - rm -f $@ - $(AR) rcv $@ $(ST_ERLOBJECTS) + $(V_at)rm -f $@ + $(V_AR) $(AR_FLAGS) $@ $(ST_ERLOBJECTS) ifdef RANLIB - $(RANLIB) $@ + $(V_RANLIB) $@ endif $(MT_EILIB) : $(MT_EIOBJECTS) - rm -f $@ - $(AR) rcv $@ $(MT_EIOBJECTS) + $(V_at)rm -f $@ + $(V_AR) $(AR_FLAGS) $@ $(MT_EIOBJECTS) ifdef RANLIB - $(RANLIB) $@ + $(V_RANLIB) $@ endif $(MT_ERLLIB) : $(MT_ERLOBJECTS) - rm -f $@ - $(AR) rcv $@ $(MT_ERLOBJECTS) + $(V_at)rm -f $@ + $(V_AR) $(AR_FLAGS) $@ $(MT_ERLOBJECTS) ifdef RANLIB - $(RANLIB) $@ + $(V_RANLIB) $@ endif endif @@ -669,18 +679,18 @@ endif ifeq ($(TARGET),win32) $(ERL_CALL): $(ERLCALL) ../include/ei.h $(MD_EILIB) - $(PURIFY) $(CC) -MD $(PROG_CFLAGS) $(THR_DEFS) -o $@ $(ERLCALL) \ + $(ld_verbose)$(PURIFY) $(CC) -MD $(PROG_CFLAGS) $(THR_DEFS) -o $@ $(ERLCALL) \ -L$(OBJDIR) -lei_md $(THR_LIBS) $(LIBS) -lsocket else ifeq ($(findstring vxworks,$(TARGET)),vxworks) $(ERL_CALL): $(ST_OBJDIR)/erl_call.o $(ST_OBJDIR)/erl_start.o ../include/ei.h $(ST_EILIB) - $(LD) -r -d -o $@ $(ST_OBJDIR)/erl_call.o $(ST_OBJDIR)/erl_start.o -L$(OBJDIR) -lei $(LIBS) + $(V_LD) -r -d -o $@ $(ST_OBJDIR)/erl_call.o $(ST_OBJDIR)/erl_start.o -L$(OBJDIR) -lei $(LIBS) $(ST_OBJDIR)/erl_call.o: prog/erl_call.c - $(CC) $(CFLAGS) -c $< -o $@ + $(V_CC) $(CFLAGS) -c $< -o $@ $(ST_OBJDIR)/erl_start.o: prog/erl_start.c - $(CC) $(CFLAGS) -c $< -o $@ + $(V_CC) $(CFLAGS) -c $< -o $@ else ifeq ($(findstring ose,$(TARGET)),ose) @@ -688,11 +698,11 @@ $(ERL_CALL): else ifdef THR_DEFS $(ERL_CALL): $(ERLCALL) ../include/ei.h $(MT_EILIB) - $(PURIFY) $(CC) $(PROG_CFLAGS) $(THR_DEFS) $(LDFLAGS) -o $@ $(ERLCALL) \ + $(ld_verbose)$(PURIFY) $(CC) $(PROG_CFLAGS) $(THR_DEFS) $(LDFLAGS) -o $@ $(ERLCALL) \ -L$(OBJDIR) -lei $(THR_LIBS) $(LIBS) else $(ERL_CALL): $(ERLCALL) ../include/ei.h $(ST_EILIB) - $(PURIFY) $(CC) $(PROG_CFLAGS) $(LDFLAGS) -o $@ $(ERLCALL) \ + $(ld_verbose)$(PURIFY) $(CC) $(PROG_CFLAGS) $(LDFLAGS) -o $@ $(ERLCALL) \ -L$(OBJDIR) -lei $(LIBS) endif endif @@ -707,36 +717,36 @@ check: $(FAKE_TARGETS) ifndef THR_DEFS $(ST_OBJDIR)/erl_fake_prog_st$(EXE): prog/erl_fake_prog.c $(ST_ERLLIB) $(ST_EILIB) - $(CC) $(PROG_CFLAGS) -o $@ $< -L$(OBJDIR) -lerl_interface -lei \ + $(V_CC) $(PROG_CFLAGS) -o $@ $< -L$(OBJDIR) -lerl_interface -lei \ $(LIBS) $(ST_OBJDIR)/ei_fake_prog_st$(EXE): prog/ei_fake_prog.c $(ST_EILIB) - $(CC) $(PROG_CFLAGS) -o $@ $< -L$(OBJDIR) -lei $(LIBS) + $(V_CC) $(PROG_CFLAGS) -o $@ $< -L$(OBJDIR) -lei $(LIBS) $(ST_OBJDIR)/erl_fake_prog_cxx_st$(EXE): prog/erl_fake_prog.c \ $(ST_ERLLIB) $(ST_EILIB) - $(CC) $(PROG_CFLAGS) -o $@ -xc++ $< -L$(OBJDIR) \ + $(V_CC) $(PROG_CFLAGS) -o $@ -xc++ $< -L$(OBJDIR) \ -lerl_interface -lei $(LIBS) $(ST_OBJDIR)/ei_fake_prog_cxx_st$(EXE): prog/ei_fake_prog.c $(ST_EILIB) - $(CC) $(PROG_CFLAGS) -o $@ -xc++ $< -L$(OBJDIR) -lei $(LIBS) + $(V_CC) $(PROG_CFLAGS) -o $@ -xc++ $< -L$(OBJDIR) -lei $(LIBS) else $(ST_OBJDIR)/erl_fake_prog_st$(EXE): prog/erl_fake_prog.c $(ST_ERLLIB) $(ST_EILIB) - $(CC) $(PROG_CFLAGS) -o $@ $< -L$(OBJDIR) -lerl_interface_st -lei_st \ + $(V_CC) $(PROG_CFLAGS) -o $@ $< -L$(OBJDIR) -lerl_interface_st -lei_st \ $(LIBS) $(ST_OBJDIR)/ei_fake_prog_st$(EXE): prog/ei_fake_prog.c $(ST_EILIB) - $(CC) $(PROG_CFLAGS) -o $@ $< -L$(OBJDIR) -lei_st $(LIBS) + $(V_CC) $(PROG_CFLAGS) -o $@ $< -L$(OBJDIR) -lei_st $(LIBS) $(ST_OBJDIR)/erl_fake_prog_cxx_st$(EXE): prog/erl_fake_prog.c \ $(ST_ERLLIB) $(ST_EILIB) - $(CC) $(PROG_CFLAGS) -o $@ -xc++ $< -L$(OBJDIR) \ + $(V_CC) $(PROG_CFLAGS) -o $@ -xc++ $< -L$(OBJDIR) \ -lerl_interface_st -lei_st $(LIBS) $(ST_OBJDIR)/ei_fake_prog_cxx_st$(EXE): prog/ei_fake_prog.c $(ST_EILIB) - $(CC) $(PROG_CFLAGS) -o $@ -xc++ $< -L$(OBJDIR) -lei_st $(LIBS) + $(V_CC) $(PROG_CFLAGS) -o $@ -xc++ $< -L$(OBJDIR) -lei_st $(LIBS) endif @@ -744,63 +754,63 @@ endif $(MT_OBJDIR)/erl_fake_prog_mt$(EXE): prog/erl_fake_prog.c \ $(MT_ERLLIB) $(MT_EILIB) - $(CC) $(MTFLAG) $(PROG_CFLAGS) $(THR_DEFS) -o $@ $< -L$(OBJDIR) \ + $(V_CC) $(MTFLAG) $(PROG_CFLAGS) $(THR_DEFS) -o $@ $< -L$(OBJDIR) \ -lerl_interface -lei $(THR_LIBS) $(LIBS) $(MT_OBJDIR)/ei_fake_prog_mt$(EXE): prog/ei_fake_prog.c $(MT_EILIB) - $(CC) $(MTFLAG) $(PROG_CFLAGS) $(THR_DEFS) -o $@ $< \ + $(V_CC) $(MTFLAG) $(PROG_CFLAGS) $(THR_DEFS) -o $@ $< \ -L$(OBJDIR) -lei $(THR_LIBS) $(LIBS) $(MT_OBJDIR)/erl_fake_prog_mt_cxx$(EXE): prog/erl_fake_prog.c \ $(MT_ERLLIB) $(MT_EILIB) - $(CC) $(MTFLAG) $(PROG_CFLAGS) $(THR_DEFS) -o $@ -xc++ $< \ + $(V_CC) $(MTFLAG) $(PROG_CFLAGS) $(THR_DEFS) -o $@ -xc++ $< \ -L$(OBJDIR) -lerl_interface -lei \ $(THR_LIBS) $(LIBS) $(MT_OBJDIR)/ei_fake_prog_mt_cxx$(EXE): prog/ei_fake_prog.c $(MT_EILIB) - $(CC) $(MTFLAG) $(PROG_CFLAGS) $(THR_DEFS) -o $@ -xc++ $< \ + $(V_CC) $(MTFLAG) $(PROG_CFLAGS) $(THR_DEFS) -o $@ -xc++ $< \ -L$(OBJDIR) -lei $(THR_LIBS) $(LIBS) #### $(MD_OBJDIR)/erl_fake_prog_md$(EXE): prog/erl_fake_prog.c \ $(MD_ERLLIB) $(MD_EILIB) - $(CC) -MD $(PROG_CFLAGS) $(THR_DEFS) -o $@ $< -L$(OBJDIR) \ + $(V_CC) -MD $(PROG_CFLAGS) $(THR_DEFS) -o $@ $< -L$(OBJDIR) \ -lerl_interface_r -lei_r $(THR_LIBS) $(LIBS) $(MD_OBJDIR)/ei_fake_prog_md$(EXE): prog/ei_fake_prog.c $(MD_EILIB) - $(CC) -MD $(PROG_CFLAGS) $(THR_DEFS) -o $@ $< \ + $(V_CC) -MD $(PROG_CFLAGS) $(THR_DEFS) -o $@ $< \ -L$(OBJDIR) -lei_r $(THR_LIBS) $(LIBS) $(MD_OBJDIR)/erl_fake_prog_md_cxx$(EXE): prog/erl_fake_prog.c \ $(MD_ERLLIB) $(MD_EILIB) - $(CC) -MD $(PROG_CFLAGS) $(THR_DEFS) -o $@ -xc++ $< \ + $(V_CC) -MD $(PROG_CFLAGS) $(THR_DEFS) -o $@ -xc++ $< \ -L$(OBJDIR) -lerl_interface_r -lei_r \ $(THR_LIBS) $(LIBS) $(MD_OBJDIR)/ei_fake_prog_md_cxx$(EXE): prog/ei_fake_prog.c $(MD_EILIB) - $(CC) -MD $(PROG_CFLAGS) $(THR_DEFS) -o $@ -xc++ $< \ + $(V_CC) -MD $(PROG_CFLAGS) $(THR_DEFS) -o $@ -xc++ $< \ -L$(OBJDIR) -lei_r $(THR_LIBS) $(LIBS) #### $(MDD_OBJDIR)/erl_fake_prog_mdd$(EXE): prog/erl_fake_prog.c \ $(MDD_ERLLIB) $(MDD_EILIB) - $(CC) -MDD $(PROG_CFLAGS) $(THR_DEFS) -o $@ $< -L$(OBJDIR) \ + $(V_CC) -MDD $(PROG_CFLAGS) $(THR_DEFS) -o $@ $< -L$(OBJDIR) \ -lerl_interface_r -lei_r $(THR_LIBS) $(LIBS) $(MDD_OBJDIR)/ei_fake_prog_mdd$(EXE): prog/ei_fake_prog.c $(MDD_EILIB) - $(CC) -MDD $(PROG_CFLAGS) $(THR_DEFS) -o $@ $< \ + $(V_CC) -MDD $(PROG_CFLAGS) $(THR_DEFS) -o $@ $< \ -L$(OBJDIR) -lei_r $(THR_LIBS) $(LIBS) $(MDD_OBJDIR)/erl_fake_prog_mdd_cxx$(EXE): prog/erl_fake_prog.c \ $(MDD_ERLLIB) $(MDD_EILIB) - $(CC) -MDD $(PROG_CFLAGS) $(THR_DEFS) -o $@ -xc++ $< \ + $(V_CC) -MDD $(PROG_CFLAGS) $(THR_DEFS) -o $@ -xc++ $< \ -L$(OBJDIR) -lerl_interface_r -lei_r \ $(THR_LIBS) $(LIBS) $(MDD_OBJDIR)/ei_fake_prog_mdd_cxx$(EXE): prog/ei_fake_prog.c $(MDD_EILIB) - $(CC) -MDD $(PROG_CFLAGS) $(THR_DEFS) -o $@ -xc++ $< \ + $(V_CC) -MDD $(PROG_CFLAGS) $(THR_DEFS) -o $@ -xc++ $< \ -L$(OBJDIR) -lei_r $(THR_LIBS) $(LIBS) ########################################################################### @@ -808,9 +818,10 @@ $(MDD_OBJDIR)/ei_fake_prog_mdd_cxx$(EXE): prog/ei_fake_prog.c $(MDD_EILIB) ########################################################################### depend: - @echo "Generating dependency file depend.mk..." + $(gen_verbose) + $(V_colon)@echo "Generating dependency file depend.mk..." @echo "# Generated dependency rules" > depend.mk; \ - $(CC) $(CFLAGS) -MM $(SOURCES) | \ + $(V_CC) $(CFLAGS) -MM $(SOURCES) | \ sed 's&$(TARGET)&\$$\(TARGET\)&g' | \ sed 's/^.*:/\$$\(ST_OBJDIR\)\/&/' >> depend.mk; \ echo >> depend.mk; \ diff --git a/lib/et/src/Makefile b/lib/et/src/Makefile index c68a3f4efd..386169fe95 100644 --- a/lib/et/src/Makefile +++ b/lib/et/src/Makefile @@ -92,10 +92,10 @@ docs: # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Release Target diff --git a/lib/eunit/src/Makefile b/lib/eunit/src/Makefile index 0a2e71cf7b..e88e28df83 100644 --- a/lib/eunit/src/Makefile +++ b/lib/eunit/src/Makefile @@ -104,10 +104,10 @@ $(OBJECTS): $(PARSE_TRANSFORM_BIN) # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Release Target diff --git a/lib/gs/contribs/bonk/Makefile b/lib/gs/contribs/bonk/Makefile index a630deaf24..d160ca8b73 100644 --- a/lib/gs/contribs/bonk/Makefile +++ b/lib/gs/contribs/bonk/Makefile @@ -81,12 +81,12 @@ clean: # ---------------------------------------------------- $(EBIN)/$(TOOLNAME).gif: $(TOOLNAME).gif - rm -f $@ - cp $(TOOLNAME).gif $@ + $(gen_verbose)rm -f $@ + $(V_at)cp $(TOOLNAME).gif $@ $(EBIN)/$(TOOLNAME).tool: $(TOOLNAME).tool - rm -f $@ - cp $(TOOLNAME).tool $@ + $(gen_verbose)rm -f $@ + $(V_at)cp $(TOOLNAME).tool $@ # ---------------------------------------------------- # Release Target diff --git a/lib/gs/contribs/cols/Makefile b/lib/gs/contribs/cols/Makefile index 3af91e1dae..3036e9565e 100644 --- a/lib/gs/contribs/cols/Makefile +++ b/lib/gs/contribs/cols/Makefile @@ -74,16 +74,16 @@ clean: # ---------------------------------------------------- $(EBIN)/$(TOOLNAME).gif: $(TOOLNAME).gif - rm -f $@ - cp $(TOOLNAME).gif $@ + $(gen_verbose)rm -f $@ + $(V_at)cp $(TOOLNAME).gif $@ $(EBIN)/$(TOOLNAME).tool: $(TOOLNAME).tool - rm -f $@ - cp $(TOOLNAME).tool $@ + $(gen_verbose)rm -f $@ + $(V_at)cp $(TOOLNAME).tool $@ $(EBIN)/help.gif: help.gif - rm -f $@ - cp help.gif $@ + $(gen_verbose)rm -f $@ + $(V_at)cp help.gif $@ # ---------------------------------------------------- # Release Target diff --git a/lib/gs/contribs/mandel/Makefile b/lib/gs/contribs/mandel/Makefile index 5f0b047955..308ba0cbb0 100644 --- a/lib/gs/contribs/mandel/Makefile +++ b/lib/gs/contribs/mandel/Makefile @@ -73,16 +73,16 @@ clean: # ---------------------------------------------------- $(EBIN)/$(TOOLNAME).gif: $(TOOLNAME).gif - rm -f $@ - cp $(TOOLNAME).gif $@ + $(gen_verbose)rm -f $@ + $(V_at)cp $(TOOLNAME).gif $@ $(EBIN)/$(TOOLNAME).tool: $(TOOLNAME).tool - rm -f $@ - cp $(TOOLNAME).tool $@ + $(gen_verbose)rm -f $@ + $(V_at)cp $(TOOLNAME).tool $@ $(EBIN)/help.gif: help.gif - rm -f $@ - cp help.gif $@ + $(gen_verbose)rm -f $@ + $(V_at)cp help.gif $@ # ---------------------------------------------------- # Release Target diff --git a/lib/gs/contribs/othello/Makefile b/lib/gs/contribs/othello/Makefile index 5f37d164f5..f9d131c315 100644 --- a/lib/gs/contribs/othello/Makefile +++ b/lib/gs/contribs/othello/Makefile @@ -76,12 +76,12 @@ clean: # ---------------------------------------------------- $(EBIN)/$(TOOLNAME).gif: $(TOOLNAME).gif - rm -f $@ - cp $(TOOLNAME).gif $@ + $(gen_verbose)rm -f $@ + $(V_at)cp $(TOOLNAME).gif $@ $(EBIN)/$(TOOLNAME).tool: $(TOOLNAME).tool - rm -f $@ - cp $(TOOLNAME).tool $@ + $(gen_verbose)rm -f $@ + $(V_at)cp $(TOOLNAME).tool $@ # ---------------------------------------------------- # Release Target diff --git a/lib/gs/src/Makefile b/lib/gs/src/Makefile index 4b7a4523b9..0a63d5466e 100644 --- a/lib/gs/src/Makefile +++ b/lib/gs/src/Makefile @@ -91,13 +91,13 @@ clean: # ---------------------------------------------------- gstk_generic.hrl: gs_make.erl ../ebin/gs_make.$(EMULATOR) ../ebin/gs.$(EMULATOR) - $(ERL) -pa $(EBIN) -s gs_make -s erlang halt -noshell + $(gen_verbose)$(ERL) -pa $(EBIN) -s gs_make -s erlang halt -noshell $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(GSTK_GENERIC_TARGET): gstk_generic.hrl diff --git a/lib/hipe/Makefile b/lib/hipe/Makefile index 2294f98158..a9e24f4d17 100644 --- a/lib/hipe/Makefile +++ b/lib/hipe/Makefile @@ -57,20 +57,20 @@ edocs: fi all-subdirs: - for dir in $(SUB_DIRECTORIES); do \ + $(V_at)for dir in $(SUB_DIRECTORIES); do \ (cd $$dir; $(MAKE) $(MAKETARGET) EBIN=$(EBIN); cd ..); \ done # distclean and realclean should clean the bootstrap files all-subdirs-x: - for dir in $(SUB_DIRECTORIES); do \ + $(V_at)for dir in $(SUB_DIRECTORIES); do \ (cd $$dir; $(MAKE) $(MAKETARGET) EBIN=../boot_ebin; cd ..); \ done clean: - $(MAKE) MAKETARGET="clean" all-subdirs all-subdirs-x + $(V_at)$(MAKE) MAKETARGET="clean" all-subdirs all-subdirs-x distclean: - $(MAKE) MAKETARGET="distclean" all-subdirs all-subdirs-x + $(V_at)$(MAKE) MAKETARGET="distclean" all-subdirs all-subdirs-x realclean: - $(MAKE) MAKETARGET="realclean" all-subdirs all-subdirs-x + $(V_at)$(MAKE) MAKETARGET="realclean" all-subdirs all-subdirs-x diff --git a/lib/hipe/main/Makefile b/lib/hipe/main/Makefile index 673431a175..66e4c3e39a 100644 --- a/lib/hipe/main/Makefile +++ b/lib/hipe/main/Makefile @@ -76,7 +76,7 @@ ERL_COMPILE_FLAGS += +nowarn_shadow_vars +warn_missing_spec +warn_untyped_record # ---------------------------------------------------- hipe.hrl: ../vsn.mk hipe.hrl.src - sed -e "s;%VSN%;$(HIPE_VSN);" ../../hipe/main/hipe.hrl.src > ../../hipe/main/hipe.hrl + $(vsn_verbose)sed -e "s;%VSN%;$(HIPE_VSN);" ../../hipe/main/hipe.hrl.src > ../../hipe/main/hipe.hrl $(EBIN)/hipe.beam: hipe.hrl ../../compiler/src/beam_disasm.hrl $(EBIN)/hipe_main.beam: hipe.hrl ../icode/hipe_icode.hrl #../rtl/hipe_rtl.hrl @@ -97,17 +97,17 @@ distclean: clean realclean: clean $(DOCS)/%.html:%.erl - erl -noshell -run edoc_run file '"$<"' '[{dir, "$(DOCS)"}]' -s init stop + $(gen_verbose)erl -noshell -run edoc_run file '"$<"' '[{dir, "$(DOCS)"}]' -s init stop # ---------------------------------------------------- # Special Build Targets # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Release Target diff --git a/lib/hipe/rtl/Makefile b/lib/hipe/rtl/Makefile index 426d1bd3ee..7852a2172b 100644 --- a/lib/hipe/rtl/Makefile +++ b/lib/hipe/rtl/Makefile @@ -134,13 +134,13 @@ HIPE_MKLITERALS=$(ERL_TOP)/bin/$(TARGET)/hipe_mkliterals$(TYPE_STR)$(FLAVOR_STR) hipe_literals.hrl: $(HIPE_MKLITERALS) - $(HIPE_MKLITERALS) $(MKLIT_FLAGS) -e > hipe_literals.hrl + $(gen_verbose)$(HIPE_MKLITERALS) $(MKLIT_FLAGS) -e > hipe_literals.hrl # Need to generate hipe.hrl from one and only one target in one and only # one makefile; otherwise, clearmake will force rebuilds of hipe over and # over again. ../main/hipe.hrl: ../vsn.mk ../main/hipe.hrl.src - (cd ../main && $(MAKE) hipe.hrl) + $(V_at)(cd ../main && $(MAKE) hipe.hrl) # 2012-02-24. Please keep these dependencies up to date. They tend to rot. # grep ^-include *.erl says a lot, but you need to dig further, e.g: diff --git a/lib/ic/c_src/Makefile.in b/lib/ic/c_src/Makefile.in index de46eadb3b..856823b1b3 100644 --- a/lib/ic/c_src/Makefile.in +++ b/lib/ic/c_src/Makefile.in @@ -67,7 +67,11 @@ ifeq ($(findstring solaris,$(HOST_OS)),solaris) SKIP_BUILDING_BINARIES := true endif else +ifeq ($(V),0) +AR_OUT = rc +else AR_OUT = rcv +endif CC_FLAGS = @DED_CFLAGS@ LIBRARY = $(LIBDIR)/libic.a SKIP_BUILDING_BINARIES := false @@ -128,11 +132,13 @@ docs: _create_dirs := $(shell mkdir -p $(OBJDIR) $(LIBDIR)) $(LIBRARY): $(OBJ_FILES) - -$(AR) $(AR_OUT) $@ $(OBJ_FILES) + $(ar_verbose) + -$(AR) $(AR_OUT) $@ $(OBJ_FILES) + $(ranlib_verbose) -$(RANLIB) $@ $(OBJDIR)/%.o: %.c - $(CC) $(CC_FLAGS) -c -o $@ $(ALL_CFLAGS) $< + $(V_CC) $(CC_FLAGS) -c -o $@ $(ALL_CFLAGS) $< # ---------------------------------------------------- # Release Target diff --git a/lib/ic/examples/pre_post_condition/Makefile b/lib/ic/examples/pre_post_condition/Makefile index d18f81fec9..53e647e793 100644 --- a/lib/ic/examples/pre_post_condition/Makefile +++ b/lib/ic/examples/pre_post_condition/Makefile @@ -109,9 +109,9 @@ test: $(TEST_TARGET_FILES) IDL-GENERATED: ex.idl - erlc $(ERL_LOCAL_FLAGS) +'{precond,{tracer,pre}}' \ + $(gen_verbose)erlc $(ERL_LOCAL_FLAGS) +'{precond,{tracer,pre}}' \ +'{{postcond,"m::i::f"},{tracer,post}}' ex.idl - >IDL-GENERATED + $(V_at)>IDL-GENERATED $(GEN_ERL_MODULES:%=%.erl) $(GEN_HRL_FILES): IDL-GENERATED diff --git a/lib/ic/java_src/com/ericsson/otp/ic/Makefile b/lib/ic/java_src/com/ericsson/otp/ic/Makefile index cf4c353f3f..273614e8d9 100644 --- a/lib/ic/java_src/com/ericsson/otp/ic/Makefile +++ b/lib/ic/java_src/com/ericsson/otp/ic/Makefile @@ -85,7 +85,10 @@ JAR= jar JAVADOCFLAGS=-d $(DOCDIR) JAVAFLAGS=-d $(JAVA_DEST_ROOT) -JARFLAGS= -cvf +JARFLAGS= -cf +ifneq ($(V),0) +JARFLAGS= -cfv +endif JAVA_OPTIONS = diff --git a/lib/ic/src/Makefile b/lib/ic/src/Makefile index 280d86a8a4..e8769d2335 100644 --- a/lib/ic/src/Makefile +++ b/lib/ic/src/Makefile @@ -175,7 +175,7 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ docs: @@ -183,7 +183,7 @@ docs: # Special Build Targets # ---------------------------------------------------- ../ebin/icparse.beam: icparse.erl - $(ERLC) $(ERL_COMPILE_FLAGS) +nowarn_unused_vars +nowarn_unused_function -o$(EBIN) +pj $< + $(V_ERLC) $(ERL_COMPILE_FLAGS) +nowarn_unused_vars +nowarn_unused_function -o$(EBIN) +pj $< icparse.erl: icparse.yrl icyeccpre.hrl diff --git a/lib/ic/test/java_client_erl_server_SUITE_data/Makefile.src b/lib/ic/test/java_client_erl_server_SUITE_data/Makefile.src index 3143ab427b..a2440adc92 100644 --- a/lib/ic/test/java_client_erl_server_SUITE_data/Makefile.src +++ b/lib/ic/test/java_client_erl_server_SUITE_data/Makefile.src @@ -86,15 +86,15 @@ clean: java_erl_test.built_erl java_erl_test.built_java java_erl_test.built_java: java_erl_test.idl - $(ERLC) -I $(IC_INCLUDE_PATH) "+{be,java}" java_erl_test.idl - echo done > java_erl_test.built_java + $(gen_verbose)$(ERLC) -I $(IC_INCLUDE_PATH) "+{be,java}" java_erl_test.idl + $(V_at)echo done > java_erl_test.built_java $(CLASS_FILES) : $(JAVA_FILES) - $(JAVAC) -classpath $(CLASSPATH) $(JAVA_FILES) + $(V_JAVAC) -classpath $(CLASSPATH) $(JAVA_FILES) java_erl_test.built_erl: java_erl_test.idl - $(ERLC) -I $(IC_INCLUDE_PATH) "+{be,erl_genserv}" java_erl_test.idl - echo done > java_erl_test.built_erl + $(gen_verbose)$(ERLC) -I $(IC_INCLUDE_PATH) "+{be,erl_genserv}" java_erl_test.idl + $(V_at)echo done > java_erl_test.built_erl .erl.@EMULATOR@: - $(ERLC) -I $(IC_INCLUDE_PATH) $< + $(V_ERLC) -I $(IC_INCLUDE_PATH) $< diff --git a/lib/inets/src/inets_app/Makefile b/lib/inets/src/inets_app/Makefile index 7d68145287..22426eee79 100644 --- a/lib/inets/src/inets_app/Makefile +++ b/lib/inets/src/inets_app/Makefile @@ -99,10 +99,10 @@ docs: # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- diff --git a/lib/jinterface/java_src/Makefile b/lib/jinterface/java_src/Makefile index 19f99831eb..0aa9c09548 100644 --- a/lib/jinterface/java_src/Makefile +++ b/lib/jinterface/java_src/Makefile @@ -47,7 +47,7 @@ POM_SRC= $(POM_FILE).src # ---------------------------------------------------- $(POM_TARGET): $(POM_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ include $(ERL_TOP)/make/otp_subdir.mk diff --git a/lib/jinterface/java_src/com/ericsson/otp/erlang/Makefile b/lib/jinterface/java_src/com/ericsson/otp/erlang/Makefile index 8ae63a1561..f476d4594d 100644 --- a/lib/jinterface/java_src/com/ericsson/otp/erlang/Makefile +++ b/lib/jinterface/java_src/com/ericsson/otp/erlang/Makefile @@ -61,7 +61,10 @@ CLASSPATH = $(JAVA_SRC_ROOT) JAVADOCFLAGS=-d $(DOCDIR) JAVAFLAGS=-d $(JAVA_DEST_ROOT) -JARFLAGS=-cvf +JARFLAGS=-cf +ifneq ($(V),0) +JARFLAGS=-cfv +endif JAVA_OPTIONS = @@ -79,13 +82,13 @@ endif debug opt: make_dirs $(JAVA_DEST_ROOT)$(JARFILE) make_dirs: - if [ ! -d "$(JAVA_DEST_ROOT)" ];then mkdir "$(JAVA_DEST_ROOT)"; fi + $(V_at)if [ ! -d "$(JAVA_DEST_ROOT)" ];then mkdir "$(JAVA_DEST_ROOT)"; fi $(JAVA_DEST_ROOT)$(JARFILE): $(TARGET_FILES) @(cd $(JAVA_DEST_ROOT) ; $(JAR) $(JARFLAGS) $(JARFILE) $(JAVA_CLASS_SUBDIR)) clean: - rm -f $(TARGET_FILES) *~ + $(V_at)rm -f $(TARGET_FILES) *~ docs: @@ -96,13 +99,13 @@ docs: # include $(ERL_TOP)/make/otp_release_targets.mk release release_docs release_tests release_html: - $(MAKE) $(MFLAGS) RELEASE_PATH="$(RELEASE_PATH)" $(TARGET_MAKEFILE) $@_spec + $(V_at)$(MAKE) $(MFLAGS) RELEASE_PATH="$(RELEASE_PATH)" $(TARGET_MAKEFILE) $@_spec release_spec: opt - $(INSTALL_DIR) "$(RELSYSDIR)/java_src/com/ericsson/otp/erlang" - $(INSTALL_DATA) $(JAVA_SRC) "$(RELSYSDIR)/java_src/com/ericsson/otp/erlang" - $(INSTALL_DIR) "$(RELSYSDIR)/priv" - $(INSTALL_DATA) $(JAVA_DEST_ROOT)$(JARFILE) "$(RELSYSDIR)/priv" + $(V_at)$(INSTALL_DIR) "$(RELSYSDIR)/java_src/com/ericsson/otp/erlang" + $(V_at)$(INSTALL_DATA) $(JAVA_SRC) "$(RELSYSDIR)/java_src/com/ericsson/otp/erlang" + $(V_at)$(INSTALL_DIR) "$(RELSYSDIR)/priv" + $(V_at)$(INSTALL_DATA) $(JAVA_DEST_ROOT)$(JARFILE) "$(RELSYSDIR)/priv" release_docs_spec: diff --git a/lib/kernel/doc/src/error_handler.xml b/lib/kernel/doc/src/error_handler.xml index acbf9a2c6e..610b65f0a2 100644 --- a/lib/kernel/doc/src/error_handler.xml +++ b/lib/kernel/doc/src/error_handler.xml @@ -43,19 +43,39 @@ A (possibly empty) list of arguments <c>Arg1,..,ArgN</c> </type_desc> <desc> - <p>This function is evaluated if a call is made to + <p>This function is called by the run-time system if a call is made to <c><anno>Module</anno>:<anno>Function</anno>(Arg1,.., ArgN)</c> and <c><anno>Module</anno>:<anno>Function</anno>/N</c> is undefined. Note that <c>undefined_function/3</c> is evaluated inside the process making the original call.</p> - <p>If <c><anno>Module</anno></c> is interpreted, the interpreter is invoked - and the return value of the interpreted - <c><anno>Function</anno>(Arg1,.., ArgN)</c> call is returned.</p> - <p>Otherwise, it returns, if possible, the value of - <c>apply(<anno>Module</anno>, <anno>Function</anno>, <anno>Args</anno>)</c> after an attempt has been - made to autoload <c><anno>Module</anno></c>. If this is not possible, the - call to <c><anno>Module</anno>:<anno>Function</anno>(Arg1,.., ArgN)</c> fails with - exit reason <c>undef</c>.</p> + + <p>This function will first attempt to autoload + <c><anno>Module</anno></c>. If that is not possible, + an <c>undef</c> exception will be raised.</p> + + <p>If it was possible to load <c><anno>Module</anno></c> + and the function <c><anno>Function</anno>/N</c> is exported, + it will be called.</p> + + <p>Otherwise, if the function <c>'$handle_undefined_function'/2</c> + is exported, it will be called as + <c>'$handle_undefined_function'(</c><anno>Function</anno>, + <anno>Args</anno>). + </p> + <p>Otherwise an <c>undef</c> exception will be raised.</p> + </desc> + </func> + <func> + <name name="raise_undef_exception" arity="3"/> + <fsummary>Raise an undef exception</fsummary> + <type_desc variable="Args"> + A (possibly empty) list of arguments <c>Arg1,..,ArgN</c> + </type_desc> + <desc> + <p>Raise an <c>undef</c> exception with a stacktrace indicating + that <c><anno>Module</anno>:<anno>Function</anno>/N</c> is + undefined. + </p> </desc> </func> <func> diff --git a/lib/kernel/src/Makefile b/lib/kernel/src/Makefile index 60291bbce6..eaced4861a 100644 --- a/lib/kernel/src/Makefile +++ b/lib/kernel/src/Makefile @@ -170,13 +170,13 @@ docs: # ---------------------------------------------------- ../../hipe/main/hipe.hrl: ../../hipe/vsn.mk ../../hipe/main/hipe.hrl.src - sed -e "s;%VSN%;$(HIPE_VSN);" ../../hipe/main/hipe.hrl.src > ../../hipe/main/hipe.hrl + $(vsn_verbose)sed -e "s;%VSN%;$(HIPE_VSN);" ../../hipe/main/hipe.hrl.src > ../../hipe/main/hipe.hrl $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(KERNEL_VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(KERNEL_VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(KERNEL_VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(KERNEL_VSN);' $< > $@ EPMD_FLAGS = -Depmd_port_no=$(EPMD_PORT_NO) \ @@ -186,10 +186,10 @@ EPMD_FLAGS = -Depmd_port_no=$(EPMD_PORT_NO) \ -Derlang_daemon_port=$(EPMD_PORT_NO) $(ESRC)/inet_dns_record_adts.hrl: $(ESRC)/inet_dns_record_adts.pl - LANG=C $(PERL) $< > $@ + $(gen_verbose)LANG=C $(PERL) $< > $@ $(EBIN)/erl_epmd.beam: $(ESRC)/erl_epmd.erl - $(ERLC) $(ERL_COMPILE_FLAGS) $(EPMD_FLAGS) -o$(EBIN) $< + $(V_ERLC) $(ERL_COMPILE_FLAGS) $(EPMD_FLAGS) -o$(EBIN) $< # ---------------------------------------------------- # Release Target diff --git a/lib/kernel/src/error_handler.erl b/lib/kernel/src/error_handler.erl index f8bc5f499c..a3aa1f1dcf 100644 --- a/lib/kernel/src/error_handler.erl +++ b/lib/kernel/src/error_handler.erl @@ -23,10 +23,12 @@ %% "error_handler: add no_native compiler directive" -compile(no_native). -%% A simple error handler. +%% Callbacks called from the run-time system. +-export([undefined_function/3,undefined_lambda/3,breakpoint/3]). --export([undefined_function/3, undefined_lambda/3, stub_function/3, - breakpoint/3]). +%% Exported utility functions. +-export([raise_undef_exception/3]). +-export([stub_function/3]). -spec undefined_function(Module, Function, Args) -> any() when @@ -41,12 +43,7 @@ undefined_function(Module, Func, Args) -> true -> apply(Module, Func, Args); false -> - case check_inheritance(Module, Args) of - {value, Base, Args1} -> - apply(Base, Func, Args1); - none -> - crash(Module, Func, Args) - end + call_undefined_function_handler(Module, Func, Args) end; {module, _} -> crash(Module, Func, Args); @@ -77,6 +74,14 @@ undefined_lambda(Module, Fun, Args) -> breakpoint(Module, Func, Args) -> (int()):eval(Module, Func, Args). +-spec raise_undef_exception(Module, Function, Args) -> no_return() when + Module :: atom(), + Function :: atom(), + Args :: list(). + +raise_undef_exception(Module, Func, Args) -> + crash({Module,Func,Args,[]}). + %% Used to make the call to the 'int' module a "weak" one, to avoid %% building strong components in xref or dialyzer. @@ -130,27 +135,11 @@ ensure_loaded(Module) -> stub_function(Mod, Func, Args) -> exit({undef,[{Mod,Func,Args,[]}]}). -check_inheritance(Module, Args) -> - Attrs = erlang:get_module_info(Module, attributes), - case lists:keyfind(extends, 1, Attrs) of - {extends, [Base]} when is_atom(Base), Base =/= Module -> - %% This is just a heuristic for detecting abstract modules - %% with inheritance so they can be handled; it would be - %% much better to do it in the emulator runtime - case lists:keyfind(abstract, 1, Attrs) of - {abstract, [true]} -> - case lists:reverse(Args) of - [M|Rs] when tuple_size(M) > 1, - element(1,M) =:= Module, - tuple_size(element(2,M)) > 0, - is_atom(element(1,element(2,M))) -> - {value, Base, lists:reverse(Rs, [element(2,M)])}; - _ -> - {value, Base, Args} - end; - _ -> - {value, Base, Args} - end; - _ -> - none +call_undefined_function_handler(Module, Func, Args) -> + Handler = '$handle_undefined_function', + case erlang:function_exported(Module, Handler, 2) of + false -> + crash(Module, Func, Args); + true -> + Module:Handler(Func, Args) end. diff --git a/lib/kernel/test/Makefile b/lib/kernel/test/Makefile index 7fd3afe93c..8d2d55777b 100644 --- a/lib/kernel/test/Makefile +++ b/lib/kernel/test/Makefile @@ -48,6 +48,7 @@ MODULES= \ erl_distribution_SUITE \ erl_distribution_wb_SUITE \ erl_prim_loader_SUITE \ + error_handler_SUITE \ error_logger_SUITE \ error_logger_warn_SUITE \ file_SUITE \ diff --git a/lib/kernel/test/error_handler_SUITE.erl b/lib/kernel/test/error_handler_SUITE.erl new file mode 100644 index 0000000000..2a86d39b74 --- /dev/null +++ b/lib/kernel/test/error_handler_SUITE.erl @@ -0,0 +1,68 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2013. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +-module(error_handler_SUITE). + +-export([all/0,suite/0,groups/0,init_per_suite/1,end_per_suite/1, + init_per_group/2,end_per_group/2, + undefined_function_handler/1]). + +%% Callback from error_handler. +-export(['$handle_undefined_function'/2]). + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [undefined_function_handler]. + +groups() -> + []. + +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + +%%----------------------------------------------------------------- + +undefined_function_handler(_) -> + 42 = ?MODULE:forty_two(), + 42 = (id(?MODULE)):forty_two(), + {ok,{a,b,c}} = ?MODULE:one_arg({a,b,c}), + {ok,{a,b,c}} = (id(?MODULE)):one_arg({a,b,c}), + {'EXIT',{undef,[{?MODULE,undef_and_not_handled,[[1,2,3]],[]}|_]}} = + (catch ?MODULE:undef_and_not_handled([1,2,3])), + ok. + +'$handle_undefined_function'(forty_two, []) -> + 42; +'$handle_undefined_function'(one_arg, [Arg]) -> + {ok,Arg}; +'$handle_undefined_function'(Func, Args) -> + error_handler:raise_undef_exception(?MODULE, Func, Args). + +id(I) -> + I. diff --git a/lib/megaco/aclocal.m4 b/lib/megaco/aclocal.m4 index 5d555a5123..918e30a886 100644 --- a/lib/megaco/aclocal.m4 +++ b/lib/megaco/aclocal.m4 @@ -1861,17 +1861,16 @@ dnl Usage example LM_TRY_ENABLE_CFLAG([-Werror=return-type], [CFLAGS]) dnl dnl AC_DEFUN([LM_TRY_ENABLE_CFLAG], [ - AC_MSG_CHECKING([if we can add $1 to CFLAGS]) + AC_MSG_CHECKING([if we can add $1 to $2 (via CFLAGS)]) saved_CFLAGS=$CFLAGS; - CFLAGS="$1 $CFLAGS"; + CFLAGS="$1 $$2"; AC_TRY_COMPILE([],[return 0;],can_enable_flag=true,can_enable_flag=false) CFLAGS=$saved_CFLAGS; if test "X$can_enable_flag" = "Xtrue"; then AC_MSG_RESULT([yes]) - AS_VAR_SET($2, "$1 $CFLAGS") + AS_VAR_SET($2, "$1 $$2") else AC_MSG_RESULT([no]) - AS_VAR_SET($2, "$CFLAGS") fi ]) diff --git a/lib/megaco/configure.in b/lib/megaco/configure.in index 9c3858f562..643267a154 100644 --- a/lib/megaco/configure.in +++ b/lib/megaco/configure.in @@ -162,6 +162,11 @@ else fi AC_SUBST(OTP_EXTRA_FLAGS) +if test "x$GCC" = xyes; then + # Treat certain GCC warnings as errors + LM_TRY_ENABLE_CFLAG([-Werror=return-type], [CFLAGS]) +fi + dnl dnl If ${ERL_TOP}/make/otp_ded.mk.in exists and contains DED_MK_VSN > 0, dnl every thing releted to compiling Dynamic Erlang Drivers can be found @@ -273,11 +278,6 @@ if test "$PERL" = no_perl; then AC_MSG_ERROR([Perl is required to build the flex scanner!]) fi -if test "x$GCC" = xyes; then - # Treat certain GCC warnings as errors - LM_TRY_ENABLE_CFLAG([-Werror=return-type], [CFLAGS]) -fi - AC_OUTPUT(examples/meas/Makefile:examples/meas/Makefile.in) AC_OUTPUT(src/flex/$host/Makefile:src/flex/Makefile.in) diff --git a/lib/megaco/examples/meas/Makefile.in b/lib/megaco/examples/meas/Makefile.in index c517fd21cf..91e342cd9a 100644 --- a/lib/megaco/examples/meas/Makefile.in +++ b/lib/megaco/examples/meas/Makefile.in @@ -147,12 +147,12 @@ release_docs_spec: # ---------------------------------------------------- meas.sh.skel: meas.sh.skel.src - @echo "transforming $< to $@" - $(PERL) -p -e 's?%VSN%?$(VSN)? ' < $< > $@ + $(V_colon)@echo "transforming $< to $@" + $(vsn_verbose)$(PERL) -p -e 's?%VSN%?$(VSN)? ' < $< > $@ mstone1.sh.skel: mstone1.sh.skel.src - @echo "transforming $< to $@" - $(PERL) -p -e 's?%VSN%?$(VSN)? ' < $< > $@ + $(V_colon)@echo "transforming $< to $@" + $(vsn_verbose)$(PERL) -p -e 's?%VSN%?$(VSN)? ' < $< > $@ megaco_codec_transform.$(EMULATOR): megaco_codec_transform.erl diff --git a/lib/megaco/src/app/Makefile b/lib/megaco/src/app/Makefile index 42030c5b1c..d18da5326a 100644 --- a/lib/megaco/src/app/Makefile +++ b/lib/megaco/src/app/Makefile @@ -94,10 +94,10 @@ info: # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ diff --git a/lib/megaco/src/binary/Makefile b/lib/megaco/src/binary/Makefile index 660713605e..c1fd66b848 100644 --- a/lib/megaco/src/binary/Makefile +++ b/lib/megaco/src/binary/Makefile @@ -129,12 +129,13 @@ opt: prebuild $(TARGET_FILES) prebuild: prebuild.skip prebuild.skip: - @echo "Building prebuild.skip\c" + $(gen_verbose) + $(V_colon)@echo "Building prebuild.skip\c" @touch prebuild.skip @for a in $(SPEC_ASN1DB); do \ echo $$a >> prebuild.skip; \ done - @echo "" + $(V_colon)@echo "" v1: $(V2_SPEC_BINS) diff --git a/lib/megaco/src/binary/depend.mk b/lib/megaco/src/binary/depend.mk index a1318079be..2dce45981f 100644 --- a/lib/megaco/src/binary/depend.mk +++ b/lib/megaco/src/binary/depend.mk @@ -53,8 +53,8 @@ PER_V3_FLAGS = $(ASN1_CT_OPTS) $(BER_ASN1_V1_SPEC).erl: \ $(BER_ASN1_V1_SPEC).set.asn \ $(ASN1_V1_SPEC).asn - @echo "$(BER_ASN1_V1_SPEC):" - $(ERLC) -bber $(BER_V1_FLAGS) $(BER_ASN1_V1_SPEC).set.asn + $(V_colon)@echo "$(BER_ASN1_V1_SPEC):" + $(asn_verbose)$(ERLC) -bber $(BER_V1_FLAGS) $(BER_ASN1_V1_SPEC).set.asn $(EBIN)/$(BER_ASN1_V1_SPEC).$(EMULATOR): \ $(BER_ASN1_V1_SPEC).erl @@ -62,8 +62,8 @@ $(EBIN)/$(BER_ASN1_V1_SPEC).$(EMULATOR): \ $(PER_ASN1_V1_SPEC).erl: \ $(PER_ASN1_V1_SPEC).set.asn \ $(ASN1_V1_SPEC).asn - @echo "$(PER_ASN1_V1_SPEC):" - $(ERLC) -bper $(PER_V1_FLAGS) $(PER_ASN1_V1_SPEC).set.asn + $(V_colon)@echo "$(PER_ASN1_V1_SPEC):" + $(asn_verbose)$(ERLC) -bper $(PER_V1_FLAGS) $(PER_ASN1_V1_SPEC).set.asn $(EBIN)/$(PER_ASN1_V1_SPEC).$(EMULATOR): \ $(PER_ASN1_V1_SPEC).erl @@ -74,8 +74,8 @@ $(EBIN)/$(PER_ASN1_V1_SPEC).$(EMULATOR): \ $(BER_ASN1_V2_SPEC).erl: \ $(BER_ASN1_V2_SPEC).set.asn \ $(ASN1_V2_SPEC).asn - @echo "$(BER_ASN1_V2_SPEC):" - $(ERLC) -bber $(BER_V2_FLAGS) $(BER_ASN1_V2_SPEC).set.asn + $(V_colon)@echo "$(BER_ASN1_V2_SPEC):" + $(asn_verbose)$(ERLC) -bber $(BER_V2_FLAGS) $(BER_ASN1_V2_SPEC).set.asn $(EBIN)/$(BER_ASN1_V2_SPEC).$(EMULATOR): \ $(BER_ASN1_V2_SPEC).erl @@ -83,8 +83,8 @@ $(EBIN)/$(BER_ASN1_V2_SPEC).$(EMULATOR): \ $(PER_ASN1_V2_SPEC).erl: \ $(PER_ASN1_V2_SPEC).set.asn \ $(ASN1_V2_SPEC).asn - @echo "$(PER_ASN1_V2_SPEC):" - $(ERLC) -bper $(PER_V2_FLAGS) $(PER_ASN1_V2_SPEC).set.asn + $(V_colon)@echo "$(PER_ASN1_V2_SPEC):" + $(asn_verbose)$(ERLC) -bper $(PER_V2_FLAGS) $(PER_ASN1_V2_SPEC).set.asn $(EBIN)/$(PER_ASN1_V2_SPEC).$(EMULATOR): \ $(PER_ASN1_V2_SPEC).erl @@ -96,8 +96,8 @@ $(EBIN)/$(PER_ASN1_V2_SPEC).$(EMULATOR): \ $(BER_ASN1_PREV3A_SPEC).erl: \ $(BER_ASN1_PREV3A_SPEC).set.asn \ $(ASN1_PREV3A_SPEC).asn - @echo "$(BER_ASN1_PREV3A_SPEC):" - $(ERLC) -bber $(BER_PREV3A_FLAGS) $(BER_ASN1_PREV3A_SPEC).set.asn + $(V_colon)@echo "$(BER_ASN1_PREV3A_SPEC):" + $(asn_verbose)$(ERLC) -bber $(BER_PREV3A_FLAGS) $(BER_ASN1_PREV3A_SPEC).set.asn $(EBIN)/$(BER_ASN1_PREV3A_SPEC).$(EMULATOR): \ $(BER_ASN1_PREV3A_SPEC).erl @@ -105,8 +105,8 @@ $(EBIN)/$(BER_ASN1_PREV3A_SPEC).$(EMULATOR): \ $(PER_ASN1_PREV3A_SPEC).erl: \ $(PER_ASN1_PREV3A_SPEC).set.asn \ $(ASN1_PREV3A_SPEC).asn - @echo "$(PER_ASN1_PREV3A_SPEC):" - $(ERLC) -bper $(PER_PREV3A_FLAGS) $(PER_ASN1_PREV3A_SPEC).set.asn + $(V_colon)@echo "$(PER_ASN1_PREV3A_SPEC):" + $(asn_verbose)$(ERLC) -bper $(PER_PREV3A_FLAGS) $(PER_ASN1_PREV3A_SPEC).set.asn $(EBIN)/$(PER_ASN1_PREV3A_SPEC).$(EMULATOR): \ $(PER_ASN1_PREV3A_SPEC).erl @@ -117,8 +117,8 @@ $(EBIN)/$(PER_ASN1_PREV3A_SPEC).$(EMULATOR): \ $(BER_ASN1_PREV3B_SPEC).erl: \ $(BER_ASN1_PREV3B_SPEC).set.asn \ $(ASN1_PREV3B_SPEC).asn - @echo "$(BER_ASN1_PREV3B_SPEC):" - $(ERLC) -bber $(BER_PREV3B_FLAGS) $(BER_ASN1_PREV3B_SPEC).set.asn + $(V_colon)@echo "$(BER_ASN1_PREV3B_SPEC):" + $(asn_verbose)$(ERLC) -bber $(BER_PREV3B_FLAGS) $(BER_ASN1_PREV3B_SPEC).set.asn $(EBIN)/$(BER_ASN1_PREV3B_SPEC).$(EMULATOR): \ $(BER_ASN1_PREV3B_SPEC).erl @@ -126,8 +126,8 @@ $(EBIN)/$(BER_ASN1_PREV3B_SPEC).$(EMULATOR): \ $(PER_ASN1_PREV3B_SPEC).erl: \ $(PER_ASN1_PREV3B_SPEC).set.asn \ $(ASN1_PREV3B_SPEC).asn - @echo "$(PER_ASN1_PREV3B_SPEC):" - $(ERLC) -bper $(PER_PREV3B_FLAGS) $(PER_ASN1_PREV3B_SPEC).set.asn + $(V_colon)@echo "$(PER_ASN1_PREV3B_SPEC):" + $(asn_verbose)$(ERLC) -bper $(PER_PREV3B_FLAGS) $(PER_ASN1_PREV3B_SPEC).set.asn $(EBIN)/$(PER_ASN1_PREV3B_SPEC).$(EMULATOR): \ $(PER_ASN1_PREV3B_SPEC).erl @@ -138,8 +138,8 @@ $(EBIN)/$(PER_ASN1_PREV3B_SPEC).$(EMULATOR): \ $(BER_ASN1_PREV3C_SPEC).erl: \ $(BER_ASN1_PREV3C_SPEC).set.asn \ $(ASN1_PREV3C_SPEC).asn - @echo "$(BER_ASN1_PREV3C_SPEC):" - $(ERLC) -bber $(BER_PREV3C_FLAGS) $(BER_ASN1_PREV3C_SPEC).set.asn + $(V_colon)@echo "$(BER_ASN1_PREV3C_SPEC):" + $(asn_verbose)$(ERLC) -bber $(BER_PREV3C_FLAGS) $(BER_ASN1_PREV3C_SPEC).set.asn $(EBIN)/$(BER_ASN1_PREV3C_SPEC).$(EMULATOR): \ $(BER_ASN1_PREV3C_SPEC).erl @@ -147,8 +147,8 @@ $(EBIN)/$(BER_ASN1_PREV3C_SPEC).$(EMULATOR): \ $(PER_ASN1_PREV3C_SPEC).erl: \ $(PER_ASN1_PREV3C_SPEC).set.asn \ $(ASN1_PREV3C_SPEC).asn - @echo "$(PER_ASN1_PREV3C_SPEC):" - $(ERLC) -bper $(PER_PREV3C_FLAGS) $(PER_ASN1_PREV3C_SPEC).set.asn + $(V_colon)@echo "$(PER_ASN1_PREV3C_SPEC):" + $(asn_verbose)$(ERLC) -bper $(PER_PREV3C_FLAGS) $(PER_ASN1_PREV3C_SPEC).set.asn $(EBIN)/$(PER_ASN1_PREV3C_SPEC).$(EMULATOR): \ $(PER_ASN1_PREV3C_SPEC).erl @@ -159,8 +159,8 @@ $(EBIN)/$(PER_ASN1_PREV3C_SPEC).$(EMULATOR): \ $(BER_ASN1_V3_SPEC).erl: \ $(BER_ASN1_V3_SPEC).set.asn \ $(ASN1_V3_SPEC).asn - @echo "$(BER_ASN1_V3_SPEC):" - $(ERLC) -bber $(BER_V3_FLAGS) $(BER_ASN1_V3_SPEC).set.asn + $(V_colon)@echo "$(BER_ASN1_V3_SPEC):" + $(asn_verbose)$(ERLC) -bber $(BER_V3_FLAGS) $(BER_ASN1_V3_SPEC).set.asn $(EBIN)/$(BER_ASN1_V3_SPEC).$(EMULATOR): \ $(BER_ASN1_V3_SPEC).erl @@ -168,8 +168,8 @@ $(EBIN)/$(BER_ASN1_V3_SPEC).$(EMULATOR): \ $(PER_ASN1_V3_SPEC).erl: \ $(PER_ASN1_V3_SPEC).set.asn \ $(ASN1_V3_SPEC).asn - @echo "$(PER_ASN1_V3_SPEC):" - $(ERLC) -bper $(PER_V3_FLAGS) $(PER_ASN1_V3_SPEC).set.asn + $(V_colon)@echo "$(PER_ASN1_V3_SPEC):" + $(asn_verbose)$(ERLC) -bper $(PER_V3_FLAGS) $(PER_ASN1_V3_SPEC).set.asn $(EBIN)/$(PER_ASN1_V3_SPEC).$(EMULATOR): \ $(PER_ASN1_V3_SPEC).erl diff --git a/lib/megaco/src/flex/Makefile.in b/lib/megaco/src/flex/Makefile.in index cb5f5412f4..6111cf2304 100644 --- a/lib/megaco/src/flex/Makefile.in +++ b/lib/megaco/src/flex/Makefile.in @@ -319,16 +319,16 @@ release_docs_spec: $(STD_DRV).flex: megaco_flex_scanner_drv.flex.src ifeq ($(ENABLE_MEGACO_FLEX_SCANNER_LINENO),true) - @printf "std [flex] scanner - lineno enabled\n" - $(PERL) -p -e \ + $(V_colon)@printf "std [flex] scanner - lineno enabled\n" + $(gen_verbose)$(PERL) -p -e \ 's/%FLEX_VERSION%/$(FLEX_VSN)/ ; \ s/%MEGACO_YY_LINENO_OPTION%/%option yylineno/ ; \ s/%MEGACO_YY_REENTRANT_OPTION%/\/\* %option reentrant \*\// ; \ s/%MEGACO_DUMMY_DECL_YY_LINENO%/\/* static int yylineno = 1; *\//' \ < $< > $@ else - @printf "std [flex] scanner - lineno disabled\n" - $(PERL) -p -e \ + $(V_colon)@printf "std [flex] scanner - lineno disabled\n" + $(gen_verbose)$(PERL) -p -e \ 's/%FLEX_VERSION%/$(FLEX_VSN)/ ; \ s/%MEGACO_YY_LINENO_OPTION%/\/\* %option yylineno \*\// ; \ s/%MEGACO_YY_REENTRANT_OPTION%/\/\* %option reentrant \*\// ; \ @@ -339,16 +339,16 @@ endif $(MT_DRV).flex: megaco_flex_scanner_drv.flex.src ifeq ($(ENABLE_MEGACO_FLEX_SCANNER_LINENO),true) ifeq ($(ENABLE_REENTRANT_MEGACO_FLEX_SCANNER),true) - @printf "multi-threaded reentrant [flex] scanner - lineno enabled\n" - $(PERL) -p -e \ + $(V_colon)@printf "multi-threaded reentrant [flex] scanner - lineno enabled\n" + $(gen_verbose)$(PERL) -p -e \ 's/%FLEX_VERSION%/$(FLEX_VSN)/ ; \ s/%MEGACO_YY_LINENO_OPTION%/%option yylineno/ ; \ s/%MEGACO_YY_REENTRANT_OPTION%/%option reentrant/ ; \ s/%MEGACO_DUMMY_DECL_YY_LINENO%/\/* static int yylineno = 1; *\//' \ < $< > $@ else - @printf "multi-threaded non-reentrant [flex] scanner - lineno enabled\n" - $(PERL) -p -e \ + $(V_colon)@printf "multi-threaded non-reentrant [flex] scanner - lineno enabled\n" + $(gen_verbose)$(PERL) -p -e \ 's/%FLEX_VERSION%/$(FLEX_VSN)/ ; \ s/%MEGACO_YY_LINENO_OPTION%/%option yylineno/ ; \ s/%MEGACO_YY_REENTRANT_OPTION%/\/\* %option reentrant \*\// ; \ @@ -357,16 +357,16 @@ else endif else ifeq ($(ENABLE_REENTRANT_MEGACO_FLEX_SCANNER),true) - @printf "multi-threaded reentrant [flex] scanner - lineno disabled\n" - $(PERL) -p -e \ + $(V_colon)@printf "multi-threaded reentrant [flex] scanner - lineno disabled\n" + $(gen_verbose)$(PERL) -p -e \ 's/%FLEX_VERSION%/$(FLEX_VSN)/ ; \ s/%MEGACO_YY_LINENO_OPTION%/\/\* %option yylineno \*\// ; \ s/%MEGACO_YY_REENTRANT_OPTION%/%option reentrant/ ; \ s/%MEGACO_DUMMY_DECL_YY_LINENO%/\/* static int yylineno = 1; - REENTRANT SCANNER*\//' \ < $< > $@ else - @printf "multi-threaded non-reentrant [flex] scanner - lineno disabled\n" - $(PERL) -p -e \ + $(V_colon)@printf "multi-threaded non-reentrant [flex] scanner - lineno disabled\n" + $(gen_verbose)$(PERL) -p -e \ 's/%FLEX_VERSION%/$(FLEX_VSN)/ ; \ s/%MEGACO_YY_LINENO_OPTION%/\/\* %option yylineno \*\// ; \ s/%MEGACO_YY_REENTRANT_OPTION%/\/\* %option reentrant \*\// ; \ @@ -376,31 +376,31 @@ endif endif # megaco_flex_scanner_drv.c: megaco_flex_scanner_drv.flex -# $(LEX) $(LEX_FLAGS) -P$* -o$@ $< +# $(V_LEX) $(LEX_FLAGS) -P$* -o$@ $< $(STD_DRV).c: $(STD_DRV).flex - $(LEX) $(STD_LEX_FLAGS) -P$* -o$@ $< + $(V_LEX) $(STD_LEX_FLAGS) -P$* -o$@ $< $(MT_DRV).c: $(MT_DRV).flex - $(LEX) $(MT_LEX_FLAGS) -P$* -o$@ $< + $(V_LEX) $(MT_LEX_FLAGS) -P$* -o$@ $< _create_dirs := $(shell mkdir -p $(OBJDIR) $(LIBDIR)) solibs: $(SOLIBS) $(OBJDIR)/$(STD_DRV).o: $(STD_DRV).c - @echo "compiling std driver:" - $(CC) -c $(STD_DRV_NAME) $(CFLAGS) -o $@ $< + $(V_colon)@echo "compiling std driver:" + $(V_CC) -c $(STD_DRV_NAME) $(CFLAGS) -o $@ $< $(OBJDIR)/$(MT_DRV).o: $(MT_DRV).c - @echo "compiling multi-threaded driver:" - $(CC) -c $(MT_DRV_NAME) $(CFLAGS_MT) -o $@ $< + $(V_colon)@echo "compiling multi-threaded driver:" + $(V_CC) -c $(MT_DRV_NAME) $(CFLAGS_MT) -o $@ $< # No need to link with -lfl as we have also defined %option noyywrap - # and having -lfl doesn't work under Darwin for some reason. - Sean $(LIBDIR)/$(STD_DRV).$(DED_EXT): $(OBJDIR)/$(STD_DRV).o - @echo "linking std driver:" - $(LD) $(LDFLAGS) -o $@ $< + $(V_colon)@echo "linking std driver:" + $(V_LD) $(LDFLAGS) -o $@ $< $(LIBDIR)/$(MT_DRV).$(DED_EXT): $(OBJDIR)/$(MT_DRV).o - @echo "linking multi-threaded driver:" - $(LD) $(LDFLAGS) -o $@ $< + $(V_colon)@echo "linking multi-threaded driver:" + $(V_LD) $(LDFLAGS) -o $@ $< diff --git a/lib/mnesia/src/Makefile b/lib/mnesia/src/Makefile index 6f289433ff..53d327c11b 100644 --- a/lib/mnesia/src/Makefile +++ b/lib/mnesia/src/Makefile @@ -120,10 +120,10 @@ $(TARGET_FILES): $(HRL_FILES) # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- diff --git a/lib/observer/src/Makefile b/lib/observer/src/Makefile index 7135a6abd5..877286033e 100644 --- a/lib/observer/src/Makefile +++ b/lib/observer/src/Makefile @@ -114,10 +114,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(TARGET_FILES): $(INTERNAL_HRL_FILES) diff --git a/lib/odbc/aclocal.m4 b/lib/odbc/aclocal.m4 index 5d555a5123..918e30a886 100644 --- a/lib/odbc/aclocal.m4 +++ b/lib/odbc/aclocal.m4 @@ -1861,17 +1861,16 @@ dnl Usage example LM_TRY_ENABLE_CFLAG([-Werror=return-type], [CFLAGS]) dnl dnl AC_DEFUN([LM_TRY_ENABLE_CFLAG], [ - AC_MSG_CHECKING([if we can add $1 to CFLAGS]) + AC_MSG_CHECKING([if we can add $1 to $2 (via CFLAGS)]) saved_CFLAGS=$CFLAGS; - CFLAGS="$1 $CFLAGS"; + CFLAGS="$1 $$2"; AC_TRY_COMPILE([],[return 0;],can_enable_flag=true,can_enable_flag=false) CFLAGS=$saved_CFLAGS; if test "X$can_enable_flag" = "Xtrue"; then AC_MSG_RESULT([yes]) - AS_VAR_SET($2, "$1 $CFLAGS") + AS_VAR_SET($2, "$1 $$2") else AC_MSG_RESULT([no]) - AS_VAR_SET($2, "$CFLAGS") fi ]) diff --git a/lib/odbc/c_src/Makefile.in b/lib/odbc/c_src/Makefile.in index 026da39e6f..6572d28ee8 100644 --- a/lib/odbc/c_src/Makefile.in +++ b/lib/odbc/c_src/Makefile.in @@ -108,17 +108,17 @@ docs: ifdef UNIX_TARGET $(UNIX_TARGET): $(OBJ_DIR)/odbcserver.o - $(CC) $(CFLAGS) -o $@ $(OBJ_DIR)/odbcserver.o $(LDFLAGS) $(LIBS) + $(V_CC) $(CFLAGS) -o $@ $(OBJ_DIR)/odbcserver.o $(LDFLAGS) $(LIBS) endif ifdef WIN32_TARGET $(WIN32_TARGET): $(OBJ_DIR)/odbcserver.o - $(LD) $(LDFLAGS) -o $@ $(OBJ_DIR)/odbcserver.o $(ENTRY_OBJ) \ + $(V_LD) $(LDFLAGS) -o $@ $(OBJ_DIR)/odbcserver.o $(ENTRY_OBJ) \ $(LIBS) $(ENTRY_LDFLAGS) endif $(OBJ_DIR)/odbcserver.o: odbcserver.c - $(CC) $(CFLAGS) $(INCLUDES) $(TARGET_FLAGS) -o $@ -c odbcserver.c + $(V_CC) $(CFLAGS) $(INCLUDES) $(TARGET_FLAGS) -o $@ -c odbcserver.c # ---------------------------------------------------- # Release Target diff --git a/lib/odbc/src/Makefile b/lib/odbc/src/Makefile index 2af65cc757..bfbda8aaf4 100644 --- a/lib/odbc/src/Makefile +++ b/lib/odbc/src/Makefile @@ -95,9 +95,9 @@ clean: $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ docs: diff --git a/lib/orber/COSS/CosNaming/Makefile b/lib/orber/COSS/CosNaming/Makefile index 769c08a9e9..814062034c 100644 --- a/lib/orber/COSS/CosNaming/Makefile +++ b/lib/orber/COSS/CosNaming/Makefile @@ -117,7 +117,7 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) - sed -e 's;%VSN%;$(VSN);' $(APP_SRC) > $(APP_TARGET) + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $(APP_SRC) > $(APP_TARGET) docs: @@ -125,10 +125,10 @@ docs: # Special Build Targets # ---------------------------------------------------- IDL-GENERATED: cos_naming_ext.idl cos_naming.idl - erlc $(ERL_IDL_FLAGS) +'{this,"CosNaming::NamingContext"}' \ + $(gen_verbose)erlc $(ERL_IDL_FLAGS) +'{this,"CosNaming::NamingContext"}' \ +'{this,"CosNaming::NamingContextExt"}' cos_naming_ext.idl - erlc $(ERL_IDL_FLAGS) +'{this,"CosNaming::NamingContext"}' cos_naming.idl - >IDL-GENERATED + $(V_at)erlc $(ERL_IDL_FLAGS) +'{this,"CosNaming::NamingContext"}' cos_naming.idl + $(V_at)>IDL-GENERATED $(GEN_FILES): IDL-GENERATED diff --git a/lib/orber/c_src/Makefile.in b/lib/orber/c_src/Makefile.in index 9970642a9f..126ed8af21 100644 --- a/lib/orber/c_src/Makefile.in +++ b/lib/orber/c_src/Makefile.in @@ -56,10 +56,10 @@ debug opt: $(OBJDIR) orber ifeq ($(findstring win32,$(TARGET)),win32) orber: - echo "Nothing to build on NT" + $(V_colon)echo "Nothing to build on NT" else orber: - echo "Nothing to build" + $(V_colon)echo "Nothing to build" endif clean: @@ -74,7 +74,7 @@ $(OBJDIR): -mkdir -p $(OBJDIR) $(OBJDIR)/%.o: %.c - $(CC) -c -o $@ $(ALL_CFLAGS) $< + $(V_CC) -c -o $@ $(ALL_CFLAGS) $< # ---------------------------------------------------- # Release Target diff --git a/lib/orber/examples/Stack/Makefile b/lib/orber/examples/Stack/Makefile index f1a5106a7b..1cbb983cd6 100644 --- a/lib/orber/examples/Stack/Makefile +++ b/lib/orber/examples/Stack/Makefile @@ -104,8 +104,8 @@ docs: test: $(TEST_TARGET_FILES) IDL-GENERATED: stack.idl - erlc $(ERL_IDL_FLAGS) stack.idl - >IDL-GENERATED + $(gen_verbose)erlc $(ERL_IDL_FLAGS) stack.idl + $(V_at)>IDL-GENERATED $(GEN_FILES): IDL-GENERATED diff --git a/lib/orber/src/Makefile b/lib/orber/src/Makefile index 6eb659407d..1c6781e5fd 100644 --- a/lib/orber/src/Makefile +++ b/lib/orber/src/Makefile @@ -215,10 +215,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(ORBER_VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(ORBER_VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(ORBER_VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(ORBER_VSN);' $< > $@ docs: @@ -227,17 +227,17 @@ docs: # ---------------------------------------------------- IDL-GENERATED: $(ERL_TOP)/lib/ic/include/erlang.idl CORBA.idl OrberIFR.idl - erlc $(ERL_IDL_FLAGS) $(ERL_TOP)/lib/ic/include/erlang.idl - erlc $(ERL_IDL_FLAGS) CORBA.idl - erlc $(ERL_IDL_FLAGS) +'{this,"Orber::IFR"}' OrberIFR.idl - >IDL-GENERATED + $(gen_verbose)erlc $(ERL_IDL_FLAGS) $(ERL_TOP)/lib/ic/include/erlang.idl + $(V_at)erlc $(ERL_IDL_FLAGS) CORBA.idl + $(V_at)erlc $(ERL_IDL_FLAGS) +'{this,"Orber::IFR"}' OrberIFR.idl + $(V_at)>IDL-GENERATED $(GEN_ERL_FILES): IDL-GENERATED $(TARGET_FILES): IDL-GENERATED $(GEN_ASN_ERL) $(GEN_ASN_HRL): OrberCSIv2.asn1 OrberCSIv2.set.asn - erlc $(ERL_COMPILE_FLAGS) $(ASN_FLAGS) +'{inline,"OrberCSIv2"}' OrberCSIv2.set.asn - rm -f $(GEN_ASN_ERL:%.erl=%.beam) + $(asn_verbose)erlc $(ERL_COMPILE_FLAGS) $(ASN_FLAGS) +'{inline,"OrberCSIv2"}' OrberCSIv2.set.asn + $(V_at)rm -f $(GEN_ASN_ERL:%.erl=%.beam) # erlc $(ERL_COMPILE_FLAGS) $(ASN_FLAGS) OrberCSIv2.asn1 ;\ # erlc $(GEN_ASN_ERL) diff --git a/lib/os_mon/c_src/Makefile.in b/lib/os_mon/c_src/Makefile.in index e728e43a09..51569f6ec9 100644 --- a/lib/os_mon/c_src/Makefile.in +++ b/lib/os_mon/c_src/Makefile.in @@ -93,28 +93,28 @@ docs: # ---------------------------------------------------- $(BINDIR)/win32sysinfo.exe: $(OBJDIR)/win32sysinfo.o $(ENTRY_OBJ) - $(LD) $(LDFLAGS) $(ENTRY_LDFLAGS) -o $@ $(OBJDIR)/win32sysinfo.o $(ENTRY_OBJ) + $(V_LD) $(LDFLAGS) $(ENTRY_LDFLAGS) -o $@ $(OBJDIR)/win32sysinfo.o $(ENTRY_OBJ) $(BINDIR)/nteventlog.exe: $(EVLOG_OBJECTS) - $(LD) $(LDFLAGS) $(ENTRY_LDFLAGS) -o $@ $(EVLOG_OBJECTS) $(ENTRY_OBJ) + $(V_LD) $(LDFLAGS) $(ENTRY_LDFLAGS) -o $@ $(EVLOG_OBJECTS) $(ENTRY_OBJ) $(BINDIR)/ferrule: $(OBJDIR)/ferrule.o - $(LD) $(LDFLAGS) -o $@ $< + $(V_LD) $(LDFLAGS) -o $@ $< $(BINDIR)/mod_syslog: $(OBJDIR)/mod_syslog.o - $(LD) $(LDFLAGS) -o $@ $< + $(V_LD) $(LDFLAGS) -o $@ $< $(BINDIR)/memsup: $(OBJDIR)/memsup.o - $(LD) $(LDFLAGS) -o $@ $< + $(V_LD) $(LDFLAGS) -o $@ $< $(BINDIR)/cpu_sup: $(OBJDIR)/cpu_sup.o - $(LD) $(LDFLAGS) -o $@ $< $(CPU_SUP_LIBS) + $(V_LD) $(LDFLAGS) -o $@ $< $(CPU_SUP_LIBS) $(OBJDIR)/%.o: %.c - $(CC) -c -o $@ $(ALL_CFLAGS) $< + $(V_CC) -c -o $@ $(ALL_CFLAGS) $< $(OBJDIR)/%.o: nteventlog/%.c - $(CC) -c -o $@ $(ALL_CFLAGS) $< + $(V_CC) -c -o $@ $(ALL_CFLAGS) $< $(OBJDIR)/memsup.o: memsup.h diff --git a/lib/os_mon/mibs/Makefile b/lib/os_mon/mibs/Makefile index 3e24c3d373..19f3dc8367 100644 --- a/lib/os_mon/mibs/Makefile +++ b/lib/os_mon/mibs/Makefile @@ -67,16 +67,16 @@ OTP_MIBDIR = $(shell if test -d ../../otp_mibs; then echo otp_mibs; \ else echo sasl; fi) $(SNMP_BIN_TARGET_DIR)/OTP-REG.bin: $(ERL_TOP)/lib/$(OTP_MIBDIR)/mibs/OTP-REG.mib - $(ERLC) -pa $(SNMP_TOOLKIT)/ebin -I $(SNMP_TOOLKIT)/priv/mibs $(SNMP_FLAGS) -o $(SNMP_BIN_TARGET_DIR) $< + $(snmp_verbose)$(ERLC) -pa $(SNMP_TOOLKIT)/ebin -I $(SNMP_TOOLKIT)/priv/mibs $(SNMP_FLAGS) -o $(SNMP_BIN_TARGET_DIR) $< $(SNMP_BIN_TARGET_DIR)/OTP-TC.bin: $(ERL_TOP)/lib/$(OTP_MIBDIR)/mibs/OTP-TC.mib - $(ERLC) -pa $(SNMP_TOOLKIT)/ebin -I $(SNMP_TOOLKIT)/priv/mibs $(SNMP_FLAGS) -o $(SNMP_BIN_TARGET_DIR) $< + $(snmp_verbose)$(ERLC) -pa $(SNMP_TOOLKIT)/ebin -I $(SNMP_TOOLKIT)/priv/mibs $(SNMP_FLAGS) -o $(SNMP_BIN_TARGET_DIR) $< $(SNMP_BIN_TARGET_DIR)/OTP-MIB.bin: $(ERL_TOP)/lib/$(OTP_MIBDIR)/mibs/OTP-MIB.mib - $(ERLC) -pa $(SNMP_TOOLKIT)/ebin -I $(SNMP_TOOLKIT)/priv/mibs $(SNMP_FLAGS) -o $(SNMP_BIN_TARGET_DIR) $< + $(snmp_verbose)$(ERLC) -pa $(SNMP_TOOLKIT)/ebin -I $(SNMP_TOOLKIT)/priv/mibs $(SNMP_FLAGS) -o $(SNMP_BIN_TARGET_DIR) $< v1/%.mib.v1: %.mib - $(ERL_TOP)/lib/snmp/bin/snmp-v2tov1 -o $@ $< + $(gen_verbose)$(ERL_TOP)/lib/snmp/bin/snmp-v2tov1 -o $@ $< $(SNMP_BIN_TARGET_DIR)/OTP-OS-MON-MIB.bin: \ $(SNMP_BIN_TARGET_DIR)/OTP-REG.bin \ diff --git a/lib/os_mon/src/Makefile b/lib/os_mon/src/Makefile index 864d7a09d4..9fc888e552 100644 --- a/lib/os_mon/src/Makefile +++ b/lib/os_mon/src/Makefile @@ -78,10 +78,10 @@ docs: # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ #------------------------------------------------------- # Special dependencies diff --git a/lib/otp_mibs/mibs/Makefile b/lib/otp_mibs/mibs/Makefile index 703c4b3ed4..7f43ef31a6 100644 --- a/lib/otp_mibs/mibs/Makefile +++ b/lib/otp_mibs/mibs/Makefile @@ -68,7 +68,7 @@ docs: # ---------------------------------------------------- v1/%.mib.v1: %.mib - $(ERL_TOP)/lib/snmp/bin/snmp-v2tov1 -o $@ $< + $(gen_verbose)$(ERL_TOP)/lib/snmp/bin/snmp-v2tov1 -o $@ $< # ---------------------------------------------------- # Release Target diff --git a/lib/otp_mibs/src/Makefile b/lib/otp_mibs/src/Makefile index 03298d39d5..4f03d0228a 100644 --- a/lib/otp_mibs/src/Makefile +++ b/lib/otp_mibs/src/Makefile @@ -84,10 +84,10 @@ docs: # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Release Target diff --git a/lib/parsetools/src/Makefile b/lib/parsetools/src/Makefile index 4f199da8ee..7b63475231 100644 --- a/lib/parsetools/src/Makefile +++ b/lib/parsetools/src/Makefile @@ -78,10 +78,10 @@ docs: # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Release Target diff --git a/lib/percept/src/Makefile b/lib/percept/src/Makefile index 253a8c2da3..6bf0af9dc6 100644 --- a/lib/percept/src/Makefile +++ b/lib/percept/src/Makefile @@ -80,10 +80,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ docs: diff --git a/lib/pman/src/Makefile b/lib/pman/src/Makefile index fa01fe7238..eb0413bdbc 100644 --- a/lib/pman/src/Makefile +++ b/lib/pman/src/Makefile @@ -85,10 +85,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ docs: diff --git a/lib/public_key/asn1/Makefile b/lib/public_key/asn1/Makefile index 763b788e53..f765906b3b 100644 --- a/lib/public_key/asn1/Makefile +++ b/lib/public_key/asn1/Makefile @@ -81,10 +81,10 @@ clean: docs: %.erl %.hrl: %.set.asn - erlc $(ASN_FLAGS) $< + $(asn_verbose)erlc $(ASN_FLAGS) $< $(INCLUDE)/%.hrl: %.hrl - cp -p $< $@ + $(gen_verbose)cp -p $< $@ # ---------------------------------------------------- # Release Target @@ -119,6 +119,6 @@ OTP-PUB-KEY.asn1db: PKIX1Algorithms88.asn1 \ OTP-PKIX.asn1 $(EBIN)/PKCS-FRAME.beam: PKCS-FRAME.erl PKCS-FRAME.hrl -PKCS-FRAME.erl PKCS-FRAME.hrl: PKCS-FRAME.asn1db +PKCS-FRAME.erl PKCS-FRAME.hrl: PKCS-FRAME.asn1db PKCS-FRAME.asn1db: PKCS5v2-0.asn1\ PKCS-8.asn1\ diff --git a/lib/public_key/src/Makefile b/lib/public_key/src/Makefile index d24122221a..b8ad68ecc7 100644 --- a/lib/public_key/src/Makefile +++ b/lib/public_key/src/Makefile @@ -92,10 +92,10 @@ clean: docs: $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Release Target diff --git a/lib/reltool/src/Makefile b/lib/reltool/src/Makefile index a7e34053f1..74918f1d67 100644 --- a/lib/reltool/src/Makefile +++ b/lib/reltool/src/Makefile @@ -79,10 +79,10 @@ docs: # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Dependencies diff --git a/lib/runtime_tools/c_src/Makefile.in b/lib/runtime_tools/c_src/Makefile.in index 586f649924..d315a90e18 100644 --- a/lib/runtime_tools/c_src/Makefile.in +++ b/lib/runtime_tools/c_src/Makefile.in @@ -111,11 +111,11 @@ debug opt valgrind: $(SOLIBS) $(OBJDIR) $(LIBDIR) $(NIF_LIB) ifdef DTRACE_ENABLED DTRACE_USER_HEADER=$(OBJDIR)/dtrace_user.h $(OBJDIR)/dtrace_user.h: ./dtrace_user.d - dtrace -h -C $(INCLUDES) \ + $(dtrace_verbose)dtrace -h -C $(INCLUDES) \ -s ./dtrace_user.d \ -o ./dtrace_user.tmp - sed -e '/^#define[ ]*ERLANG_[A-Z0-9_]*(.*)/y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/' ./dtrace_user.tmp > $@ - rm ./dtrace_user.tmp + $(V_at)sed -e '/^#define[ ]*ERLANG_[A-Z0-9_]*(.*)/y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/' ./dtrace_user.tmp > $@ + $(V_at)rm ./dtrace_user.tmp else DTRACE_USER_HEADER= endif @@ -124,7 +124,7 @@ DTRACE_OBJS = ifdef DTRACE_ENABLED_2STEP DTRACE_OBJS += $(OBJDIR)/dtrace_user.o $(OBJDIR)/dtrace_user.o: $(before_DTrace_OBJS) $(OBJDIR)/dtrace_user.h - dtrace -G -C \ + $(dtrace_verbose)dtrace -G -C \ -s ./dtrace_user.d \ -o $@ $(before_DTrace_OBJS) endif @@ -138,26 +138,26 @@ $(LIBDIR): -@mkdir -p $(LIBDIR) $(OBJDIR)/dyntrace$(TYPEMARKER).o: dyntrace.c $(DTRACE_USER_HEADER) - $(INSTALL_DIR) $(OBJDIR) - $(CC) -c -o $@ $(ALL_CFLAGS) $< + $(V_at)$(INSTALL_DIR) $(OBJDIR) + $(V_CC) -c -o $@ $(ALL_CFLAGS) $< $(NIF_LIB): $(DYNTRACE_OBJS) - $(INSTALL_DIR) $(LIBDIR) - $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS) + $(V_at)$(INSTALL_DIR) $(LIBDIR) + $(V_LD) $(LDFLAGS) -o $@ $^ $(LDLIBS) $(OBJDIR)/%.o: %.c - $(CC) -c -o $@ $(ALL_CFLAGS) $< + $(V_CC) -c -o $@ $(ALL_CFLAGS) $< $(LIBDIR)/trace_ip_drv.so: $(TRACE_IP_DRV_OBJS) - $(LD) $(LDFLAGS) -o $@ $^ -lc $(LIBS) + $(V_LD) $(LDFLAGS) -o $@ $^ -lc $(LIBS) $(LIBDIR)/trace_file_drv.so: $(TRACE_FILE_DRV_OBJS) - $(LD) $(LDFLAGS) -o $@ $^ -lc $(LIBS) + $(V_LD) $(LDFLAGS) -o $@ $^ -lc $(LIBS) $(LIBDIR)/trace_ip_drv.dll: $(TRACE_IP_DRV_OBJS) - $(LD) $(LDFLAGS) -o $@ $^ $(LIBS) + $(V_LD) $(LDFLAGS) -o $@ $^ $(LIBS) $(LIBDIR)/trace_file_drv.dll: $(TRACE_FILE_DRV_OBJS) - $(LD) $(LDFLAGS) -o $@ $^ $(LIBS) + $(V_LD) $(LDFLAGS) -o $@ $^ $(LIBS) clean: rm -f $(SOLIBS) $(TRACE_IP_DRV_OBJS) $(TRACE_FILE_DRV_OBJS) diff --git a/lib/runtime_tools/src/Makefile b/lib/runtime_tools/src/Makefile index 4ca37ab0bf..53b9ce34e4 100644 --- a/lib/runtime_tools/src/Makefile +++ b/lib/runtime_tools/src/Makefile @@ -81,10 +81,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ docs: diff --git a/lib/sasl/src/Makefile b/lib/sasl/src/Makefile index de0c45e6ae..c1ad8ca0bb 100644 --- a/lib/sasl/src/Makefile +++ b/lib/sasl/src/Makefile @@ -80,10 +80,10 @@ docs: # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Release Target diff --git a/lib/snmp/doc/src/Makefile b/lib/snmp/doc/src/Makefile index 8820565124..6e55498669 100644 --- a/lib/snmp/doc/src/Makefile +++ b/lib/snmp/doc/src/Makefile @@ -118,7 +118,7 @@ clean clean_docs: clean_html clean_man clean_pdf rm -f errs core *~ $(INDEX_TARGET): $(INDEX_SRC) ../../vsn.mk # Create top make file - sed -e 's;%VSN%;$(VSN);' $< > $@ # inserting version number + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # inserting version number man: man1 man3 man6 man7 diff --git a/lib/snmp/mibs/Makefile.in b/lib/snmp/mibs/Makefile.in index 5c1f855fad..e7ca540cc6 100644 --- a/lib/snmp/mibs/Makefile.in +++ b/lib/snmp/mibs/Makefile.in @@ -141,11 +141,11 @@ OTP_MIBDIR = $(shell if test -d ../../otp_mibs; then echo otp_mibs; \ debug opt: $(TARGET_FILES) $(ERL_TOP)/lib/snmp/bin/snmp-v2tov1: $(ERL_TOP)/lib/snmp/bin/snmp-v2tov1.src - $(PERL) -p -e 's?%PERL%?$(PERL)? ' < $< > $@ - chmod 755 $@ + $(gen_verbose)$(PERL) -p -e 's?%PERL%?$(PERL)? ' < $< > $@ + $(V_at)chmod 755 $@ $(SNMP_BIN_TARGET_DIR)/OTP-REG.bin: $(ERL_TOP)/lib/$(OTP_MIBDIR)/mibs/OTP-REG.mib - $(ERLC) -pa $(SNMP_TOOLKIT)/ebin -I $(SNMP_TOOLKIT)/priv/mibs $(SNMP_FLAGS) -o $(SNMP_BIN_TARGET_DIR) $< + $(snmp_verbose)$(ERLC) -pa $(SNMP_TOOLKIT)/ebin -I $(SNMP_TOOLKIT)/priv/mibs $(SNMP_FLAGS) -o $(SNMP_BIN_TARGET_DIR) $< # To support parallel make, we'll need explicit dependencies # to ensure that an imported MIB has been compiled when it's needed. @@ -214,7 +214,7 @@ info: @echo "RELSYSDIR = "$(RELSYSDIR)"" v1/%.mib.v1: %.mib $(ERL_TOP)/lib/snmp/bin/snmp-v2tov1 - $(ERL_TOP)/lib/snmp/bin/snmp-v2tov1 -o $@ $< + $(gen_verbose)$(ERL_TOP)/lib/snmp/bin/snmp-v2tov1 -o $@ $< # ---------------------------------------------------- diff --git a/lib/snmp/src/app/Makefile b/lib/snmp/src/app/Makefile index f7c311b663..716add8b9e 100644 --- a/lib/snmp/src/app/Makefile +++ b/lib/snmp/src/app/Makefile @@ -116,10 +116,10 @@ info: # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Release Target diff --git a/lib/snmp/src/compile/depend.mk b/lib/snmp/src/compile/depend.mk index 3ee8dc4bec..e6ba1ac810 100644 --- a/lib/snmp/src/compile/depend.mk +++ b/lib/snmp/src/compile/depend.mk @@ -45,5 +45,5 @@ $(EBIN)/snmpc_mib_gram.$(EMULATOR): \ snmpc_mib_gram.erl $(BIN)/snmpc: snmpc.src ../../vsn.mk - $(PERL) -p -e 's?%VSN%?$(VSN)? ' < $< > $@ - chmod 755 $@ + $(vsn_verbose)$(PERL) -p -e 's?%VSN%?$(VSN)? ' < $< > $@ + $(V_at)chmod 755 $@ diff --git a/lib/ssh/src/Makefile b/lib/ssh/src/Makefile index 323f0af191..27e43a88ed 100644 --- a/lib/ssh/src/Makefile +++ b/lib/ssh/src/Makefile @@ -120,10 +120,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ docs: diff --git a/lib/ssh/src/ssh.erl b/lib/ssh/src/ssh.erl index 3ef26b1678..b5a0aa2e05 100644 --- a/lib/ssh/src/ssh.erl +++ b/lib/ssh/src/ssh.erl @@ -278,7 +278,9 @@ do_start_daemon(Host, Port, Options, SocketOptions) -> {ok, SysSup} -> {ok, SysSup}; {error, {already_started, _}} -> - {error, eaddrinuse} + {error, eaddrinuse}; + {error, R} -> + {error, R} catch exit:{noproc, _} -> {error, ssh_not_started} diff --git a/lib/ssl/src/Makefile b/lib/ssl/src/Makefile index 6be8a1456e..043645be41 100644 --- a/lib/ssl/src/Makefile +++ b/lib/ssl/src/Makefile @@ -108,10 +108,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ docs: diff --git a/lib/ssl/src/ssl_connection.erl b/lib/ssl/src/ssl_connection.erl index cde13069b5..94f76e0606 100644 --- a/lib/ssl/src/ssl_connection.erl +++ b/lib/ssl/src/ssl_connection.erl @@ -1628,78 +1628,49 @@ save_verify_data(client, #finished{verify_data = Data}, ConnectionStates, abbrev save_verify_data(server, #finished{verify_data = Data}, ConnectionStates, abbreviated) -> ssl_record:set_server_verify_data(current_write, Data, ConnectionStates). -handle_server_key(#server_key_exchange{params = - #server_dh_params{dh_p = P, - dh_g = G, - dh_y = ServerPublicDhKey}, - signed_params = <<>>}, - #state{key_algorithm = dh_anon} = State) -> - dh_master_secret(P, G, ServerPublicDhKey, undefined, State); - -handle_server_key( - #server_key_exchange{params = - #server_dh_params{dh_p = P, - dh_g = G, - dh_y = ServerPublicDhKey}, - signed_params = Signed, - hashsign = HashSign}, - #state{negotiated_version = Version, - public_key_info = PubKeyInfo, - connection_states = ConnectionStates} = State) -> - - PLen = size(P), - GLen = size(G), - YLen = size(ServerPublicDhKey), - HashAlgo = connection_hash_algo(HashSign, State), +handle_server_key(#server_key_exchange{exchange_keys = Keys}, + #state{key_algorithm = KeyAlg, + negotiated_version = Version} = State) -> + Params = ssl_handshake:decode_server_key(Keys, KeyAlg, Version), + HashSign = connection_hashsign(Params#server_key_params.hashsign, State), + case HashSign of + {_, anon} -> + server_master_secret(Params#server_key_params.params, State); + _ -> + verify_server_key(Params, HashSign, State) + end. - ConnectionState = +verify_server_key(#server_key_params{params = Params, + params_bin = EncParams, + signature = Signature}, + HashSign = {HashAlgo, _}, + #state{negotiated_version = Version, + public_key_info = PubKeyInfo, + connection_states = ConnectionStates} = State) -> + ConnectionState = ssl_record:pending_connection_state(ConnectionStates, read), SecParams = ConnectionState#connection_state.security_parameters, #security_parameters{client_random = ClientRandom, server_random = ServerRandom} = SecParams, Hash = ssl_handshake:server_key_exchange_hash(HashAlgo, - <<ClientRandom/binary, - ServerRandom/binary, - ?UINT16(PLen), P/binary, - ?UINT16(GLen), G/binary, - ?UINT16(YLen), - ServerPublicDhKey/binary>>), - - case verify_dh_params(Version, Signed, Hash, HashAlgo, PubKeyInfo) of + <<ClientRandom/binary, + ServerRandom/binary, + EncParams/binary>>), + case ssl_handshake:verify_signature(Version, Hash, HashSign, Signature, PubKeyInfo) of true -> - dh_master_secret(P, G, ServerPublicDhKey, undefined, State); + server_master_secret(Params, State); false -> ?ALERT_REC(?FATAL, ?DECRYPT_ERROR) end. -verify_dh_params({3, Minor}, Signed, Hashes, HashAlgo, {?rsaEncryption, PubKey, _PubKeyParams}) - when Minor >= 3 -> - public_key:verify({digest, Hashes}, HashAlgo, Signed, PubKey); -verify_dh_params(_Version, Signed, Hashes, _HashAlgo, {?rsaEncryption, PubKey, _PubKeyParams}) -> - case public_key:decrypt_public(Signed, PubKey, - [{rsa_pad, rsa_pkcs1_padding}]) of - Hashes -> - true; - _ -> - false - end; -verify_dh_params(_Version, Signed, Hash, HashAlgo, {?'id-dsa', PublicKey, PublicKeyParams}) -> - public_key:verify({digest, Hash}, HashAlgo, Signed, {PublicKey, PublicKeyParams}). - -dh_master_secret(Prime, Base, PublicDhKey, undefined, State) -> - PMpint = mpint_binary(Prime), - GMpint = mpint_binary(Base), - Keys = {_, PrivateDhKey} = - crypto:dh_generate_key([PMpint,GMpint]), - dh_master_secret(PMpint, GMpint, PublicDhKey, PrivateDhKey, State#state{diffie_hellman_keys = Keys}); +server_master_secret(#server_dh_params{dh_p = P, dh_g = G, dh_y = ServerPublicDhKey}, + State) -> + dh_master_secret(P, G, ServerPublicDhKey, undefined, State). -dh_master_secret(PMpint, GMpint, PublicDhKey, PrivateDhKey, - #state{session = Session, - negotiated_version = Version, role = Role, - connection_states = ConnectionStates0} = State) -> - PremasterSecret = - crypto:dh_compute_key(mpint_binary(PublicDhKey), PrivateDhKey, - [PMpint, GMpint]), +master_from_premaster_secret(PremasterSecret, + #state{session = Session, + negotiated_version = Version, role = Role, + connection_states = ConnectionStates0} = State) -> case ssl_handshake:master_secret(Version, PremasterSecret, ConnectionStates0, Role) of {MasterSecret, ConnectionStates} -> @@ -1711,6 +1682,19 @@ dh_master_secret(PMpint, GMpint, PublicDhKey, PrivateDhKey, Alert end. +dh_master_secret(Prime, Base, PublicDhKey, undefined, State) -> + PMpint = mpint_binary(Prime), + GMpint = mpint_binary(Base), + Keys = {_, PrivateDhKey} = + crypto:dh_generate_key([PMpint,GMpint]), + dh_master_secret(PMpint, GMpint, PublicDhKey, PrivateDhKey, State#state{diffie_hellman_keys = Keys}); + +dh_master_secret(PMpint, GMpint, PublicDhKey, PrivateDhKey, State) -> + PremasterSecret = + crypto:dh_compute_key(mpint_binary(PublicDhKey), PrivateDhKey, + [PMpint, GMpint]), + master_from_premaster_secret(PremasterSecret, State). + cipher_role(client, Data, Session, #state{connection_states = ConnectionStates0} = State) -> ConnectionStates = ssl_record:set_server_verify_data(current_both, Data, ConnectionStates0), next_state_connection(cipher, ack_connection(State#state{session = Session, @@ -2485,10 +2469,10 @@ get_pending_connection_state_prf(CStates, Direction) -> CS = ssl_record:pending_connection_state(CStates, Direction), CS#connection_state.security_parameters#security_parameters.prf_algorithm. -connection_hash_algo({HashAlgo, _}, _State) -> - HashAlgo; -connection_hash_algo(_, #state{hashsign_algorithm = {HashAlgo, _}}) -> - HashAlgo. +connection_hashsign(HashSign = {_, _}, _State) -> + HashSign; +connection_hashsign(_, #state{hashsign_algorithm = HashSign}) -> + HashSign. %% RFC 5246, Sect. 7.4.1.4.1. Signature Algorithms %% If the client does not send the signature_algorithms extension, the diff --git a/lib/ssl/src/ssl_handshake.erl b/lib/ssl/src/ssl_handshake.erl index db21dac942..1929370991 100644 --- a/lib/ssl/src/ssl_handshake.erl +++ b/lib/ssl/src/ssl_handshake.erl @@ -32,10 +32,10 @@ -export([master_secret/4, client_hello/8, server_hello/5, hello/4, hello_request/0, certify/7, certificate/4, - client_certificate_verify/6, certificate_verify/6, + client_certificate_verify/6, certificate_verify/6, verify_signature/5, certificate_request/3, key_exchange/3, server_key_exchange_hash/2, finished/5, verify_connection/6, get_tls_handshake/3, - decode_client_key/3, server_hello_done/0, + decode_client_key/3, decode_server_key/3, server_hello_done/0, encode_handshake/2, init_handshake_history/0, update_handshake_history/2, decrypt_premaster_secret/2, prf/5, next_protocol/1]). @@ -320,25 +320,36 @@ client_certificate_verify(OwnCert, MasterSecret, Version, %% %% Description: Checks that the certificate_verify message is valid. %%-------------------------------------------------------------------- -certificate_verify(Signature, {?'rsaEncryption', PublicKey, _}, Version, - {HashAlgo, _SignAlgo}, MasterSecret, {_, Handshake}) -> - Hashes = calc_certificate_verify(Version, HashAlgo, MasterSecret, Handshake), - case certificate_verify_rsa(Hashes, HashAlgo, Signature, PublicKey, Version) of +certificate_verify(Signature, PublicKeyInfo, Version, + HashSign = {HashAlgo, _}, MasterSecret, {_, Handshake}) -> + Hash = calc_certificate_verify(Version, HashAlgo, MasterSecret, Handshake), + case verify_signature(Version, Hash, HashSign, Signature, PublicKeyInfo) of true -> valid; _ -> - ?ALERT_REC(?FATAL, ?BAD_CERTIFICATE) - end; -certificate_verify(Signature, {?'id-dsa', PublicKey, PublicKeyParams}, Version, - {HashAlgo, _SignAlgo}, MasterSecret, {_, Handshake}) -> - Hashes = calc_certificate_verify(Version, HashAlgo, MasterSecret, Handshake), - case public_key:verify({digest, Hashes}, sha, Signature, {PublicKey, PublicKeyParams}) of - true -> - valid; - false -> ?ALERT_REC(?FATAL, ?BAD_CERTIFICATE) end. +%%-------------------------------------------------------------------- +-spec verify_signature(tls_version(), binary(), {term(), term()}, binary(), + public_key_info()) -> true | false. +%% +%% Description: Checks that a public_key signature is valid. +%%-------------------------------------------------------------------- +verify_signature(_Version, _Hash, {_HashAlgo, anon}, _Signature, _) -> + true; +verify_signature({3, Minor}, Hash, {HashAlgo, rsa}, Signature, {?rsaEncryption, PubKey, _PubKeyParams}) + when Minor >= 3 -> + public_key:verify({digest, Hash}, HashAlgo, Signature, PubKey); +verify_signature(_Version, Hash, _HashAlgo, Signature, {?rsaEncryption, PubKey, _PubKeyParams}) -> + case public_key:decrypt_public(Signature, PubKey, + [{rsa_pad, rsa_pkcs1_padding}]) of + Hash -> true; + _ -> false + end; +verify_signature(_Version, Hash, {HashAlgo, dsa}, Signature, {?'id-dsa', PublicKey, PublicKeyParams}) -> + public_key:verify({digest, Hash}, HashAlgo, Signature, {PublicKey, PublicKeyParams}). + %%-------------------------------------------------------------------- -spec certificate_request(#connection_states{}, db_handle(), certdb_ref()) -> @@ -382,31 +393,33 @@ key_exchange(client, _Version, {dh, <<?UINT32(Len), PublicKey:Len/binary>>}) -> key_exchange(server, Version, {dh, {<<?UINT32(Len), PublicKey:Len/binary>>, _}, #'DHParameter'{prime = P, base = G}, - {HashAlgo, SignAlgo}, ClientRandom, ServerRandom, PrivateKey}) -> + HashSign, ClientRandom, ServerRandom, PrivateKey}) -> <<?UINT32(_), PBin/binary>> = crypto:mpint(P), <<?UINT32(_), GBin/binary>> = crypto:mpint(G), - PLen = byte_size(PBin), - GLen = byte_size(GBin), - YLen = byte_size(PublicKey), ServerDHParams = #server_dh_params{dh_p = PBin, dh_g = GBin, dh_y = PublicKey}, + enc_server_key_exchange(Version, ServerDHParams, HashSign, + ClientRandom, ServerRandom, PrivateKey). +enc_server_key_exchange(Version, Params, {HashAlgo, SignAlgo}, + ClientRandom, ServerRandom, PrivateKey) -> + EncParams = enc_server_key(Params), case HashAlgo of null -> - #server_key_exchange{params = ServerDHParams, - signed_params = <<>>, - hashsign = {null, anon}}; + #server_key_params{params = Params, + params_bin = EncParams, + hashsign = {null, anon}, + signature = <<>>}; _ -> Hash = server_key_exchange_hash(HashAlgo, <<ClientRandom/binary, - ServerRandom/binary, - ?UINT16(PLen), PBin/binary, - ?UINT16(GLen), GBin/binary, - ?UINT16(YLen), PublicKey/binary>>), - Signed = digitally_signed(Version, Hash, HashAlgo, PrivateKey), - #server_key_exchange{params = ServerDHParams, - signed_params = Signed, - hashsign = {HashAlgo, SignAlgo}} + ServerRandom/binary, + EncParams/binary>>), + Signature = digitally_signed(Version, Hash, HashAlgo, PrivateKey), + #server_key_params{params = Params, + params_bin = EncParams, + hashsign = {HashAlgo, SignAlgo}, + signature = Signature} end. %%-------------------------------------------------------------------- @@ -523,6 +536,15 @@ decode_client_key(ClientKey, Type, Version) -> dec_client_key(ClientKey, key_exchange_alg(Type), Version). %%-------------------------------------------------------------------- +-spec decode_server_key(binary(), key_algo(), tls_version()) -> + #server_key_params{}. +%% +%% Description: Decode server_key data and return appropriate type +%%-------------------------------------------------------------------- +decode_server_key(ServerKey, Type, Version) -> + dec_server_key(ServerKey, key_exchange_alg(Type), Version). + +%%-------------------------------------------------------------------- -spec init_handshake_history() -> tls_handshake_history(). %% @@ -975,31 +997,8 @@ dec_hs(_Version, ?SERVER_HELLO, <<?BYTE(Major), ?BYTE(Minor), Random:32/binary, next_protocol_negotiation = NextProtocolNegotiation}; dec_hs(_Version, ?CERTIFICATE, <<?UINT24(ACLen), ASN1Certs:ACLen/binary>>) -> #certificate{asn1_certificates = certs_to_list(ASN1Certs)}; - -dec_hs(_Version, ?SERVER_KEY_EXCHANGE, <<?UINT16(PLen), P:PLen/binary, - ?UINT16(GLen), G:GLen/binary, - ?UINT16(YLen), Y:YLen/binary, - ?UINT16(0)>>) -> %% May happen if key_algorithm is dh_anon - #server_key_exchange{params = #server_dh_params{dh_p = P,dh_g = G, - dh_y = Y}, - signed_params = <<>>, hashsign = {null, anon}}; -dec_hs({Major, Minor}, ?SERVER_KEY_EXCHANGE, <<?UINT16(PLen), P:PLen/binary, - ?UINT16(GLen), G:GLen/binary, - ?UINT16(YLen), Y:YLen/binary, - ?BYTE(HashAlgo), ?BYTE(SignAlgo), - ?UINT16(Len), Sig:Len/binary>>) - when Major == 3, Minor >= 3 -> - #server_key_exchange{params = #server_dh_params{dh_p = P,dh_g = G, - dh_y = Y}, - signed_params = Sig, - hashsign = {ssl_cipher:hash_algorithm(HashAlgo), ssl_cipher:sign_algorithm(SignAlgo)}}; -dec_hs(_Version, ?SERVER_KEY_EXCHANGE, <<?UINT16(PLen), P:PLen/binary, - ?UINT16(GLen), G:GLen/binary, - ?UINT16(YLen), Y:YLen/binary, - ?UINT16(Len), Sig:Len/binary>>) -> - #server_key_exchange{params = #server_dh_params{dh_p = P,dh_g = G, - dh_y = Y}, - signed_params = Sig, hashsign = undefined}; +dec_hs(_Version, ?SERVER_KEY_EXCHANGE, Keys) -> + #server_key_exchange{exchange_keys = Keys}; dec_hs({Major, Minor}, ?CERTIFICATE_REQUEST, <<?BYTE(CertTypesLen), CertTypes:CertTypesLen/binary, ?UINT16(HashSignsLen), HashSigns:HashSignsLen/binary, @@ -1039,6 +1038,42 @@ dec_client_key(<<?UINT16(DH_YLen), DH_Y:DH_YLen/binary>>, ?KEY_EXCHANGE_DIFFIE_HELLMAN, _) -> #client_diffie_hellman_public{dh_public = DH_Y}. +dec_ske_params(Len, Keys, Version) -> + <<Params:Len/bytes, Signature/binary>> = Keys, + dec_ske_signature(Params, Signature, Version). + +dec_ske_signature(Params, <<?BYTE(HashAlgo), ?BYTE(SignAlgo), + ?UINT16(0)>>, {Major, Minor}) + when Major == 3, Minor >= 3 -> + HashSign = {ssl_cipher:hash_algorithm(HashAlgo), ssl_cipher:sign_algorithm(SignAlgo)}, + {Params, HashSign, <<>>}; +dec_ske_signature(Params, <<?BYTE(HashAlgo), ?BYTE(SignAlgo), + ?UINT16(Len), Signature:Len/binary>>, {Major, Minor}) + when Major == 3, Minor >= 3 -> + HashSign = {ssl_cipher:hash_algorithm(HashAlgo), ssl_cipher:sign_algorithm(SignAlgo)}, + {Params, HashSign, Signature}; +dec_ske_signature(Params, <<>>, _) -> + {Params, {null, anon}, <<>>}; +dec_ske_signature(Params, <<?UINT16(0)>>, _) -> + {Params, {null, anon}, <<>>}; +dec_ske_signature(Params, <<?UINT16(Len), Signature:Len/binary>>, _) -> + {Params, undefined, Signature}; +dec_ske_signature(_, _, _) -> + throw(?ALERT_REC(?FATAL, ?HANDSHAKE_FAILURE)). + +dec_server_key(<<?UINT16(PLen), P:PLen/binary, + ?UINT16(GLen), G:GLen/binary, + ?UINT16(YLen), Y:YLen/binary, _/binary>> = KeyStruct, + ?KEY_EXCHANGE_DIFFIE_HELLMAN, Version) -> + Params = #server_dh_params{dh_p = P, dh_g = G, dh_y = Y}, + {BinMsg, HashSign, Signature} = dec_ske_params(PLen + GLen + YLen + 6, KeyStruct, Version), + #server_key_params{params = Params, + params_bin = BinMsg, + hashsign = HashSign, + signature = Signature}; +dec_server_key(_, _, _) -> + throw(?ALERT_REC(?FATAL, ?HANDSHAKE_FAILURE)). + dec_hello_extensions(<<>>) -> []; dec_hello_extensions(<<?UINT16(ExtLen), Extensions:ExtLen/binary>>) -> @@ -1156,18 +1191,12 @@ enc_hs(#certificate{asn1_certificates = ASN1CertList}, _Version) -> ASN1Certs = certs_from_list(ASN1CertList), ACLen = erlang:iolist_size(ASN1Certs), {?CERTIFICATE, <<?UINT24(ACLen), ASN1Certs:ACLen/binary>>}; -enc_hs(#server_key_exchange{params = #server_dh_params{ - dh_p = P, dh_g = G, dh_y = Y}, - signed_params = SignedParams, hashsign = HashSign}, Version) -> - PLen = byte_size(P), - GLen = byte_size(G), - YLen = byte_size(Y), - Signature = enc_sign(HashSign, SignedParams, Version), - {?SERVER_KEY_EXCHANGE, <<?UINT16(PLen), P/binary, - ?UINT16(GLen), G/binary, - ?UINT16(YLen), Y/binary, - Signature/binary>> - }; +enc_hs(#server_key_exchange{exchange_keys = Keys}, _Version) -> + {?SERVER_KEY_EXCHANGE, Keys}; +enc_hs(#server_key_params{params_bin = Keys, hashsign = HashSign, + signature = Signature}, Version) -> + EncSign = enc_sign(HashSign, Signature, Version), + {?SERVER_KEY_EXCHANGE, <<Keys/binary, EncSign/binary>>}; enc_hs(#certificate_request{certificate_types = CertTypes, hashsign_algorithms = #hash_sign_algos{hash_sign_algos = HashSignAlgos}, certificate_authorities = CertAuths}, @@ -1211,6 +1240,14 @@ enc_cke(#client_diffie_hellman_public{dh_public = DHPublic}, _) -> Len = byte_size(DHPublic), <<?UINT16(Len), DHPublic/binary>>. +enc_server_key(#server_dh_params{dh_p = P, dh_g = G, dh_y = Y}) -> + PLen = byte_size(P), + GLen = byte_size(G), + YLen = byte_size(Y), + <<?UINT16(PLen), P/binary, ?UINT16(GLen), G/binary, ?UINT16(YLen), Y/binary>>. + +enc_sign({_, anon}, _Sign, _Version) -> + <<>>; enc_sign({HashAlg, SignAlg}, Signature, _Version = {Major, Minor}) when Major == 3, Minor >= 3-> SignLen = byte_size(Signature), @@ -1328,8 +1365,8 @@ certificate_authorities_from_db(CertDbHandle, CertDbRef) -> digitally_signed({3, Minor}, Hash, HashAlgo, Key) when Minor >= 3 -> public_key:sign({digest, Hash}, HashAlgo, Key); -digitally_signed(_Version, Hash, _HashAlgo, #'DSAPrivateKey'{} = Key) -> - public_key:sign({digest, Hash}, sha, Key); +digitally_signed(_Version, Hash, HashAlgo, #'DSAPrivateKey'{} = Key) -> + public_key:sign({digest, Hash}, HashAlgo, Key); digitally_signed(_Version, Hash, _HashAlgo, #'RSAPrivateKey'{} = Key) -> public_key:encrypt_private(Hash, Key, [{rsa_pad, rsa_pkcs1_padding}]). @@ -1378,19 +1415,6 @@ apply_user_fun(Fun, OtpCert, ExtensionOrError, UserState0, SslState) -> {unknown, {SslState, UserState}} end. -certificate_verify_rsa(Hashes, sha, Signature, PublicKey, {Major, Minor}) - when Major == 3, Minor >= 3 -> - public_key:verify({digest, Hashes}, sha, Signature, PublicKey); -certificate_verify_rsa(Hashes, HashAlgo, Signature, PublicKey, {Major, Minor}) - when Major == 3, Minor >= 3 -> - public_key:verify({digest, Hashes}, HashAlgo, Signature, PublicKey); -certificate_verify_rsa(Hashes, _HashAlgo, Signature, PublicKey, _Version) -> - case public_key:decrypt_public(Signature, PublicKey, - [{rsa_pad, rsa_pkcs1_padding}]) of - Hashes -> true; - _ -> false - end. - -define(TLSEXT_SIGALG_RSA(MD), {MD, rsa}). -define(TLSEXT_SIGALG_DSA(MD), {MD, dsa}). diff --git a/lib/ssl/src/ssl_handshake.hrl b/lib/ssl/src/ssl_handshake.hrl index 9af6511d68..2414d5b666 100644 --- a/lib/ssl/src/ssl_handshake.hrl +++ b/lib/ssl/src/ssl_handshake.hrl @@ -141,9 +141,14 @@ }). -record(server_key_exchange, { + exchange_keys + }). + +-record(server_key_params, { params, %% #server_rsa_params{} | #server_dh_params{} - signed_params, %% #signature{} - hashsign %% term(atom(), atom()) + params_bin, + hashsign, %% term(atom(), atom()) + signature %% #signature{} }). %% enum { anonymous, rsa, dsa } SignatureAlgorithm; diff --git a/lib/stdlib/src/Makefile b/lib/stdlib/src/Makefile index 575a5cbe4a..2bab46b72a 100644 --- a/lib/stdlib/src/Makefile +++ b/lib/stdlib/src/Makefile @@ -175,24 +175,25 @@ primary_bootstrap_compiler: \ $(BOOTSTRAP_COMPILER)/ebin/otp_internal.beam $(BOOTSTRAP_COMPILER)/ebin/erl_parse.beam: erl_parse.yrl - $(ERLC) -o $(BOOTSTRAP_COMPILER)/egen erl_parse.yrl - $(ERLC) -o $(BOOTSTRAP_COMPILER)/ebin $(BOOTSTRAP_COMPILER)/egen/erl_parse.erl + $(gen_verbose) + $(V_at)$(ERLC) -o $(BOOTSTRAP_COMPILER)/egen erl_parse.yrl + $(V_at)$(ERLC) -o $(BOOTSTRAP_COMPILER)/ebin $(BOOTSTRAP_COMPILER)/egen/erl_parse.erl $(BOOTSTRAP_TOP)/lib/stdlib/egen/erl_parse.erl: erl_parse.yrl - $(ERLC) $(YRL_FLAGS) -o$(BOOTSTRAP_TOP)/lib/stdlib/egen erl_parse.yrl + $(yecc_verbose)$(ERLC) $(YRL_FLAGS) -o$(BOOTSTRAP_TOP)/lib/stdlib/egen erl_parse.yrl $(BOOTSTRAP_COMPILER)/ebin/%.beam: %.erl - $(ERLC) -o $(BOOTSTRAP_COMPILER)/ebin $< + $(V_ERLC) -o $(BOOTSTRAP_COMPILER)/ebin $< # ---------------------------------------------------- # Special Build Targets # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Release Target diff --git a/lib/stdlib/src/erl_lint.erl b/lib/stdlib/src/erl_lint.erl index d24e2fff44..9a01e85006 100644 --- a/lib/stdlib/src/erl_lint.erl +++ b/lib/stdlib/src/erl_lint.erl @@ -94,7 +94,6 @@ value_option(Flag, Default, On, OnVal, Off, OffVal, Opts) -> %% the other function collections contain {Function, Arity}. -record(lint, {state=start :: 'start' | 'attribute' | 'function', module=[], %Module - extends=[], %Extends behaviour=[], %Behaviour exports=gb_sets:empty() :: gb_set(), %Exports imports=[], %Imports @@ -112,7 +111,6 @@ value_option(Flag, Default, On, OnVal, Off, OffVal, Opts) -> enabled_warnings=[], %All enabled warnings (ordset). errors=[], %Current errors warnings=[], %Current warnings - global_vt=[], %The global VarTable file = "" :: string(), %From last file attribute recdef_top=false :: boolean(), %true in record initialisation %outside any fun or lc @@ -142,10 +140,8 @@ format_error({bad_module_name, M}) -> io_lib:format("bad module name '~s'", [M]); format_error(redefine_module) -> "redefining module"; -format_error(redefine_extends) -> - "redefining extends attribute"; -format_error(extends_self) -> - "cannot extend from self"; +format_error(pmod_unsupported) -> + "parameterized modules are no longer supported"; %% format_error({redefine_mod_import, M, P}) -> %% io_lib:format("module '~s' already imported from package '~s'", [M, P]); @@ -166,10 +162,6 @@ format_error({bad_inline,{F,A}}) -> io_lib:format("inlined function ~w/~w undefined", [F,A]); format_error({invalid_deprecated,D}) -> io_lib:format("badly formed deprecated attribute ~w", [D]); -format_error(invalid_extends) -> - "badly formed extends attribute"; -format_error(define_instance) -> - "defining instance function not allowed in abstract module"; format_error({bad_deprecated,{F,A}}) -> io_lib:format("deprecated function ~w/~w undefined or not exported", [F,A]); format_error({bad_nowarn_unused_function,{F,A}}) -> @@ -622,8 +614,6 @@ forms(Forms0, St0) -> pre_scan([{function,_L,new,_A,_Cs} | Fs], St) -> pre_scan(Fs, St#lint{new=true}); -pre_scan([{attribute,_L,extends,M} | Fs], St) when is_atom(M) -> - pre_scan(Fs, St#lint{extends=true}); pre_scan([{attribute,L,compile,C} | Fs], St) -> case is_warn_enabled(export_all, St) andalso member(export_all, lists:flatten([C])) of @@ -678,41 +668,15 @@ form(Form, #lint{state=State}=St) -> %% start_state(Form, State) -> State' -start_state({attribute,_,module,{M,Ps}}, St0) -> - St1 = St0#lint{module=M}, - Arity = length(Ps), - Ps1 = if is_atom(St1#lint.extends) -> - ['BASE', 'THIS' | Ps]; - true -> - ['THIS' | Ps] - end, - Vt = orddict:from_list([{V, {bound, used, []}} || V <- Ps1]), - St2 = add_instance(Arity, St1), - St3 = ensure_new(Arity, St2), - St3#lint{state=attribute, extends=[], global_vt=Vt}; +start_state({attribute,Line,module,{_,_}}=Form, St0) -> + St1 = add_error(Line, pmod_unsupported, St0), + attribute_state(Form, St1#lint{state=attribute}); start_state({attribute,_,module,M}, St0) -> St1 = St0#lint{module=M}, - St1#lint{state=attribute, extends=[]}; + St1#lint{state=attribute}; start_state(Form, St) -> St1 = add_error(element(2, Form), undefined_module, St), - attribute_state(Form, St1#lint{state=attribute, extends=[]}). - -ensure_new(Arity, St) -> - case St#lint.new of - true -> - St; - false -> - add_func(new, Arity, St) - end. - -add_instance(Arity, St) -> - A = Arity + (if is_atom(St#lint.extends) -> 1; true -> 0 end), - add_func(instance, A, St). - -add_func(Name, Arity, St) -> - F = {Name, Arity}, - St#lint{exports = gb_sets:add_element(F, St#lint.exports), - defined = gb_sets:add_element(F, St#lint.defined)}. + attribute_state(Form, St1#lint{state=attribute}). %% attribute_state(Form, State) -> %% State' @@ -721,15 +685,6 @@ attribute_state({attribute,_L,module,_M}, #lint{module=[]}=St) -> St; attribute_state({attribute,L,module,_M}, St) -> add_error(L, redefine_module, St); -attribute_state({attribute,L,extends,M}, #lint{module=M}=St) when is_atom(M) -> - add_error(L, extends_self, St); -attribute_state({attribute,_L,extends,M}, #lint{extends=[]}=St) - when is_atom(M) -> - St#lint{extends=M}; -attribute_state({attribute,L,extends,M}, St) when is_atom(M) -> - add_error(L, redefine_extends, St); -attribute_state({attribute,L,extends,_M}, St) -> - add_error(L, invalid_extends, St); attribute_state({attribute,L,export,Es}, St) -> export(L, Es, St); attribute_state({attribute,L,export_type,Es}, St) -> @@ -1322,11 +1277,9 @@ call_function(Line, F, A, #lint{usage=Usage0,called=Cd,func=Func}=St) -> %% function(Line, Name, Arity, Clauses, State) -> State. -function(Line, instance, _Arity, _Cs, St) when St#lint.global_vt =/= [] -> - add_error(Line, define_instance, St); function(Line, Name, Arity, Cs, St0) -> St1 = define_function(Line, Name, Arity, St0#lint{func={Name,Arity}}), - clauses(Cs, St1#lint.global_vt, St1). + clauses(Cs, St1). -spec define_function(line(), atom(), arity(), lint_state()) -> lint_state(). @@ -1349,15 +1302,16 @@ function_check_max_args(Line, Arity, St) when Arity > ?MAX_ARGUMENTS -> add_error(Line, {too_many_arguments,Arity}, St); function_check_max_args(_, _, St) -> St. -%% clauses([Clause], VarTable, State) -> {VarTable, State}. +%% clauses([Clause], State) -> {VarTable, State}. -clauses(Cs, Vt, St) -> +clauses(Cs, St) -> foldl(fun (C, St0) -> - {_,St1} = clause(C, Vt, St0), + {_,St1} = clause(C, St0), St1 end, St, Cs). -clause({clause,_Line,H,G,B}, Vt0, St0) -> +clause({clause,_Line,H,G,B}, St0) -> + Vt0 = [], {Hvt,Binvt,St1} = head(H, Vt0, St0), %% Cannot ignore BinVt since "binsize variables" may have been used. Vt1 = vtupdate(Hvt, vtupdate(Binvt, Vt0)), diff --git a/lib/stdlib/test/Makefile b/lib/stdlib/test/Makefile index 29b8e28d3a..6aa09d7bd0 100644 --- a/lib/stdlib/test/Makefile +++ b/lib/stdlib/test/Makefile @@ -23,7 +23,6 @@ MODULES= \ dummy_via \ edlin_expand_SUITE \ epp_SUITE \ - erl_eval_helper \ erl_eval_SUITE \ erl_expand_records_SUITE \ erl_internal_SUITE \ diff --git a/lib/stdlib/test/erl_eval_SUITE.erl b/lib/stdlib/test/erl_eval_SUITE.erl index 47792d1052..04d49770cb 100644 --- a/lib/stdlib/test/erl_eval_SUITE.erl +++ b/lib/stdlib/test/erl_eval_SUITE.erl @@ -1160,24 +1160,6 @@ do_funs(LFH, EFH) -> concat(["begin F = fun(F, N) -> [", M, ":count_down(F,N) || X <-[1]] end, F(F,2) end."]), [[[0]]], ['F'], LFH, EFH), - - %% Tests for a bug found by the Dialyzer - used to crash. - case test_server:is_native(erl_eval) of - true -> - %% Parameterized modules are not supported by HiPE. - ok; - false -> - check(fun() -> Pmod = erl_eval_helper:new(42), Pmod:add(5) end, - "begin Pmod = erl_eval_helper:new(42), Pmod:add(5) end.", - 47, - ['Pmod'], LFH, EFH), - check(fun() -> Pmod = erl_eval_helper:new(42), - B = Pmod:add(7), B end, - "begin Pmod = erl_eval_helper:new(42), " - "B = Pmod:add(7), B end.", - 49, - ['B','Pmod'], LFH, EFH) - end, ok. count_down(F, N) when N > 0 -> diff --git a/lib/stdlib/test/erl_eval_helper.erl b/lib/stdlib/test/erl_eval_helper.erl deleted file mode 100644 index 6863b40108..0000000000 --- a/lib/stdlib/test/erl_eval_helper.erl +++ /dev/null @@ -1,28 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2005-2010. All Rights Reserved. -%% -%% The contents of this file are subject to the Erlang Public License, -%% Version 1.1, (the "License"); you may not use this file except in -%% compliance with the License. You should have received a copy of the -%% Erlang Public License along with this software. If not, it can be -%% retrieved online at http://www.erlang.org/. -%% -%% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -%% the License for the specific language governing rights and limitations -%% under the License. -%% -%% %CopyrightEnd% -%% - --module(erl_eval_helper, [Base]). - --export([add/1]). - -add(Arg) -> - Base+Arg. - - - diff --git a/lib/stdlib/test/erl_expand_records_SUITE.erl b/lib/stdlib/test/erl_expand_records_SUITE.erl index e51c05a22c..94b4397a9c 100644 --- a/lib/stdlib/test/erl_expand_records_SUITE.erl +++ b/lib/stdlib/test/erl_expand_records_SUITE.erl @@ -35,7 +35,7 @@ init_per_group/2,end_per_group/2, init_per_testcase/2, end_per_testcase/2]). --export([abstract_module/1, attributes/1, expr/1, guard/1, +-export([attributes/1, expr/1, guard/1, init/1, pattern/1, strict/1, update/1, otp_5915/1, otp_7931/1, otp_5990/1, otp_7078/1, otp_7101/1]). @@ -55,7 +55,7 @@ end_per_testcase(_Case, _Config) -> suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> - [abstract_module, attributes, expr, guard, init, + [attributes, expr, guard, init, pattern, strict, update, {group, tickets}]. groups() -> @@ -75,33 +75,6 @@ end_per_group(_GroupName, Config) -> Config. -abstract_module(doc) -> - "Compile an abstract module."; -abstract_module(suite) -> []; -abstract_module(Config) when is_list(Config) -> - %% erl_expand_records does not handle abstract modules. But anyway... - File = filename("param.erl", Config), - Beam = filename("param.beam", Config), - Test = <<"-module(param, [A, B]). - - -export([args/1]). - - args(C) -> - X = local(C), - Z = new(A, B), - {X, Z}. - - local(C) -> - module_info(C). - ">>, - - ?line ok = file:write_file(File, Test), - ?line {ok, param} = compile:file(File, [{outdir,?privdir}]), - - ?line ok = file:delete(File), - ?line ok = file:delete(Beam), - ok. - attributes(doc) -> "Import module and functions."; attributes(suite) -> []; @@ -196,7 +169,7 @@ guard(suite) -> []; guard(Config) when is_list(Config) -> File = filename("guard.erl", Config), Beam = filename("guard.beam", Config), - Test = <<"-module(guard, [A, B]). + Test = <<"-module(guard). -export([t/1]). diff --git a/lib/stdlib/test/erl_lint_SUITE.erl b/lib/stdlib/test/erl_lint_SUITE.erl index 774229fca9..564f27a512 100644 --- a/lib/stdlib/test/erl_lint_SUITE.erl +++ b/lib/stdlib/test/erl_lint_SUITE.erl @@ -2187,27 +2187,9 @@ otp_5878(Config) when is_list(Config) -> ?line [] = run(Config, Ts), Abstr = <<"-module(lint_test, [A, B]). - - -export([args/1]). - - -record(r, {a = A, b = THIS}). % A and THIS are unbound - - %% param:args(compile,param:new(1,2)). - - args(C) -> - X = local(C), - Z = new(A, B), - F = fun(THIS) -> {x, A} end, % THIS unused and shadowed - {X, Z, THIS, F, #r{}}. - - local(C) -> - module_info(C). ">>, - ?line {error,[{5,erl_lint,{unbound_var,'A'}}, - {5,erl_lint,{unbound_var,'THIS'}}], - [{12,erl_lint,{unused_var,'THIS'}}, - {12,erl_lint,{shadowed_var,'THIS','fun'}}]} - = run_test2(Config, Abstr, [warn_unused_record]), + {errors,[{1,erl_lint,pmod_unsupported}],[]} = + run_test2(Config, Abstr, [warn_unused_record]), QLC1 = <<"-module(lint_test). -include_lib(\"stdlib/include/qlc.hrl\"). diff --git a/lib/stdlib/test/shell_SUITE.erl b/lib/stdlib/test/shell_SUITE.erl index a32f846bd2..f22df96697 100644 --- a/lib/stdlib/test/shell_SUITE.erl +++ b/lib/stdlib/test/shell_SUITE.erl @@ -28,7 +28,7 @@ refman_bit_syntax/1, progex_bit_syntax/1, progex_records/1, progex_lc/1, progex_funs/1, - otp_5990/1, otp_6166/1, otp_6554/1, otp_6785/1, + otp_5990/1, otp_6166/1, otp_6554/1, otp_7184/1, otp_7232/1, otp_8393/1, otp_10302/1]). -export([ start_restricted_from_shell/1, @@ -92,7 +92,7 @@ groups() -> [progex_bit_syntax, progex_records, progex_lc, progex_funs]}, {tickets, [], - [otp_5990, otp_6166, otp_6554, otp_6785, otp_7184, + [otp_5990, otp_6166, otp_6554, otp_7184, otp_7232, otp_8393, otp_10302]}]. init_per_suite(Config) -> @@ -2543,19 +2543,6 @@ otp_6554(Config) when is_list(Config) -> ok. -otp_6785(doc) -> - "OTP-6785. Parameterized modules."; -otp_6785(suite) -> []; -otp_6785(Config) when is_list(Config) -> - MFile = filename:join(?config(priv_dir, Config), "parameterized.erl"), - Contents = <<"-module(parameterized, [A]). " - "-export([test/0]). " - "test() -> A. ">>, - ?line ok = compile_file(Config, MFile, Contents, []), - ?line (parameterized:new(adsf)):test(), - file:delete(MFile), - ok. - otp_7184(doc) -> "OTP-7184. Propagate exit signals from dying evaluator process."; otp_7184(suite) -> []; diff --git a/lib/syntax_tools/src/Makefile b/lib/syntax_tools/src/Makefile index dca5e78be9..2aa6591c77 100644 --- a/lib/syntax_tools/src/Makefile +++ b/lib/syntax_tools/src/Makefile @@ -62,17 +62,17 @@ distclean: clean realclean: clean $(EBIN)/%.$(EMULATOR):%.erl - erlc -W $(ERL_COMPILE_FLAGS) -o$(EBIN) $< + $(erlc_verbose)erlc -W $(ERL_COMPILE_FLAGS) -o$(EBIN) $< # ---------------------------------------------------- # Special Build Targets # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Release Target diff --git a/lib/test_server/src/Makefile b/lib/test_server/src/Makefile index 3261936472..43a03f4e1d 100644 --- a/lib/test_server/src/Makefile +++ b/lib/test_server/src/Makefile @@ -112,10 +112,10 @@ configure: configure.in # Special Build Targets # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Release Target diff --git a/lib/toolbar/src/Makefile b/lib/toolbar/src/Makefile index 102970a59a..a24846976b 100644 --- a/lib/toolbar/src/Makefile +++ b/lib/toolbar/src/Makefile @@ -71,10 +71,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ docs: diff --git a/lib/tools/c_src/Makefile.in b/lib/tools/c_src/Makefile.in index 0382d3228d..aea5686ae9 100644 --- a/lib/tools/c_src/Makefile.in +++ b/lib/tools/c_src/Makefile.in @@ -17,6 +17,7 @@ # %CopyrightEnd% # +include $(ERL_TOP)/make/output.mk include $(ERL_TOP)/make/target.mk include $(ERL_TOP)/erts/include/internal/$(TARGET)/ethread.mk @@ -150,7 +151,7 @@ _create_dirs := $(shell mkdir -p $(CREATE_DIRS)) all: $(PROGS) $(DRIVERS) $(ERTS_LIB): - cd $(ERL_TOP)/erts/lib_src && $(MAKE) $(TYPE) + $(make_verbose)cd $(ERL_TOP)/erts/lib_src && $(MAKE) $(TYPE) docs: @@ -167,7 +168,7 @@ clean: # $(EMEM_OBJ_DIR)/%.o: %.c - $(CC) $(EMEM_CFLAGS) -o $@ -c $< + $(V_CC) $(EMEM_CFLAGS) -o $@ -c $< # # Driver targets @@ -178,7 +179,7 @@ $(EMEM_OBJ_DIR)/%.o: %.c # $(BIN_DIR)/emem$(TYPEMARKER)@EXEEXT@: $(EMEM_OBJS) $(ERTS_LIB) - $(PRE_LD) $(LD) $(EMEM_LDFLAGS) -o $@ $(EMEM_OBJS) $(EMEM_LIBS) + $(ld_verbose)$(PRE_LD) $(LD) $(EMEM_LDFLAGS) -o $@ $(EMEM_OBJS) $(EMEM_LIBS) # # Release targets @@ -221,7 +222,8 @@ SED_DEPEND=sed '$(SED_REPL_OBJ_DIR);$(SED_REPL_TT_DIR);$(SED_REPL_TARGET);$(SED_ DEPEND_MK=depend.mk dep depend: - @echo "Generating dependency file $(DEPEND_MK)..." + [ $(v_p) == 0 ] && echo " GEN "$(DEPEND_MK) + $(V_colon)@echo "Generating dependency file $(DEPEND_MK)..." @echo "# Generated dependency rules." > $(DEPEND_MK); @echo "# Do *not* edit this file; instead, run 'make depend'." \ >> $(DEPEND_MK); diff --git a/lib/tools/src/Makefile b/lib/tools/src/Makefile index abe1389771..bdd0cdce25 100644 --- a/lib/tools/src/Makefile +++ b/lib/tools/src/Makefile @@ -94,10 +94,10 @@ docs: # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Release Target diff --git a/lib/tools/test/cprof_SUITE.erl b/lib/tools/test/cprof_SUITE.erl index ce5cf66a14..93caee0c8f 100644 --- a/lib/tools/test/cprof_SUITE.erl +++ b/lib/tools/test/cprof_SUITE.erl @@ -230,10 +230,10 @@ on_load_test(Config) -> %% ?line N4 = cprof:restart(), ?line {ok,Module} = c:c(File, [{outdir,Priv}]), - ?line L = Module:seq(1, M, fun succ/1), - ?line Lr = Module:seq_r(1, M, fun succ/1), - ?line L = seq(1, M, fun succ/1), - ?line Lr = seq_r(1, M, fun succ/1), + ?line L = Module:seq(1, M, fun (I) -> succ(I) end), + ?line Lr = Module:seq_r(1, M, fun (I) -> succ(I) end), + ?line L = seq(1, M, fun (I) -> succ(I) end), + ?line Lr = seq_r(1, M, fun (I) -> succ(I) end), ?line N2 = cprof:pause(), ?line {Module,0,[]} = cprof:analyse(Module), ?line M_1 = M - 1, @@ -265,10 +265,10 @@ modules_test(Config) -> ?line M2__1 = M2 + 1, ?line erlang:yield(), ?line N = cprof:start(), - ?line L = Module:seq(1, M, fun succ/1), - ?line Lr = Module:seq_r(1, M, fun succ/1), - ?line L = seq(1, M, fun succ/1), - ?line Lr = seq_r(1, M, fun succ/1), + ?line L = Module:seq(1, M, fun (I) -> succ(I) end), + ?line Lr = Module:seq_r(1, M, fun (I) -> succ(I) end), + ?line L = seq(1, M, fun (I) -> succ(I) end), + ?line Lr = seq_r(1, M, fun (I) -> succ(I) end), ?line N = cprof:pause(), ?line Lr = lists:reverse(L), ?line M_1 = M - 1, diff --git a/lib/tools/test/xref_SUITE.erl b/lib/tools/test/xref_SUITE.erl index cf49526156..dc06678b8e 100644 --- a/lib/tools/test/xref_SUITE.erl +++ b/lib/tools/test/xref_SUITE.erl @@ -47,7 +47,7 @@ -export([ add/1, default/1, info/1, lib/1, read/1, read2/1, remove/1, replace/1, update/1, deprecated/1, trycatch/1, - abstract_modules/1, fun_mfa/1, fun_mfa_r14/1, + fun_mfa/1, fun_mfa_r14/1, fun_mfa_vars/1, qlc/1]). -export([ @@ -83,7 +83,7 @@ groups() -> modules]}, {files, [], [add, default, info, lib, read, read2, remove, replace, - update, deprecated, trycatch, abstract_modules, fun_mfa, + update, deprecated, trycatch, fun_mfa, fun_mfa_r14, fun_mfa_vars, qlc]}, {analyses, [], [analyze, basic, md, q, variables, unused_locals]}, @@ -1669,64 +1669,6 @@ trycatch(Conf) when is_list(Conf) -> ok. -abstract_modules(suite) -> []; -abstract_modules(doc) -> ["OTP-5520: Abstract (parameterized) modules."]; -abstract_modules(Conf) when is_list(Conf) -> - Dir = ?copydir, - File = fname(Dir, "absmod.erl"), - MFile = fname(Dir, "absmod"), - Beam = fname(Dir, "absmod.beam"), - Test = <<"-module(param, [A, B]). - - -export([args/1]). - - args(C) -> - X = local(C), - Y = THIS:new(), % undef - Z = new(A, B), - {X, Y, Z}. - - local(C) -> - module_info(C). - ">>, - - ?line ok = file:write_file(File, Test), - - %% The compiler will no longer allow us to have a mismatch between - %% the module name and the output file, so we must use a trick. - ?line {ok, param, BeamCode} = compile:file(File, [binary,debug_info]), - ?line ok = file:write_file(Beam, BeamCode), - - ?line {ok, _} = xref:start(s), - ?line {ok, param} = xref:add_module(s, MFile, {warnings,false}), - A = param, - ?line {ok, [{{{A,args,1},{'$M_EXPR',new,0}},[7]}, - {{{A,args,1},{A,local,1}},[6]}, - {{{A,args,1},{A,new,2}},[8]}, - {{{A,local,1},{A,module_info,1}},[12]}, - {{{param,new,2},{param,instance,2}},[0]}]} = - xref:q(s, "(Lin) E"), - ?line {ok,[{param,args,1}, - {param,instance,2}, - {param,local,1}, - {param,module_info,1}, - {param,new,2}]} = xref:q(s, "F"), - - ?line ok = check_state(s), - ?line xref:stop(s), - - ?line {ok, _} = xref:start(s, {xref_mode, modules}), - ?line {ok, param} = xref:add_module(s, MFile), - ?line {ok,[{param,args,1}, - {param,instance,2}, - {param,new,2}]} = xref:q(s, "X"), - ?line ok = check_state(s), - ?line xref:stop(s), - - ?line ok = file:delete(File), - ?line ok = file:delete(Beam), - ok. - fun_mfa(suite) -> []; fun_mfa(doc) -> ["OTP-5653: fun M:F/A."]; fun_mfa(Conf) when is_list(Conf) -> diff --git a/lib/tv/src/Makefile b/lib/tv/src/Makefile index da1713e156..3d680c1eaf 100644 --- a/lib/tv/src/Makefile +++ b/lib/tv/src/Makefile @@ -109,10 +109,10 @@ clean: rm -f errs core *~ $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ docs: diff --git a/lib/typer/src/Makefile b/lib/typer/src/Makefile index 1f94d8fdc8..13af466755 100644 --- a/lib/typer/src/Makefile +++ b/lib/typer/src/Makefile @@ -82,13 +82,13 @@ clean: # ---------------------------------------------------- $(EBIN)/typer.$(EMULATOR): typer.erl ../vsn.mk Makefile - erlc -W $(ERL_COMPILE_FLAGS) -DVSN="\"v$(VSN)\"" -o$(EBIN) typer.erl + $(erlc_verbose)erlc -W $(ERL_COMPILE_FLAGS) -DVSN="\"v$(VSN)\"" -o$(EBIN) typer.erl $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # --------------------------------------------------------------------- # dependencies diff --git a/lib/webtool/src/Makefile b/lib/webtool/src/Makefile index 783ffad79a..f28c777240 100644 --- a/lib/webtool/src/Makefile +++ b/lib/webtool/src/Makefile @@ -76,10 +76,10 @@ docs: # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Release Target diff --git a/lib/wx/aclocal.m4 b/lib/wx/aclocal.m4 index 5d555a5123..918e30a886 100644 --- a/lib/wx/aclocal.m4 +++ b/lib/wx/aclocal.m4 @@ -1861,17 +1861,16 @@ dnl Usage example LM_TRY_ENABLE_CFLAG([-Werror=return-type], [CFLAGS]) dnl dnl AC_DEFUN([LM_TRY_ENABLE_CFLAG], [ - AC_MSG_CHECKING([if we can add $1 to CFLAGS]) + AC_MSG_CHECKING([if we can add $1 to $2 (via CFLAGS)]) saved_CFLAGS=$CFLAGS; - CFLAGS="$1 $CFLAGS"; + CFLAGS="$1 $$2"; AC_TRY_COMPILE([],[return 0;],can_enable_flag=true,can_enable_flag=false) CFLAGS=$saved_CFLAGS; if test "X$can_enable_flag" = "Xtrue"; then AC_MSG_RESULT([yes]) - AS_VAR_SET($2, "$1 $CFLAGS") + AS_VAR_SET($2, "$1 $$2") else AC_MSG_RESULT([no]) - AS_VAR_SET($2, "$CFLAGS") fi ]) diff --git a/lib/wx/src/Makefile b/lib/wx/src/Makefile index 777fb7d998..26574ed86f 100644 --- a/lib/wx/src/Makefile +++ b/lib/wx/src/Makefile @@ -101,19 +101,19 @@ archive: opt # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk Makefile - sed -e 's;%GEN_MODS%;$(GEN_MODS);' $< > [email protected] - sed -e 's;%VSN%;$(VSN);' [email protected] > $@ - rm [email protected] + $(gen_verbose)sed -e 's;%GEN_MODS%;$(GEN_MODS);' $< > [email protected] + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' [email protected] > $@ + $(V_at)rm [email protected] $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk Makefile - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # Rules $(EBIN)/%.beam: $(ESRC)/%.erl $(HEADER_FILES) - $(ERLC) -W -bbeam $(ERL_FLAGS) $(ERL_COMPILE_FLAGS) -o$(EBIN) $< + $(V_ERLC) -W -bbeam $(ERL_FLAGS) $(ERL_COMPILE_FLAGS) -o$(EBIN) $< $(EBIN)/%.beam: $(EGEN)/%.erl $(HEADER_FILES) - $(ERLC) -W -bbeam $(ERL_FLAGS) $(ERL_COMPILE_FLAGS) -o$(EBIN) $< + $(V_ERLC) -W -bbeam $(ERL_FLAGS) $(ERL_COMPILE_FLAGS) -o$(EBIN) $< # ---------------------------------------------------- # Release Target diff --git a/lib/xmerl/src/Makefile b/lib/xmerl/src/Makefile index ce1aa11fba..d5ce3fe6ff 100644 --- a/lib/xmerl/src/Makefile +++ b/lib/xmerl/src/Makefile @@ -166,34 +166,34 @@ EDOC_PATHS = \ -pa $(EDOC_APP)/ebin -pa $(XMERL_APP)/ebin -pa $(SYNTAX_TOOLS_APP)/ebin $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ xmerl_xpath_parse.erl: xmerl_xpath_parse.yrl - $(ERLC) -o $(ESRC) $< + $(yecc_verbose)$(ERLC) -o $(ESRC) $< xmerl_b64Bin.erl: xmerl_b64Bin.yrl - $(ERLC) -o $(ESRC) $< + $(yecc_verbose)$(ERLC) -o $(ESRC) $< xmerl_sax_parser_list.erl: xmerl_sax_parser_list.erlsrc xmerl_sax_parser_base.erlsrc - cat xmerl_sax_parser_list.erlsrc xmerl_sax_parser_base.erlsrc >$@ + $(gen_verbose)cat xmerl_sax_parser_list.erlsrc xmerl_sax_parser_base.erlsrc >$@ xmerl_sax_parser_latin1.erl: xmerl_sax_parser_latin1.erlsrc xmerl_sax_parser_base.erlsrc - cat xmerl_sax_parser_latin1.erlsrc xmerl_sax_parser_base.erlsrc >$@ + $(gen_verbose)cat xmerl_sax_parser_latin1.erlsrc xmerl_sax_parser_base.erlsrc >$@ xmerl_sax_parser_utf8.erl: xmerl_sax_parser_utf8.erlsrc xmerl_sax_parser_base.erlsrc - cat xmerl_sax_parser_utf8.erlsrc xmerl_sax_parser_base.erlsrc >$@ + $(gen_verbose)cat xmerl_sax_parser_utf8.erlsrc xmerl_sax_parser_base.erlsrc >$@ xmerl_sax_parser_utf16be.erl: xmerl_sax_parser_utf16be.erlsrc xmerl_sax_parser_base.erlsrc - cat xmerl_sax_parser_utf16be.erlsrc xmerl_sax_parser_base.erlsrc >$@ + $(gen_verbose)cat xmerl_sax_parser_utf16be.erlsrc xmerl_sax_parser_base.erlsrc >$@ xmerl_sax_parser_utf16le.erl: xmerl_sax_parser_utf16le.erlsrc xmerl_sax_parser_base.erlsrc - cat xmerl_sax_parser_utf16le.erlsrc xmerl_sax_parser_base.erlsrc >$@ + $(gen_verbose)cat xmerl_sax_parser_utf16le.erlsrc xmerl_sax_parser_base.erlsrc >$@ $(EBIN)/%.beam: %.erl - $(ERLC) $(ERL_COMPILE_FLAGS) -o $(EBIN) $< + $(V_ERLC) $(ERL_COMPILE_FLAGS) -o $(EBIN) $< $(DOCDIR)/%.html: %.erl $(ERL) -noshell $(EDOC_PATHS) \ |