Re: [AD] al_assert

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Tue, Apr 14, 2009 at 8:22 PM, Elias Pschernig
<elias.pschernig@xxxxxxxxxx> wrote:
> Why?
I'm glad you asked!! A while ago I had a play with the LLVM/clang
static analyzer (http://clang.llvm.org/StaticAnalysis.html) It did
find one or two possible bugs in the code that might need looking at
but also many (242) false positives of the form:
int al_get_display_width(void)
{
   ALLEGRO_DISPLAY *display = al_get_current_display();
   ASSERT(display);

   return display->w;
}
It complains about a possible null pointer dereference at display->w
because it thinks that al_get_current_display may return NULL but it
doesn't know that ASSERT won't return if it is. If I add the noreturn
attribute then these will go away.

I'll post some of the errors that I think really are errors if I get
time, otherwise LLVM is pretty easy to compile if anyone else wants a
go.

Pete




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/