Sophie

Sophie

distrib > Fedora > 17 > i386 > media > updates > by-pkgid > 675c8c8167236dfcf8d66da674f931e8 > files > 509

erlang-doc-R15B-03.3.fc17.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns:fn="http://www.w3.org/2005/02/xpath-functions">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../../doc/otp_doc.css" type="text/css">
<title>Erlang -- dialyzer</title>
</head>
<body bgcolor="white" text="#000000" link="#0000ff" vlink="#ff00ff" alink="#ff0000"><div id="container">
<script id="js" type="text/javascript" language="JavaScript" src="../../../../doc/js/flipmenu/flipmenu.js"></script><script id="js2" type="text/javascript" src="../../../../doc/js/erlresolvelinks.js"></script><script language="JavaScript" type="text/javascript">
            <!--
              function getWinHeight() {
                var myHeight = 0;
                if( typeof( window.innerHeight ) == 'number' ) {
                  //Non-IE
                  myHeight = window.innerHeight;
                } else if( document.documentElement && ( document.documentElement.clientWidth ||
                                                         document.documentElement.clientHeight ) ) {
                  //IE 6+ in 'standards compliant mode'
                  myHeight = document.documentElement.clientHeight;
                } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
                  //IE 4 compatible
                  myHeight = document.body.clientHeight;
                }
                return myHeight;
              }

              function setscrollpos() {
                var objf=document.getElementById('loadscrollpos');
                 document.getElementById("leftnav").scrollTop = objf.offsetTop - getWinHeight()/2;
              }

              function addEvent(obj, evType, fn){
                if (obj.addEventListener){
                obj.addEventListener(evType, fn, true);
                return true;
              } else if (obj.attachEvent){
                var r = obj.attachEvent("on"+evType, fn);
                return r;
              } else {
                return false;
              }
             }

             addEvent(window, 'load', setscrollpos);

             //--></script><div id="leftnav"><div class="innertube">
<img alt="Erlang logo" src="../../../../doc/erlang-logo.png"><br><small><a href="users_guide.html">User's Guide</a><br><a href="index.html">Reference Manual</a><br><a href="release_notes.html">Release Notes</a><br><a href="../pdf/dialyzer-2.5.3.pdf">PDF</a><br><a href="../../../../doc/index.html">Top</a></small><p><strong>Dialyzer</strong><br><strong>Reference Manual</strong><br><small>Version 2.5.3</small></p>
<br><a href="javascript:openAllFlips()">Expand All</a><br><a href="javascript:closeAllFlips()">Contract All</a><p><small><strong>Table of Contents</strong></small></p>
<ul class="flipMenu"><li id="loadscrollpos" title="dialyzer " expanded="true">dialyzer<ul>
<li><a href="dialyzer.html">
                  Top of manual page
                </a></li>
<li title="gui-0"><a href="dialyzer.html#gui-0">gui/0</a></li>
<li title="gui-1"><a href="dialyzer.html#gui-1">gui/1</a></li>
<li title="run-1"><a href="dialyzer.html#run-1">run/1</a></li>
<li title="format_warning-1"><a href="dialyzer.html#format_warning-1">format_warning/1</a></li>
<li title="plt_info-1"><a href="dialyzer.html#plt_info-1">plt_info/1</a></li>
</ul>
</li></ul>
</div></div>
<div id="content">
<div class="innertube">
<!-- refpage --><center><h1>dialyzer</h1></center>
  
  <h3>MODULE</h3>
<div class="REFBODY">dialyzer</div>
  <h3>MODULE SUMMARY</h3>
<div class="REFBODY">The Dialyzer, a DIscrepancy AnalYZer for ERlang programs</div>
  <h3>DESCRIPTION</h3>
<div class="REFBODY"><p>
    <p>The Dialyzer is a static analysis tool that identifies software
    discrepancies such as definite type errors, code which has become
    dead or unreachable due to some programming error, unnecessary
    tests, etc. in single Erlang modules or entire (sets of)
    applications. Dialyzer starts its analysis from either
    debug-compiled BEAM bytecode or from Erlang source code. The file
    and line number of a discrepancy is reported along with an
    indication of what the discrepancy is about. Dialyzer bases its
    analysis on the concept of success typings which allows for sound
    warnings (no false positives).</p>
    <p>Read more about Dialyzer and about how to use it from the GUI
    in <span class="bold_code"><a href="dialyzer_chapter.html">Dialyzer User's
    Guide</a></span>.</p>
  </p></div>

  <h3><a name="id60157">Using the Dialyzer from the command line</a></h3>
