Lines Matching full:scan
5 <title>scan-build: running the analyzer from the command line</title>
17 <h1>scan-build: running the analyzer from the command line</h1>
23 <p><b>scan-build</b> is a command line utility that enables a user to run the
35 <p><b>scan-build</b> has little or no knowledge about how you build your code.
44 the best use of <b>scan-build</b>, which includes getting it to work when the
49 <img src="images/scan_build_cmd.png" width="450px" alt="scan-build"><br>
62 <li><a href="#scanbuild_output">Output of scan-build</a></li>
68 <li><a href="#recommended_verbose">Use Verbose Output when Debugging scan-build</a></li>
69 <li><a href="#recommended_autoconf">Run './configure' through scan-build</a></li>
77 <p>The <tt>scan-build</tt> command can be used to analyze an entire project by
79 analyzer using <tt>scan-build</tt>, you will use <tt>scan-build</tt> to analyze
85 <p>Basic usage of <tt>scan-build</tt> is designed to be simple: just place the
86 word "scan-build" in front of your build command:</p>
89 $ <span class="code_highlight">scan-build</span> make
90 $ <span class="code_highlight">scan-build</span> xcodebuild
93 <p>In the first case <tt>scan-build</tt> analyzes the code of a project built
94 with <tt>make</tt> and in the second case <tt>scan-build</tt> analyzes a project
97 <p>Here is the general format for invoking <tt>scan-build</tt>:</p>
100 $ <span class="code_highlight">scan-build</span> <i>[scan-build options]</i> <span class="code_highlight"><command></span> <i>[command options]</i>
103 <p>Operationally, <tt>scan-build</tt> literally runs <command> with all of the
108 $ scan-build make <span class="code_highlight">-j4</span>
111 <p>In almost all cases, <tt>scan-build</tt> makes no effort to interpret the
113 <tt>scan-build</tt> should support parallel builds, but <b>not distributed
116 <p>It is also possible to use <tt>scan-build</tt> to analyze specific
120 $ scan-build gcc -c <span class="code_highlight">t1.c t2.c</span>
128 <p>Windows users must have Perl installed to use scan-build. Currently scan-build
131 <p>scan-build.bat script allows you to launch scan-build in the same way as it described in the Basic Usage section above.
132 All you need to be able to invoke scan-build from an arbitrary location is to add the path to scan-build to your PATH environment variable.</p>
136 <p>As mentioned above, extra options can be passed to <tt>scan-build</tt>. These
140 $ scan-build <span class="code_highlight">-k -V</span> make
141 $ scan-build <span class="code_highlight">-k -V</span> xcodebuild
156 <tt>scan-build</tt> options.</td></tr>
163 <tr><td><b>-v</b></td><td>Verbose output from scan-build and the analyzer. <b>A
171 <b>--use-analyzer [path to clang]</b></td><td><tt>scan-build</tt> uses the
176 <p>A complete list of options can be obtained by running <tt>scan-build</tt>
179 <h3 id="scanbuild_output">Output of scan-build</h3>
182 The output of scan-build is a set of HTML files, each one which represents a
190 <tt>scan-build</tt>. If <b>-o</b> isn't specified, a directory in <tt>/tmp</tt>
191 is created to store the files (<tt>scan-build</tt> will print a message telling
193 completes, pass <b>-V</b> to <tt>scan-build</tt>.
208 <h3 id="recommend_verbose">Use verbose output when debugging scan-build</h3>
210 <p><tt>scan-build</tt> takes a <b>-v</b> option to emit verbose output about
212 output of <tt>scan-build</tt> to a text file (make sure to redirect standard
213 error) is useful for filing bug reports against <tt>scan-build</tt> or the
217 <h3 id="recommended_autoconf">Run './configure' through scan-build</h3>
221 <tt>scan-build</tt> in order to analyze the project.</p>
226 $ scan-build ./configure
227 $ scan-build make
231 <tt>scan-build</tt> is because <tt>scan-build</tt> scans your source files by
233 <tt>scan-build</tt> temporarily setting the environment variable <tt>CC</tt> to
240 <tt>scan-build</tt> that path is set to <tt>ccc-analyzer</tt>.</p>
250 <p>To analyze a project, <tt>scan-build</tt> simply sets the environment variable
263 <tt>scan-build</tt> so that configure sets up the location of <tt>CC</tt> based
264 on the environment passed in from <tt>scan-build</tt>:
267 $ scan-build <b>./configure</b>
270 <p><tt>scan-build</tt> has special knowledge about <tt>configure</tt>, so it in
284 their cousins for desktop applications. <b>scan-build</b> can analyze these
301 <h3>Using scan-build directly</h3>
303 <p>If you wish to use <b>scan-build</b> with your iPhone project, keep the
318 <b>scan-build</b> in the following manner from the command line:</p>
321 $ scan-build xcodebuild -configuration Debug -sdk iphonesimulator2.2
327 $ scan-build xcodebuild -configuration Debug -sdk iphonesimulator3.0
332 <p>Recall that <b>scan-build</b> analyzes your project by using a compiler to
336 iPhone projects, <b>scan-build</b> may pick the wrong compiler than the one
341 <p>When compiling your application to run on the simulator, it is important that <b>scan-build</b>
343 errors that only happen when you run <tt>scan-build</tt>.
345 <p><b>scan-build</b> provides the <tt>--use-cc</tt> and <tt>--use-c++</tt>
346 options to hardwire which compiler scan-build should use for building your code.
352 just running <tt>xcodebuild</tt> (without <b>scan-build</b>). You should see the