shijiang1130 发表于 2015-03-10 21:49

【dialyzer】 win7

Erlang的类型系统

shijiang1130 发表于 2015-03-10 21:51

Creating PLT c:/Users/Administrator/Desktop/.dialyzer_plt ...
Unknown functions:
compile:file/2
compile:forms/2
compile:noenv_forms/2
compile:output_generated/1
crypto:block_decrypt/4
crypto:start/0
Unknown types:
compile:option/0
done in 3m1.35s
done (passed successfully)

shijiang1130 发表于 2015-03-10 21:52

通过dialyzer我们可能用来检测我们的程序

shijiang1130 发表于 2015-03-10 21:53

-date... yes
Proceeding with analysis...
validate.erl:27: Call to missing or unexported function io:f/0
Unknown functions:
crypto:sha/1
done in 0m0.70s
done (warnings were emitted)

shijiang1130 发表于 2015-03-10 21:56

同样的还有typertyper: Analysis failed with error report:
v.erl:3: can't find include lib "include/v.hrl"
v.erl:4: can't find include lib "include/s.hrl"

shijiang1130 发表于 2015-03-10 21:58

D:\program\erlang>typer --help
Usage: typer [--help] [--version] [--plt PLT] [--edoc]
            [--show | --show-exported | --annotate | --annotate-inc-files]
            [-Ddefine]* [-I include_dir]* [-pa dir]* [-pz dir]*
            [-T application]* [-r] file*

Options:
   -r dir*
       search directories recursively for .erl files below them
   --show
       Prints type specifications for all functions on stdout.
       (this is the default behaviour; this option is not really needed)
   --show-exported (or --show_exported)
       Same as --show, but prints specifications for exported functions only
       Specs are displayed sorted alphabetically on the function's name
   --annotate
       Annotates the specified files with type specifications
   --annotate-inc-files
       Same as --annotate but annotates all -include() files as well as
       all .erl files (use this option with caution - has not been tested much)
   --edoc
       Prints type information as Edoc @spec comments, not as type specs
   --plt PLT
       Use the specified dialyzer PLT file rather than the default one
   -T file*
       The specified file(s) already contain type specifications and these
       are to be trusted in order to print specs for the rest of the files
       (Multiple files or dirs, separated by spaces, can be specified.)
   -Dname (or -Dname=value)
       pass the defined name(s) to TypEr
       (The syntax of defines is the same as that used by "erlc".)
   -I include_dir
       pass the include_dir to TypEr
       (The syntax of includes is the same as that used by "erlc".)
   -pa dir
   -pz dir
       Set code path options to TypEr
       (This is useful for files that use parse tranforms.)
   --version (or -v)
       prints the Typer version and exits
   --help (or -h)
       prints this message and exits

Note:
   * denotes that multiple occurrences of these options are possible.

shijiang1130 发表于 2015-03-10 21:59

Usage: dialyzer [--help] [--version] [--shell] [--quiet] [--verbose]
                [-pa dir]* [--plt plt] [--plts plt*] [-Ddefine]*
                [-I include_dir]* [--output_plt file] [-Wwarn]* [--raw]
                [--src] [--gui] [-r dirs]
                [--apps applications] [-o outfile]
                [--build_plt] [--add_to_plt] [--remove_from_plt]
                [--check_plt] [--no_check_plt] [--plt_info] [--get_warnings]
                [--dump_callgraph file] [--no_native] [--fullpath]
                [--statistics]
Options:
files_or_dirs (for backwards compatibility also as: -c files_or_dirs)
      Use Dialyzer from the command line to detect defects in the
      specified files or directories containing .erl or .beam files,
      depending on the type of the analysis.
-r dirs
      Same as the previous but the specified directories are searched
      recursively for subdirectories containing .erl or .beam files in
      them, depending on the type of analysis.
--apps applications
      Option typically used when building or modifying a plt as in:
      dialyzer --build_plt --apps erts kernel stdlib mnesia ...
      to conveniently refer to library applications corresponding to the
      Erlang/OTP installation. However, the option is general and can also
      be used during analysis in order to refer to Erlang/OTP applications.
      In addition, file or directory names can also be included, as in:
      dialyzer --apps inets ssl ./ebin ../other_lib/ebin/my_module.beam
-o outfile (or --output outfile)
      When using Dialyzer from the command line, send the analysis
      results to the specified outfile rather than to stdout.
--raw
      When using Dialyzer from the command line, output the raw analysis
      results (Erlang terms) instead of the formatted result.
      The raw format is easier to post-process (for instance, to filter
      warnings or to output HTML pages).
--src
      Override the default, which is to analyze BEAM files, and
      analyze starting from Erlang source code instead.
-Dname (or -Dname=value)
      When analyzing from source, pass the define to Dialyzer. (**)
-I include_dir
      When analyzing from source, pass the include_dir to Dialyzer. (**)
