You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Daniel Shahaf <d....@daniel.shahaf.name> on 2011/05/01 09:38:45 UTC

Re: svn commit: r1098204 - /subversion/trunk/subversion/libsvn_wc/questions.c

Nice series of patches tonight --- what tool / gcc flags did you use
to catch them?

Re: svn commit: r1098204 - /subversion/trunk/subversion/libsvn_wc/questions.c

Posted by Hyrum K Wright <hy...@hyrumwright.org>.
On Mon, May 2, 2011 at 8:21 AM, Bert Huijben <be...@qqmail.nl> wrote:
>
>
>> -----Original Message-----
>> From: Hyrum K Wright [mailto:hyrum@hyrumwright.org]
>> Sent: maandag 2 mei 2011 14:46
>> To: Daniel Shahaf
>> Cc: dev@subversion.apache.org
>> Subject: Re: svn commit: r1098204 -
>> /subversion/trunk/subversion/libsvn_wc/questions.c
>>
>> On Sun, May 1, 2011 at 2:38 AM, Daniel Shahaf <d....@daniel.shahaf.name>
>> wrote:
>> > Nice series of patches tonight --- what tool / gcc flags did you use
>> > to catch them?
>>
>> I've been playing around with clang-analyzer, a static analyzer that
>> is part of llvm:
>> http://clang-analyzer.llvm.org/
>>
>> There are still a lot of false positives (it has trouble grokking our
>> SVN_ERR_ASSERT() macro), but it's been useful to find the kinds of
>> problems fixed in my patches the last few days.
>>
>> At some point, it might be useful to set up a nightly buildbot to
>> automatically run static analysis on a regular basis.
>
> Maybe you can #define SVN_ERR_ASSERT() to assert() for clang?
> (It might even use assert() as a hint to improve results)

That's a good idea.

We can condition it upon the __clang__ preprocessor macro, but that
would change the definition for people building with clang and not
running the analyzer.  I'm not quite sure if clang has a special flag
for when the analyzer is running.

I also found this section in the clang-analyzer docs, talking about
custom assertion handlers:
http://clang-analyzer.llvm.org/annotations.html#custom_assertions
However, it seemed to imply it best dealt with handlers that wouldn't
return, rather than our current method sending errors back up the
stack.

-Hyrum

RE: svn commit: r1098204 - /subversion/trunk/subversion/libsvn_wc/questions.c

Posted by Bert Huijben <be...@qqmail.nl>.

> -----Original Message-----
> From: Hyrum K Wright [mailto:hyrum@hyrumwright.org]
> Sent: maandag 2 mei 2011 14:46
> To: Daniel Shahaf
> Cc: dev@subversion.apache.org
> Subject: Re: svn commit: r1098204 -
> /subversion/trunk/subversion/libsvn_wc/questions.c
> 
> On Sun, May 1, 2011 at 2:38 AM, Daniel Shahaf <d....@daniel.shahaf.name>
> wrote:
> > Nice series of patches tonight --- what tool / gcc flags did you use
> > to catch them?
> 
> I've been playing around with clang-analyzer, a static analyzer that
> is part of llvm:
> http://clang-analyzer.llvm.org/
> 
> There are still a lot of false positives (it has trouble grokking our
> SVN_ERR_ASSERT() macro), but it's been useful to find the kinds of
> problems fixed in my patches the last few days.
> 
> At some point, it might be useful to set up a nightly buildbot to
> automatically run static analysis on a regular basis.

Maybe you can #define SVN_ERR_ASSERT() to assert() for clang?
(It might even use assert() as a hint to improve results)

	Bert


Re: svn commit: r1098204 - /subversion/trunk/subversion/libsvn_wc/questions.c

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Hyrum K Wright wrote on Mon, May 02, 2011 at 07:46:12 -0500:
> On Sun, May 1, 2011 at 2:38 AM, Daniel Shahaf <d....@daniel.shahaf.name> wrote:
> > Nice series of patches tonight --- what tool / gcc flags did you use
> > to catch them?
> 
> I've been playing around with clang-analyzer, a static analyzer that
> is part of llvm:
> http://clang-analyzer.llvm.org/
> 
> There are still a lot of false positives (it has trouble grokking our
> SVN_ERR_ASSERT() macro), but it's been useful to find the kinds of
> problems fixed in my patches the last few days.
> 

Sounds useful.

> At some point, it might be useful to set up a nightly buildbot to
> automatically run static analysis on a regular basis.
> 

Indeed; I've been wondering how hard it would be to set up a buildbot
that turns red whenever a new compiler warning is introduced.

> -Hyrum

Re: svn commit: r1098204 - /subversion/trunk/subversion/libsvn_wc/questions.c

Posted by Hyrum K Wright <hy...@hyrumwright.org>.
On Sun, May 1, 2011 at 2:38 AM, Daniel Shahaf <d....@daniel.shahaf.name> wrote:
> Nice series of patches tonight --- what tool / gcc flags did you use
> to catch them?

I've been playing around with clang-analyzer, a static analyzer that
is part of llvm:
http://clang-analyzer.llvm.org/

There are still a lot of false positives (it has trouble grokking our
SVN_ERR_ASSERT() macro), but it's been useful to find the kinds of
problems fixed in my patches the last few days.

At some point, it might be useful to set up a nightly buildbot to
automatically run static analysis on a regular basis.

-Hyrum