diff options
-rwxr-xr-x | tools/scan-build/scan-build | 4 | ||||
-rw-r--r-- | www/analyzer/scan-build.html | 33 |
2 files changed, 18 insertions, 19 deletions
diff --git a/tools/scan-build/scan-build b/tools/scan-build/scan-build index dae86f4b5e..8b79c84ae5 100755 --- a/tools/scan-build/scan-build +++ b/tools/scan-build/scan-build @@ -967,11 +967,11 @@ OPTIONS: exit status of $Prog to be 1 if it found potential bugs and 0 otherwise. - --use-cc [compiler path] - By default, $Prog uses 'gcc' to compile and link + --use-cc [compiler path] - $Prog attempts to guess the default compiler for --use-cc=[compiler path] your C and Objective-C code. Use this option to specify an alternate compiler. - --use-c++ [compiler path] - By default, $Prog uses 'g++' to compile and link + --use-c++ [compiler path] - $Prog attempts to guess the default compiler for --use-c++=[compiler path] your C++ and Objective-C++ code. Use this option to specify an alternate compiler. diff --git a/www/analyzer/scan-build.html b/www/analyzer/scan-build.html index 6c2833e799..e257407d86 100644 --- a/www/analyzer/scan-build.html +++ b/www/analyzer/scan-build.html @@ -35,9 +35,9 @@ web browser.</p> <p><b>scan-build</b> has little or no knowledge about how you build your code. It works by overriding the <tt>CC</tt> and <tt>CXX</tt> environment variables to (hopefully) change your build to use a "fake" compiler instead of the -one that would normally build your project. By default, this fake compiler -executes <tt>gcc</tt> to compile your code (assuming that <tt>gcc</tt> is your -compiler) and then executes the static analyzer to analyze your code.</p> +one that would normally build your project. This fake compiler executes either +<tt>clang</tt> or <tt>gcc</tt> (depending on the platform) to compile your +code and then executes the static analyzer to analyze your code.</p> <p>This "poor man's interposition" works amazingly well in many cases and falls down in others. Please consult the information on this page on making @@ -77,8 +77,8 @@ aforementioned hack fails to work.</p> <p>The <tt>scan-build</tt> command can be used to analyze an entire project by essentially interposing on a project's build process. This means that to run the analyzer using <tt>scan-build</tt>, you will use <tt>scan-build</tt> to analyze -the source files compiled by <tt>gcc</tt> during a project build. This means -that any files that are not compiled will also not be analyzed.</p> +the source files compiled by <tt>gcc</tt>/<tt>clang</tt> during a project build. +This means that any files that are not compiled will also not be analyzed.</p> <h3 id="scanbuild_basicusage">Basic Usage</h3> @@ -217,7 +217,7 @@ $ scan-build make <i>interposing</i> on the compiler. This interposition is currently done by <tt>scan-build</tt> temporarily setting the environment variable <tt>CC</tt> to <tt>ccc-analyzer</tt>. The program <tt>ccc-analyzer</tt> acts like a fake -compiler, forwarding its command line arguments over to <tt>gcc</tt> to perform +compiler, forwarding its command line arguments over to the compiler to perform regular compilation and <tt>clang</tt> to perform static analysis.</p> <p>Running <tt>configure</tt> typically generates makefiles that have hardwired @@ -314,18 +314,17 @@ $ scan-build xcodebuild -configuration Debug -sdk iphonesimulator3.0 <h3>Gotcha: using the right compiler</h3> -<p>Recall that <b>scan-build</b> analyzes your project by using <tt>gcc</tt> to -compile the project and <tt>clang</tt> to analyze your project. When analyzing +<p>Recall that <b>scan-build</b> analyzes your project by using a compiler to +compile the project and <tt>clang</tt> to analyze your project. The script uses +simple heuristics to determine which compiler should be used (it defaults to +<tt>clang</tt> on Darwin and <tt>gcc</tt> on other platforms). When analyzing iPhone projects, <b>scan-build</b> may pick the wrong compiler than the one -Xcode would use to build your project. This is because multiple versions of -<tt>gcc</tt> may be installed on your system, especially if you are developing -for the iPhone.</p> - -<p>Where this particularly might be a problem is if you are using Mac OS 10.5 -(Leopard) to develop for iPhone OS 3.0. The default desktop compiler on Leopard -is gcc-4.0, while the compiler for iPhone OS 3.0 is gcc-4.2. When compiling your -application to run on the simulator, it is important that <b>scan-build</b> -finds the correct version of <tt>gcc</tt>. Otherwise, you may see strange build +Xcode would use to build your project. For example, this could be because +multiple versions of a compiler may be installed on your system, especially if +you are developing for the iPhone.</p> + +<p>When compiling your application to run on the simulator, it is important that <b>scan-build</b> +finds the correct version of <tt>gcc/clang</tt>. Otherwise, you may see strange build errors that only happen when you run <tt>scan-build</tt>. <p><b>scan-build</b> provides the <tt>--use-cc</tt> and <tt>--use-c++</tt> |