<p dir="ltr"><br>
On May 30, 2013 5:55 AM, "Robert Henry" <<a href="mailto:rrh@newrelic.com">rrh@newrelic.com</a>> wrote:<br>
><br>
> I have two source files each of which is analyzed independently<br>
> without error by scan-build.  However, the combination of the 2 files<br>
> should trigger a complaint from scan-build, assuming scan-build has<br>
> inter-procedural analysis spanning the two compilation units.</p>
<p dir="ltr">That assumption would be incorrect. The Clang Static Analyzer has no cross-TU power at the moment.</p>
<p dir="ltr">> However, scan-build is silent.  Is this beyond the capabilities of<br>
> scan-build, or am I invoking the tool incorrectly?<br>
> (If I concatenate the source for the two files into a single file,<br>
> then scan-build finds the expected error.)<br>
><br>
> Here's how I invoke scan-build:<br>
>   scan-build gcc a.c b.c<br>
><br>
> where a.c contains:<br>
><br>
> #include <stdio.h><br>
> extern int b (int i);<br>
> int main (int argc, const char **argv)<br>
> {<br>
>   int i;<br>
>   for (i = 0; i < 10; i++) {<br>
>     printf ("i=%d ratio=%d\n", i, i/ b(i)); // Note zero divide here<br>
>   }<br>
>   return 0;<br>
> }<br>
><br>
> and b.c contains the identity function:<br>
>  int b (int i) { return i; }<br>
><br>
><br>
> --<br>
> Robert Henry, New Relic<br>
> _______________________________________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</p>