How to perform parallel static analysis in scan-build?

Hi,

I am running scan-build on 1300 source files. My scan-build is like this:

% scan-build make -j10 <my_target>

I understand the “make -j10” makes the build phase parallel. However, how do I make the static analysis/html report generation phase parallel as well? Is there such an option in scan-build to do that? I searched the scan-build documentation but could not find such an option. It seems by default, scan-build performs static analysis/html report generation phase in serial mode.

Thanks,

-Eric Feng

Using make -jN is enough to cause the static analyzer to run in parallel as well. This is because scan-build uses environment variable interposition to replace CC with its own script that pretends to be the compiler. The script first builds each source file with the real compiler and then immediately analyzes it. This means that if ‘make' calls the compiler in parallel on a given set of translation units (which it does with -jN) then the static analyzer will also analyze those translation units in parallel.

For example, when using scan-build to analyze openssl-1.0.0d with ‘make -j10’ I see between 4 and 11 analysis processes running concurrently with ‘ps’.

Devin

Thank you very much, Devin. You are right: using make -jN does make static analyzer to run in parallel too. -Eric