-pa dir
      Include dir in the path for Erlang (useful when analyzing files
      that have '-include_lib()' directives).
--output_plt file
      Store the plt at the specified file after building it.
--plt plt
      Use the specified plt as the initial plt (if the plt was built
      during setup the files will be checked for consistency).
--plts plt*
      Merge the specified plts to create the initial plt -- requires
      that the plts are disjoint (i.e., do not have any module
      appearing in more than one plt).
      The plts are created in the usual way:
      dialyzer --build_plt --output_plt plt_1 files_to_include
      ...
      dialyzer --build_plt --output_plt plt_n files_to_include
      and then can be used in either of the following ways:
      dialyzer files_to_analyze --plts plt_1 ... plt_n
      or:
      dialyzer --plts plt_1 ... plt_n -- files_to_analyze
      (Note the -- delimiter in the second case)
-Wwarn
      A family of options which selectively turn on/off warnings
      (for help on the names of warnings use dialyzer -Whelp).
--shell
      Do not disable the Erlang shell while running the GUI.
--version (or -v)
      Print the Dialyzer version and some more information and exit.
--help (or -h)
      Print this message and exit.
--quiet (or -q)
      Make Dialyzer a bit more quiet.
--verbose
      Make Dialyzer a bit more verbose.
--statistics
      Prints information about the progress of execution (analysis phases,
      time spent in each and size of the relative input).
--build_plt
      The analysis starts from an empty plt and creates a new one from the
      files specified with -c and -r. Only works for beam files.
      Use --plt(s) or --output_plt to override the default plt location.
--add_to_plt
      The plt is extended to also include the files specified with -c and -r.
      Use --plt(s) to specify which plt to start from, and --output_plt to
      specify where to put the plt. Note that the analysis might include
      files from the plt if they depend on the new files.
      This option only works with beam files.
--remove_from_plt
      The information from the files specified with -c and -r is removed
      from the plt. Note that this may cause a re-analysis of the remaining
      dependent files.
--check_plt
      Check the plt for consistency and rebuild it if it is not up-to-date.
      Actually, this option is of rare use as it is on by default.
--no_check_plt (or -n)
      Skip the plt check when running Dialyzer. Useful when working with
      installed plts that never change.
--plt_info
      Make Dialyzer print information about the plt and then quit. The plt
      can be specified with --plt(s).
--get_warnings
      Make Dialyzer emit warnings even when manipulating the plt. Warnings
      are only emitted for files that are actually analyzed.
--dump_callgraph file
      Dump the call graph into the specified file whose format is determined
      by the file name extension. Supported extensions are: raw, dot, and ps.
      If something else is used as file name extension, default format '.raw'
      will be used.
--no_native (or -nn)
      Bypass the native code compilation of some key files that Dialyzer
      heuristically performs when dialyzing many files; this avoids the
      compilation time but it may result in (much) longer analysis time.
--fullpath
      Display the full path names of files for which warnings are emitted.
--gui
      Use the GUI.

Note:
* denotes that multiple occurrences of these options are possible.
** options -D and -I work both from command-line and in the Dialyzer GUI;
    the syntax of defines and includes is the same as that used by "erlc".

Warning options:
-Wno_return
   Suppress warnings for functions that will never return a value.
-Wno_unused
   Suppress warnings for unused functions.
-Wno_improper_lists
   Suppress warnings for construction of improper lists.
-Wno_fun_app
   Suppress warnings for fun applications that will fail.
-Wno_match
   Suppress warnings for patterns that are unused or cannot match.
-Wno_opaque
   Suppress warnings for violations of opaqueness of data types.
-Wno_fail_call
   Suppress warnings for failing calls.
-Wno_contracts
   Suppress warnings about invalid contracts.
-Wno_behaviours
   Suppress warnings about behaviour callbacks which drift from the published
   recommended interfaces.
-Wno_undefined_callbacks
   Suppress warnings about behaviours that have no -callback attributes for
   their callbacks.
-Wunmatched_returns ***
   Include warnings for function calls which ignore a structured return
   value or do not match against one of many possible return value(s).
-Werror_handling ***
   Include warnings for functions that only return by means of an exception.
-Wrace_conditions ***
   Include warnings for possible race conditions.
-Wunderspecs ***
   Warn about underspecified functions
   (those whose -spec is strictly more allowing than the success typing).

The following options are also available but their use is not recommended:
(they are mostly for Dialyzer developers and internal debugging)
-Woverspecs ***
   Warn about overspecified functions
   (those whose -spec is strictly less allowing than the success typing).
-Wspecdiffs ***
   Warn when the -spec is different than the success typing.

*** Identifies options that turn on warnings rather than turning them off.

The exit status of the command line version is:
0 - No problems were encountered during the analysis and no
      warnings were emitted.
1 - Problems were encountered during the analysis.
2 - No problems were encountered, but warnings were emitted.
页: [1]
查看完整版本: 【dialyzer】 win7