<div class="REFBODY">
    
    <p>Dialyzer also has a command line version for automated use. Below is a
      brief description of the list of its options. The same information can
      be obtained by writing</p>
    <div class="example"><pre>
      dialyzer --help
    </pre></div>
    <p>in a shell. Please refer to the GUI description for more details on
      the operation of Dialyzer.</p>
    <p>The exit status of the command line version is:</p>
    <div class="example"><pre>
      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.
    </pre></div>
    <p>Usage:</p>
    <div class="example"><pre>
       dialyzer [--help] [--version] [--shell] [--quiet] [--verbose]
		[-pa dir]* [--plt plt] [--plts plt*] [-Ddefine]*
                [-I include_dir]* [--output_plt file] [-Wwarn]*
                [--src] [--gui | --wx] [files_or_dirs] [-r dirs]
                [--apps applications] [-o outfile]
		[--build_plt] [--add_to_plt] [--remove_from_plt]
		[--check_plt] [--no_check_plt] [--plt_info] [--get_warnings]
                [--no_native] [--fullpath]
    </pre></div>
    <p>Options:</p>
    <dl>
      <dt><strong><span class="code">files_or_dirs</span> (for backwards compatibility also
        as: <span class="code">-c files_or_dirs</span></strong></dt>
      <dd>Use Dialyzer from the command line to detect defects in the
        specified files or directories containing <span class="code">.erl</span> or
         <span class="code">.beam</span> files, depending on the type of the
         analysis.</dd>
      <dt><strong><span class="code">-r dirs</span></strong></dt>
      <dd>Same as the previous but the specified directories are searched
        recursively for subdirectories containing <span class="code">.erl</span> or
        <span class="code">.beam</span> files in them, depending on the type of
        analysis.</dd>
      <dt><strong><span class="code">--apps applications</span></strong></dt>
      <dd>Option typically used when building or modifying a plt as in:
        <div class="example"><pre>
           dialyzer --build_plt --apps erts kernel stdlib mnesia ...
        </pre></div>
        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:
        <div class="example"><pre>
           dialyzer --apps inets ssl ./ebin ../other_lib/ebin/my_module.beam
        </pre></div>
</dd>
      <dt><strong><span class="code">-o outfile</span> (or
        <span class="code">--output outfile</span>)</strong></dt>
      <dd>When using Dialyzer from the command line, send the analysis
        results to the specified outfile rather than to stdout.</dd>
      <dt><strong><span class="code">--raw</span></strong></dt>
      <dd>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).</dd>
      <dt><strong><span class="code">--src</span></strong></dt>
      <dd>Override the default, which is to analyze BEAM files, and
        analyze starting from Erlang source code instead.</dd>
      <dt><strong><span class="code">-Dname</span> (or <span class="code">-Dname=value</span>)</strong></dt>
      <dd>When analyzing from source, pass the define to Dialyzer. (**)</dd>
      <dt><strong><span class="code">-I include_dir</span></strong></dt>
      <dd>When analyzing from source, pass the <span class="code">include_dir</span>
        to Dialyzer. (**)</dd>
      <dt><strong><span class="code">-pa dir</span></strong></dt>
      <dd>Include <span class="code">dir</span> in the path for Erlang (useful when
        analyzing files that have <span class="code">'-include_lib()'</span>
        directives).</dd>
      <dt><strong><span class="code">--output_plt file</span></strong></dt>
      <dd>Store the plt at the specified file after building it.</dd>
      <dt><strong><span class="code">--plt plt</span></strong></dt>
      <dd>Use the specified plt as the initial plt (if the plt was built
        during setup the files will be checked for consistency).</dd>
      <dt><strong><span class="code">--plts plt*</span></strong></dt>
      <dd>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:
        <div class="example"><pre>
           dialyzer --build_plt --output_plt plt_1 files_to_include
           ...
           dialyzer --build_plt --output_plt plt_n files_to_include
        </pre></div>
        and then can be used in either of the following ways:
        <div class="example"><pre>
           dialyzer files_to_analyze --plts plt_1 ... plt_n
        </pre></div>
        or:
        <div class="example"><pre>
           dialyzer --plts plt_1 ... plt_n -- files_to_analyze
        </pre></div>
        (Note the -- delimiter in the second case)</dd>
      <dt><strong><span class="code">-Wwarn</span></strong></dt>
      <dd>A family of options which selectively turn on/off warnings
        (for help on the names of warnings use
        <span class="code">dialyzer -Whelp</span>).</dd>
      <dt><strong><span class="code">--shell</span></strong></dt>
      <dd>Do not disable the Erlang shell while running the GUI.</dd>
      <dt><strong><span class="code">--version</span> (or <span class="code">-v</span>)</strong></dt>
      <dd>Print the Dialyzer version and some more information and
        exit.</dd>
      <dt><strong><span class="code">--help</span> (or <span class="code">-h</span>)</strong></dt>
      <dd>Print this message and exit.</dd>
      <dt><strong><span class="code">--quiet</span> (or <span class="code">-q</span>)</strong></dt>
      <dd>Make Dialyzer a bit more quiet.</dd>
      <dt><strong><span class="code">--verbose</span></strong></dt>
      <dd>Make Dialyzer a bit more verbose.</dd>
      <dt><strong><span class="code">--build_plt</span></strong></dt>
      <dd>The analysis starts from an empty plt and creates a new one from
        the files specified with <span class="code">-c</span> and
        <span class="code">-r</span>. Only works for beam files. Use
        <span class="code">--plt</span> or <span class="code">--output_plt</span> to
        override the default plt location.</dd>
       <dt><strong><span class="code">--add_to_plt</span></strong></dt>
       <dd>The plt is extended to also include the files specified with
         <span class="code">-c</span> and <span class="code">-r</span>. Use
         <span class="code">--plt</span> to specify which plt to start from,
         and <span class="code">--output_plt</span> 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.</dd>
       <dt><strong><span class="code">--remove_from_plt</span></strong></dt>
       <dd>The information from the files specified with
         <span class="code">-c</span> and <span class="code">-r</span> is removed
         from the plt. Note that this may cause a re-analysis of the remaining
         dependent files.</dd>
       <dt><strong><span class="code">--check_plt</span></strong></dt>
       <dd>Check the plt for consistency and rebuild it if it is not
         up-to-date.</dd>
       <dt><strong><span class="code">--no_check_plt</span></strong></dt>
       <dd>Skip the plt check when running Dialyzer. Useful when working with
         installed plts that never change.</dd>
       <dt><strong><span class="code">--plt_info</span></strong></dt>
       <dd>Make Dialyzer print information about the plt and then quit. The
         plt can be specified with <span class="code">--plt(s)</span>.</dd>
       <dt><strong><span class="code">--get_warnings</span></strong></dt>
       <dd>Make Dialyzer emit warnings even when manipulating the plt.
         Warnings are only emitted for files that are actually analyzed.</dd>
       <dt><strong><span class="code">--dump_callgraph file</span></strong></dt>
       <dd>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.</dd>
       <dt><strong><span class="code">--no_native</span> (or <span class="code">-nn</span>)</strong></dt>
       <dd>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.</dd>
       <dt><strong><span class="code">--fullpath</span></strong></dt>
       <dd>Display the full path names of files for which warnings are emitted.</dd>
       <dt><strong><span class="code">--gui</span></strong></dt>
       <dd>Use the gs-based GUI.</dd>
       <dt><strong><span class="code">--wx</span></strong></dt>
       <dd>Use the wx-based GUI.</dd>
    </dl>
    <div class="note">
