From a19f85f6d83b349f46da14e005a6435763c007ee Mon Sep 17 00:00:00 2001 From: Kostis Sagonas Date: Mon, 26 Mar 2012 23:39:20 +0200 Subject: Add warnings_as_errors option --- lib/dialyzer/src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dialyzer/src/Makefile b/lib/dialyzer/src/Makefile index 810f86dc21..97c5469d39 100644 --- a/lib/dialyzer/src/Makefile +++ b/lib/dialyzer/src/Makefile @@ -86,7 +86,7 @@ APPUP_TARGET= $(EBIN)/$(APPUP_FILE) ifeq ($(NATIVE_LIBS_ENABLED),yes) ERL_COMPILE_FLAGS += +native endif -ERL_COMPILE_FLAGS += +warn_exported_vars +warn_unused_import +warn_untyped_record +warn_missing_spec +ERL_COMPILE_FLAGS += +warn_exported_vars +warn_unused_import +warn_untyped_record +warn_missing_spec +warnings_as_errors # ---------------------------------------------------- # Targets -- cgit v1.2.3 From 82ae6e4cd3c4b909eb57b078f27d27da22624255 Mon Sep 17 00:00:00 2001 From: Kostis Sagonas Date: Mon, 26 Mar 2012 23:40:00 +0200 Subject: Up version --- lib/dialyzer/vsn.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dialyzer/vsn.mk b/lib/dialyzer/vsn.mk index 622e51b859..edafcc4afb 100644 --- a/lib/dialyzer/vsn.mk +++ b/lib/dialyzer/vsn.mk @@ -1 +1 @@ -DIALYZER_VSN = 2.5 +DIALYZER_VSN = 2.5.1 -- cgit v1.2.3 From e7b056ee49f2c3e8080e5424d87c0be27c9ebf7f Mon Sep 17 00:00:00 2001 From: Kostis Sagonas Date: Mon, 26 Mar 2012 23:41:35 +0200 Subject: Use wx:wx_object() type now that it is exported --- lib/dialyzer/src/dialyzer_gui_wx.erl | 57 ++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/lib/dialyzer/src/dialyzer_gui_wx.erl b/lib/dialyzer/src/dialyzer_gui_wx.erl index 9ff32bd8b1..8f470dd650 100644 --- a/lib/dialyzer/src/dialyzer_gui_wx.erl +++ b/lib/dialyzer/src/dialyzer_gui_wx.erl @@ -40,39 +40,38 @@ %%------------------------------------------------------------------------ --type wx_object() :: any(). %% XXX: should be imported from wx - --record(menu, {file :: wx_object(), - warnings :: wx_object(), - plt :: wx_object(), - options :: wx_object(), - help :: wx_object()}). - --record(gui_state, {add :: wx_object(), - add_dir :: wx_object(), - add_rec :: wx_object(), - chosen_box :: wx_object(), +-record(menu, {file :: wx:wx_object(), + warnings :: wx:wx_object(), + plt :: wx:wx_object(), + options :: wx:wx_object(), + help :: wx:wx_object()}). +-type menu() :: #menu{}. + +-record(gui_state, {add :: wx:wx_object(), + add_dir :: wx:wx_object(), + add_rec :: wx:wx_object(), + chosen_box :: wx:wx_object(), analysis_pid :: pid(), - del_file :: wx_object(), + del_file :: wx:wx_object(), doc_plt :: dialyzer_plt:plt(), - clear_chosen :: wx_object(), - clear_log :: wx_object(), - explain_warn :: wx_object(), - clear_warn :: wx_object(), + clear_chosen :: wx:wx_object(), + clear_log :: wx:wx_object(), + explain_warn :: wx:wx_object(), + clear_warn :: wx:wx_object(), init_plt :: dialyzer_plt:plt(), - dir_entry :: wx_object(), - file_box :: wx_object(), + dir_entry :: wx:wx_object(), + file_box :: wx:wx_object(), files_to_analyze :: ordset(string()), - gui :: wx_object(), - log :: wx_object(), - menu :: #menu{}, - mode :: wx_object(), + gui :: wx:wx_object(), + log :: wx:wx_object(), + menu :: menu(), + mode :: wx:wx_object(), options :: #options{}, - run :: wx_object(), - stop :: wx_object(), - frame :: wx_object(), - warnings_box :: wx_object(), - explanation_box :: wx_object(), + run :: wx:wx_object(), + stop :: wx:wx_object(), + frame :: wx:wx_object(), + warnings_box :: wx:wx_object(), + explanation_box :: wx:wx_object(), wantedWarnings :: list(), rawWarnings :: list(), backend_pid :: pid(), @@ -824,7 +823,7 @@ build_analysis_record(#gui_state{mode = Mode, menu = Menu, options = Options, 1 -> src_code end, InitPlt = - case wxMenu:isChecked(Menu#menu.plt,?menuID_PLT_INIT_EMPTY) of + case wxMenu:isChecked(Menu#menu.plt, ?menuID_PLT_INIT_EMPTY) of true -> dialyzer_plt:new(); false -> InitPlt0 end, -- cgit v1.2.3 From 154b98e876256310b3832334695094487da6ea3a Mon Sep 17 00:00:00 2001 From: Stavros Aronis Date: Thu, 22 Mar 2012 10:18:57 +0100 Subject: Report only actual unknown types otherwise no message is sent --- lib/dialyzer/src/dialyzer_analysis_callgraph.erl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/dialyzer/src/dialyzer_analysis_callgraph.erl b/lib/dialyzer/src/dialyzer_analysis_callgraph.erl index 5be870d78f..b6dbfdfacf 100644 --- a/lib/dialyzer/src/dialyzer_analysis_callgraph.erl +++ b/lib/dialyzer/src/dialyzer_analysis_callgraph.erl @@ -463,8 +463,10 @@ default_includes(Dir) -> rcv_and_send_ext_types(Parent) -> Self = self(), Self ! {Self, done}, - ExtTypes = rcv_ext_types(Self, []), - Parent ! {Self, ext_types, ExtTypes}, + case rcv_ext_types(Self, []) of + [] -> ok; + ExtTypes -> Parent ! {Self, ext_types, ExtTypes} + end, ok. rcv_ext_types(Self, ExtTypes) -> -- cgit v1.2.3 From 982d6706df475dc28535d0fe7922573c618bbc36 Mon Sep 17 00:00:00 2001 From: Stavros Aronis Date: Fri, 16 Mar 2012 18:33:05 +0100 Subject: Fix bug related with infinitely looping functions Depending of the ordering of the functions during dataflow, a function with an infinite loop might be identified as one that always crashes. This is fixed now, by allowing restoration of the infinitely-looping status. --- lib/dialyzer/src/dialyzer_dataflow.erl | 14 ++++++++-- .../test/small_SUITE_data/src/maybe_servers.erl | 31 ++++++++++++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 lib/dialyzer/test/small_SUITE_data/src/maybe_servers.erl diff --git a/lib/dialyzer/src/dialyzer_dataflow.erl b/lib/dialyzer/src/dialyzer_dataflow.erl index aba13278ff..d1dd7e1c34 100644 --- a/lib/dialyzer/src/dialyzer_dataflow.erl +++ b/lib/dialyzer/src/dialyzer_dataflow.erl @@ -761,7 +761,13 @@ handle_apply_or_call([{TypeOfApply, {Fun, Sig, Contr, LocalRet}}|Left], true -> AccArgTypes; false -> [t_sup(X, Y) || {X, Y} <- lists:zip(NewArgTypes, AccArgTypes)] end, - NewAccRet = t_sup(AccRet, t_inf(RetWithoutLocal, LocalRet, opaque)), + TotalRet = + case t_is_none(LocalRet) andalso t_is_unit(RetWithoutLocal) of + true -> RetWithoutLocal; + false -> t_inf(RetWithoutLocal, LocalRet, opaque) + end, + NewAccRet = t_sup(AccRet, TotalRet), + ?debug("NewAccRet: ~s\n", [t_to_string(NewAccRet)]), handle_apply_or_call(Left, Args, ArgTypes, Map, Tree, State3, NewAccArgTypes, NewAccRet); handle_apply_or_call([], Args, _ArgTypes, Map, _Tree, State, @@ -3109,6 +3115,7 @@ init_fun_tab([Fun|Left], Dict, TreeMap, Callgraph, Plt, Opaques) -> NewDict = dict:store(Fun, FunEntry, Dict), init_fun_tab(Left, NewDict, TreeMap, Callgraph, Plt, Opaques); init_fun_tab([], Dict, _TreeMap, _Callgraph, _Plt, _Opaques) -> + ?debug("DICT:~p\n",[dict:to_list(Dict)]), Dict. state__update_fun_env(Tree, Map, #state{envs = Envs} = State) -> @@ -3140,7 +3147,9 @@ state__fun_type(Fun, #state{fun_tab = FunTab}) -> if is_integer(Fun) -> Fun; true -> get_label(Fun) end, - case dict:find(Label, FunTab) of + Entry = dict:find(Label, FunTab), + ?debug("FunType ~p:~p\n",[Label, Entry]), + case Entry of {ok, {not_handled, {A, R}}} -> t_fun(A, R); {ok, {A, R}} -> @@ -3248,6 +3257,7 @@ state__fun_info(Fun, #state{callgraph = CG, fun_tab = FunTab, plt = PLT}) -> {not_handled, {_Args, Ret}} -> Ret; {_Args, Ret} -> Ret end, + ?debug("LocalRet: ~s\n", [t_to_string(LocalRet)]), {Fun, Sig, Contract, LocalRet}. state__find_apply_return(Tree, #state{callgraph = Callgraph} = State) -> diff --git a/lib/dialyzer/test/small_SUITE_data/src/maybe_servers.erl b/lib/dialyzer/test/small_SUITE_data/src/maybe_servers.erl new file mode 100644 index 0000000000..237f43b1a6 --- /dev/null +++ b/lib/dialyzer/test/small_SUITE_data/src/maybe_servers.erl @@ -0,0 +1,31 @@ +-module(maybe_servers). + +-export([maybe_server/2, mirror_maybe_server/2]). + +maybe_server(O, I) -> + case O of + no -> + maybe_loop(fun(_) -> fin end, I); + yes -> + maybe_loop(fun(X) -> {ok, X} end, I) + end. + +maybe_loop(F, X)-> + case F(X) of + {ok, Y} -> maybe_loop(F, Y); + fin -> exit(n) + end. + +mirror_maybe_loop(F, X)-> + case F(X) of + {ok, Y} -> mirror_maybe_loop(F, Y); + fin -> exit(n) + end. + +mirror_maybe_server(O, I) -> + case O of + no -> + mirror_maybe_loop(fun(_) -> fin end, I); + yes -> + mirror_maybe_loop(fun(X) -> {ok, X} end, I) + end. -- cgit v1.2.3