Open Quuxplusone opened 15 years ago
The trick is passing this information from scan-build to ccc-analyzer. ccc-analyzer is the fake compiler driver that scan-build tells the build system to use instead of gcc. ccc-analyzer calls both gcc and clang. Because ccc-analyzer is invoked by the build system, information between scan-build and ccc-analyzer is passed through environment variables. It should be easy to pass a list of directories and files to ignore, although we would need to make sure that they are resolved to absolute paths since ccc-analyzer can be called from any directory by the build system (so relative paths won't work).
Do you a preference for the format of this command line argument?
Anything that works is fine. I just need to be able to indicate one or more files/directories to skip over.
scan-build desperately needs a way to instruct it to not bother analyzing certain files. This would be extremely useful when analyzing an Xcode project that includes vendor code, as analyzing the vendor code is just a waste of time.
For example, I have sqlite3.c in my project, which is a single file that's 104k lines long and contains the entirety of sqlite 3 (it's called the sqlite3-amalgamation tarball). Analyzing this one file took several times as long as analyzing the entire rest of the project, and yet the results are not only worthless, they're counterproductive as they make it harder to see the legitimate issues in the rest of my project.
I would like to see a new command-line option made available to scan-build that lets me give it a single path (the option should be repeatable). If the path is a file, that file is skipped during analysis. If the path is a directory, all files rooted inside that directory should be skipped during analysis. This way I could simply pass vendor/ and have all vendor code skipped.