[cfe-dev] scan-build - need help

Ted Kremenek kremenek at apple.com
Fri Oct 21 11:07:01 PDT 2011


Hi Suzzane,

If you run scan-build without any options, it will print a list of available checkers, including those that are not enabled by default.  This does not include experimental checkers, however, which are generally considered alpha quality.

To get the *full* list of available checkers, do:

$ clang -cc1 -analyzer-checker-help

where the "clang" should be the clang provided with the checker builds (if that is what you are using for scan-build).

On Oct 14, 2011, at 7:05 PM, Suzzane G wrote:

> Hi Ted,
> 
> Thanks for the info.  Is there any documentation about the default checkers and non-default checkers and options to enable them?
> 
> Regards,
> Suz
> 
> On Sat, Oct 15, 2011 at 12:11 AM, Ted Kremenek <kremenek at apple.com> wrote:
> The malloc() checker is still under development and is not on by default.  Try:
> 
> $ scan-build -enable-checker experimental.unix.Malloc <build line>
> 
> I ran it on your example and it reported:
> 
> t.c:10:17: warning: Allocated memory never released. Potential memory leak.
>        return (0);
>                ^
> t.c:9:9: warning: Value stored to 'p' is never read
>        p = malloc(100);
>        ^   ~~~~~~~~~~~
> 2 warnings generated.
> 
> On Oct 14, 2011, at 7:10 AM, Suzzane G wrote:
> 
> > HI,
> >
> > Here is my test program and I expected scan-build to detect resource leak.
> > But it is not detecting resource leak. Will you please let me know why this defect is not detected?
> >
> > #include <stdio.h>
> > #include <stdlib.h>
> >
> > int func (char *r)
> > {
> >         int x = 0;
> >         char *p = NULL;
> >
> >         p = malloc(100);
> >         return (0);
> > }
> >
> > Command used is "scan-build -o . --use-cc=/usr/bin/gcc-4.5 gcc -c ~/test.c"
> >
> > Rgds,
> > Suz _______________________________________________
> > cfe-dev mailing list
> > cfe-dev at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111021/e0f7ad33/attachment.html>


More information about the cfe-dev mailing list