1
%% ``The contents of this file are subject to the Erlang Public License,
2
%% Version 1.1, (the "License"); you may not use this file except in
3
%% compliance with the License. You should have received a copy of the
4
%% Erlang Public License along with this software. If not, it can be
5
%% retrieved via the world wide web at http://www.erlang.org/.
7
%% Software distributed under the License is distributed on an "AS IS"
8
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
9
%% the License for the specific language governing rights and limitations
12
%% Copyright 2006, Tobias Lindahl and Kostis Sagonas
17
%%% -*- erlang-indent-level: 2 -*-
18
%%%-------------------------------------------------------------------
19
%%% File : dialyzer_options.erl
20
%%% Authors : Richard Carlsson <richardc@csd.uu.se>
21
%%% Description : Provides a better way to start Dialyzer from a script.
23
%%% Created : 17 Oct 2004 by Richard Carlsson <richardc@csd.uu.se>
24
%%%-------------------------------------------------------------------
25
-module(dialyzer_options).
29
-include("dialyzer.hrl").
30
-include("hipe_icode_type.hrl").
33
DefaultWarns = [?WARN_RETURN_NO_RETURN,
35
?WARN_NON_PROPER_LIST,
44
build_options(Opts, #options{legal_warnings=ordsets:from_list(DefaultWarns)}).
46
build_options([Term={OptionName,Value}|Rest], Options) ->
49
build_options(Rest, Options#options{files=Value});
51
build_options(Rest, Options#options{files_rec=Value});
53
build_options(Rest, Options#options{core_transform=Value});
55
build_options(Rest, Options#options{defines=ordsets:from_list(Value)});
57
build_options(Rest, Options#options{from=Value});
59
build_options(Rest, Options#options{init_plt=Value});
61
build_options(Rest, Options#options{include_dirs=Value});
63
build_options(Rest, Options#options{output_file=Value});
65
build_options(Rest, Options#options{output_plt=Value});
68
[] -> build_options(Rest, Options);
69
_ -> build_options(Rest, Options#options{plt_libs=Value})
72
build_options(Rest, Options#options{supress_inline=Value});
74
NewWarnings = build_warnings(Value, Options#options.legal_warnings),
75
build_options(Rest, Options#options{legal_warnings=NewWarnings});
79
build_options([Term|_Rest], _Options) ->
81
build_options([], Options) ->
85
report("error building dialyzer options: ~P.\n",[Term,15]),
89
build_warnings([Opt|Left], Warnings) ->
93
ordsets:del_element(?WARN_RETURN_NO_RETURN, Warnings);
95
ordsets:del_element(?WARN_NOT_CALLED, Warnings);
97
ordsets:del_element(?WARN_NON_PROPER_LIST, Warnings);
99
ordsets:del_element(?WARN_TUPLE_AS_FUN, Warnings);
101
ordsets:del_element(?WARN_FUN_APP, Warnings);
103
ordsets:del_element(?WARN_MATCHING, Warnings);
105
ordsets:del_element(?WARN_COMP, Warnings);
107
ordsets:del_element(?WARN_GUARDS, Warnings);
109
ordsets:del_element(?WARN_OLD_BEAM, Warnings);
111
ordsets:del_element(?WARN_FAILING_CALL, Warnings);
113
ordsets:add_element(?WARN_RETURN_ONLY_EXIT, Warnings);
117
build_warnings(Left, NewWarnings);
118
build_warnings([], Warnings) ->