[cfe-dev] Exclude protobuf generated files
kremenek at apple.com
Tue Nov 25 23:04:18 PST 2014
I think the mitigation strategy for reducing false positives right now from the analyzer are the two techniques you mention.
You can use __clang_analyzer__ but it really is a heavy hammer, and essentially precludes the analyzer from doing anything useful with those files. If you are using the analyzer from within Xcode, you also need to make sure that the source can still parse (during analysis) after you add the __clang_analyzer__ guards or Xcode will abort the analysis of your project because it encountered source files that can't parse.
Specifically with respect to protocol buffer code, could you file one or more PRs about representative issues you are seeing? There's a possibility they could be pruned using heuristics within the analyzer. If protocol buffer code tends to be generated idiomatically with specific file extensions, e.g. .pb.cc, we could possibly use even that to tune some heuristics on the analyzer to avoid false positives.
> On Nov 25, 2014, at 12:49 PM, George Kollias <georgioskollias at gmail.com> wrote:
> Hello all,
> Recently, we started using the clang static analyzer in our project
> and it's already very helpful. One thing we'd like to improve though
> is to reduce the number of the warnings/bugs we get about protobuf
> generated files -*.pb.cc- (we're not really interested in them). What
> would be the best way to avoid analysing them without affecting
> heavily the rest of the code? E.g. would it be better to avoid
> generating these files completely or it'd be better to wrap each of
> these files in #ifndef __clang_analyzer__/#endif blocks?
> Thank you,
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
More information about the cfe-dev