<div class="label">Note</div>
<div class="content"><p>
      <p>* denotes that multiple occurrences of these options are possible.</p>
      <p>** options <span class="code">-D</span> and <span class="code">-I</span> work both from command-line and in the Dialyzer GUI;
        the syntax of defines and includes is the same as that used by <span class="code">erlc</span>.</p>
    </p></div>
</div>
    <p>Warning options:</p>
    <dl>
      <dt><strong><span class="code">-Wno_return</span></strong></dt>
      <dd>Suppress warnings for functions that will never return a
        value.</dd>
      <dt><strong><span class="code">-Wno_unused</span></strong></dt>
      <dd>Suppress warnings for unused functions.</dd>
      <dt><strong><span class="code">-Wno_improper_lists</span></strong></dt>
      <dd>Suppress warnings for construction of improper lists.</dd>
      <dt><strong><span class="code">-Wno_tuple_as_fun</span></strong></dt>
      <dd>Suppress warnings for using tuples instead of funs.</dd>
      <dt><strong><span class="code">-Wno_fun_app</span></strong></dt>
      <dd>Suppress warnings for fun applications that will fail.</dd>
      <dt><strong><span class="code">-Wno_match</span></strong></dt>
      <dd>Suppress warnings for patterns that are unused or cannot
       match.</dd>
      <dt><strong><span class="code">-Wno_opaque</span></strong></dt>
      <dd>Suppress warnings for violations of opaqueness of data types.</dd>
      <dt><strong><span class="code">-Wunmatched_returns</span>***</strong></dt>
      <dd>Include warnings for function calls which ignore a structured return
        value or do not match against one of many possible return
        value(s).</dd>
      <dt><strong><span class="code">-Werror_handling</span>***</strong></dt>
      <dd>Include warnings for functions that only return by means of an
       exception.</dd>
      <dt><strong><span class="code">-Wrace_conditions</span>***</strong></dt>
      <dd>Include warnings for possible race conditions.</dd>
      <dt><strong><span class="code">-Wbehaviours</span>***</strong></dt>
      <dd>Include warnings about behaviour callbacks which drift from the
       published recommended interfaces.</dd>
      <dt><strong><span class="code">-Wunderspecs</span>***</strong></dt>
      <dd>Warn about underspecified functions
      (the -spec is strictly more allowing than the success typing).</dd>
    </dl>
    <p>The following options are also available but their use is not
      recommended: (they are mostly for Dialyzer developers and internal
      debugging)</p>
    <dl>
      <dt><strong><span class="code">-Woverspecs</span>***</strong></dt>
      <dd>Warn about overspecified functions
      (the -spec is strictly less allowing than the success typing).</dd>
      <dt><strong><span class="code">-Wspecdiffs</span>***</strong></dt>
      <dd>Warn when the -spec is different than the success typing.</dd>
    </dl>
    <div class="note">
