[cfe-dev] scan-build "No bugs found."
Artem Dergachev via cfe-dev
cfe-dev at lists.llvm.org
Wed Jan 18 11:27:25 PST 2017
You can hard-confirm if the analyzer is running by seeing if you have
any "clang -cc1 -analyze ..." processes during analysis. Though, those
"ANALYZE (Syntax)" lines are definitely from the analyzer.
The scan-build tool has known issues, which you might have stepped into.
It might be that all warnings you're seeing in the console are
"cross-file" (eg. some part of the path in header and some in the main
file), which is **very unfortunately** not supported by the html
diagnostic output (which produces one plain-html file per warning,
incorporating a single file through the HTMLRewrite mechanism), so such
warnings would be dropped by scan-build but appear in console.
The other option is to use scan-build -plist, which would not drop
warnings but produce barely readable XML output; normally, plists are
for use by IDEs that try to integrate the analyzer (like Xcode and
QtCreator; i don't think they use scan-build internally though, as they
don't need an external compiler interceptor to understand their build
system anyway).
So unless somebody implements a proper multi-file html report output,
we're either stuck with these few IDEs or miss some warnings (normally
not too many).
I tried to reproduce the issue and it *seems* (but i didn't dig deeper)
that some of them are cross-file (note that when the whole report is
inside a header, it's not a problem).
> Also, although I redirect both stdout and stderr, the lines I
mentioned -- "ANALYZE ..." and "1 warning generated." -- are nonetheless
printed on the console, not [1]. Why is that?
The scan-build script messes up stdout and stderr dramatically to
produce reasonable output at least to console, tackling with mutliple
sources from multiple processes (original compiler and ccc-analyzer
instances) and piping their stdout and stderr around. I didn't dare to
understand this ever, but i agree it's not quite UNIX-way.
On 1/18/17 1:39 AM, Jack Bates via cfe-dev wrote:
> I'm running scan-build on Apache Traffic Server and getting "No bugs
> found.", which isn't what I expect.
>
> I ran it as follows:
>
> $ git clone https://github.com/apache/trafficserver.git
> $ cd trafficserver
> $ autoreconf -i
> $ ./configure
> $ scan-build -v -v make V=1 2>&1 > ~/Desktop/scan-build
>
> Here's the output [1].
>
> I didn't run ./configure through scan-build, but I conclude from the
> Make output that the compiler is being correctly interposed upon, so I
> shouldn't need to? The output indicates that the compiler is
> c++-analyzer.
>
> The output contains lines like the following, so I conclude that the
> analyzer is working?
>
> ANALYZE (Syntax): ../../lib/ts/ink_mutex.h ~x_pthread_mutexattr_t
>
> And it contains lines like "1 warning generated.", so I conclude that
> there should be bugs?
>
> So my first question is, why are there "No bugs found."?
>
> Also, although I redirect both stdout and stderr, the lines I
> mentioned -- "ANALYZE ..." and "1 warning generated." -- are
> nonetheless printed on the console, not [1]. Why is that?
>
> Thanks!
>
> [1] http://nottheoilrig.com/scan-build
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
More information about the cfe-dev
mailing list