Exclude protobuf generated files

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Exclude protobuf generated files

George Kollias
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,
George
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Exclude protobuf generated files

Ted Kremenek
Hi George,

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.

Cheers,
Ted

> On Nov 25, 2014, at 12:49 PM, George Kollias <[hidden email]> 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,
> George
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Exclude protobuf generated files

Manuel Klimek
/subscribe - I'm very interested in false positives in protocol buffer code :)

On Wed Nov 26 2014 at 8:08:51 AM Ted Kremenek <[hidden email]> wrote:
Hi George,

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.

Cheers,
Ted

> On Nov 25, 2014, at 12:49 PM, George Kollias <[hidden email]> 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,
> George
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Exclude protobuf generated files

Csaba Raduly
In reply to this post by Ted Kremenek
On Wed, Nov 26, 2014 at 8:04 AM, Ted Kremenek  wrote:
> Hi George,
>
> 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.

No need for "if". protoc is documented to produce x.pb.cc and x.pb.h
from x.proto  (https://developers.google.com/protocol-buffers/docs/reference/cpp-generated#invocation)

Csaba
--
GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
The Tao of math: The numbers you can count are not the real numbers.
Life is complex, with real and imaginary parts.
"Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds
"People disagree with me. I just ignore them." -- Linus Torvalds

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Exclude protobuf generated files

George Kollias
In reply to this post by Ted Kremenek
Hi Ted,
Sure, glad to help. Where should i file these PRs? To Bugzilla?

Thanks,
George

On Wed, Nov 26, 2014 at 9:04 AM, Ted Kremenek <[hidden email]> wrote:

> Hi George,
>
> 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.
>
> Cheers,
> Ted
>
>> On Nov 25, 2014, at 12:49 PM, George Kollias <[hidden email]> 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,
>> George
>> _______________________________________________
>> cfe-dev mailing list
>> [hidden email]
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Exclude protobuf generated files

Ted Kremenek
Yes please, Bugzilla is the place to file these.  Feel free to file one or more, but regardless of quantity context and explanation of what you are seeing is usually invaluable for these kind of issues.  If you file any PRs, please respond to the thread and post the links to them here.

Cheers,
Ted


> On Nov 26, 2014, at 12:54 PM, George Kollias <[hidden email]> wrote:
>
> Hi Ted,
> Sure, glad to help. Where should i file these PRs? To Bugzilla?
>
> Thanks,
> George
>
>> On Wed, Nov 26, 2014 at 9:04 AM, Ted Kremenek <[hidden email]> wrote:
>> Hi George,
>>
>> 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.
>>
>> Cheers,
>> Ted
>>
>>> On Nov 25, 2014, at 12:49 PM, George Kollias <[hidden email]> 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,
>>> George
>>> _______________________________________________
>>> cfe-dev mailing list
>>> [hidden email]
>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev