首页 > 代码库 > scan-build static analyze help

scan-build static analyze help

USAGE: scan-build [options] <build command> [build options]

ANALYZER BUILD: checker-275 (2013-05-23 17:38:31)

OPTIONS:

-analyze-headers

Also analyze functions in #included files. By default, such functions
are skipped unless they are called by functions within the main source file.

-o <output location>

Specifies the output directory for analyzer reports. Subdirectories will be
created as needed to represent separate "runs" of the analyzer. If this
option is not specified, a directory is created in /tmp (TMPDIR on Mac OS X)
to store the reports.

-h
--help

Display this message.

-k
--keep-going

Add a "keep on going" option to the specified build command. This option
currently supports make and xcodebuild. This is a convenience option; one
can specify this behavior directly using build options.

--html-title [title]
--html-title=[title]

Specify the title used on generated HTML pages. If not specified, a default
title will be used.

-plist

By default the output of scan-build is a set of HTML files. This option
outputs the results as a set of .plist files.

-plist-html

By default the output of scan-build is a set of HTML files. This option
outputs the results as a set of HTML and .plist files.

--status-bugs

By default, the exit status of scan-build is the same as the executed build
command. Specifying this option causes the exit status of scan-build to be 1
if it found potential bugs and 0 otherwise.

--use-cc [compiler path]
--use-cc=[compiler path]

scan-build analyzes a project by interposing a "fake compiler", which
executes a real compiler for compilation and the static analyzer for analysis.
Because of the current implementation of interposition, scan-build does not
know what compiler your project normally uses. Instead, it simply overrides
the CC environment variable, and guesses your default compiler.

In the future, this interposition mechanism to be improved, but if you need
scan-build to use a specific compiler for *compilation* then you can use
this option to specify a path to that compiler.

--use-c++ [compiler path]
--use-c++=[compiler path]

This is the same as "-use-cc" but for C++ code.

-v

Enable verbose output from scan-build. A second and third ‘-v‘ increases
verbosity.

-V
--view

View analysis results in a web browser when the build completes.

ADVANCED OPTIONS:

-no-failure-reports

Do not create a ‘failures‘ subdirectory that includes analyzer crash reports
and preprocessed source files.

-stats

Generates visitation statistics for the project being analyzed.

-maxloop <loop count>

Specifiy the number of times a block can be visited before giving up.
Default is 4. Increase for more comprehensive coverage at a cost of speed.

-internal-stats

Generate internal analyzer statistics.

--use-analyzer [Xcode|path to clang]
--use-analyzer=[Xcode|path to clang]

scan-build uses the ‘clang‘ executable relative to itself for static
analysis. One can override this behavior with this option by using the
‘clang‘ packaged with Xcode (on OS X) or from the PATH.

--keep-empty

Don‘t remove the build results directory even if no issues were reported.

CONTROLLING CHECKERS:

A default group of checkers are always run unless explicitly disabled.
Checkers may be enabled/disabled using the following options:

-enable-checker [checker name]
-disable-checker [checker name]

LOADING CHECKERS:

Loading external checkers using the clang plugin interface:

-load-plugin [plugin library]
*** Could not query Clang for the list of available checkers.
BUILD OPTIONS

You can specify any build option acceptable to the build command.

EXAMPLE

scan-build -o /tmp/myhtmldir make -j4

The above example causes analysis reports to be deposited into a subdirectory
of "/tmp/myhtmldir" and to run "make" with the "-j4" option. A different
subdirectory is created each time scan-build analyzes a project. The analyzer
should support most parallel builds, but not distributed builds.