<div class="label">Note</div>
<div class="content"><p>
      <p>*** Identifies options that turn on warnings rather than
      turning them off.</p>
    </p></div>
</div>
  </div>

  <h3><a name="id61762">Using the Dialyzer from Erlang</a></h3>
<div class="REFBODY">
    
    <p>You can also use Dialyzer directly from Erlang. Both the GUI and the
      command line versions are available. The options are similar to the ones
      given from the command line, so please refer to the sections above for
      a description of these.</p>
  </div>
  <h3>EXPORTS</h3>
    <p><a name="gui-0"><span class="bold_code">gui() -&gt; ok | {error, Msg}</span></a><br><a name="gui-1"><span class="bold_code">gui(OptList) -&gt; ok | {error, Msg}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">OptList -- see below</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Dialyzer GUI version.</p>
        <div class="example"><pre>
OptList  :: [Option]
Option   :: {files,          [Filename :: string()]}
          | {files_rec,      [DirName :: string()]}
          | {defines,        [{Macro: atom(), Value : term()}]}
          | {from,           src_code | byte_code} %% Defaults to byte_code
          | {init_plt,       FileName :: string()}  %% If changed from default
          | {plts,           [FileName :: string()]} %% If changed from default
          | {include_dirs,   [DirName :: string()]}
          | {output_file,    FileName :: string()}
          | {output_plt,     FileName :: string()}
          | {analysis_type,  'succ_typings' | 'plt_add' | 'plt_build' | 'plt_check' | 'plt_remove'}
          | {warnings,       [WarnOpts]}
          | {get_warnings,   bool()}

WarnOpts :: no_return
          | no_unused
          | no_improper_lists
          | no_fun_app
          | no_match
          | no_opaque
          | no_fail_call
          | error_handling
          | race_conditions
          | behaviours
          | unmatched_returns
          | overspecs
          | underspecs
          | specdiffs
        </pre></div>
      </p></div>
    <p><a name="run-1"><span class="bold_code">run(OptList) -&gt; Warnings</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">OptList -- see gui/0,1</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Warnings -- see below </span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Dialyzer command line version.</p>
        <div class="example"><pre>
Warnings :: [{Tag, Id, Msg}]
Tag :: 'warn_return_no_exit' | 'warn_return_only_exit'
     | 'warn_not_called' | 'warn_non_proper_list'
     | 'warn_fun_app' | 'warn_matching'
     | 'warn_failing_call' | 'warn_contract_types'
     | 'warn_contract_syntax' | 'warn_contract_not_equal'
     | 'warn_contract_subtype' | 'warn_contract_supertype'
Id = {File :: string(), Line :: integer()}
Msg = msg() -- Undefined
</pre></div>
      </p></div>
    <p><a name="format_warning-1"><span class="bold_code">format_warning(Msg) -&gt; string()</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Msg = {Tag, Id, msg()} -- See run/1</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Get a string from warnings as returned by dialyzer:run/1.</p>
      </p></div>
    <p><a name="plt_info-1"><span class="bold_code">plt_info(string()) -&gt; {'ok', [{atom(), any()}]} | {'error', atom()}</span></a><br></p>
<div class="REFBODY"><p>
        <p>Returns information about the specified plt.</p>
      </p></div>
  
</div>
<div class="footer">
<hr>
<p>Copyright © 2006-2012 Ericsson AB. All Rights Reserved.</p>
</div>
</div>
</div></body>
</html>