Re: [AD] al_assert

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


On 2010-02-24, Elias Pschernig <elias.pschernig@xxxxxxxxxx> wrote:
> On Tue, 2010-02-23 at 17:40 -0500, Evert Glebbeek wrote:
> > On 23 Feb 2010, at 15:36 , Peter Hull wrote:
> > > OK, raising this thread from the dead, but, can I add the noreturn
> > > attribute to al_assert and make sure it doesn't actually return? It
> > > cuts out all the null pointer dereference errors from the clang static
> > > analysis that Evert and I have been running.
> > 
> > No idea what it does or why we shouldn't do it (I don't remember the
> > thread), but you can always add it on only on OS X if it interferes
> > with other platforms.
> > 
> 
> Can we do this?
> 
> #define AL_ASSERT assert

IMO, yes.  (well, add some brackets around it)

> Basically every line in al_assert() seems completely useless to me. I'm
> sure it made sense in the days of A4 somehow

In DOS days if you just aborted in a graphical mode you would be stuck
there, probably without even your normal keyboard input.

> but looking at that code
> now I honestly don't see what it does. There's an assert_handler which
> is not used anywhere else according to git grep. And an undocumented
> ALLEGRO_ASSERT environment variable, which optionally writes to a file?
> As much as I try to find one I can't see a possibly use case for that.

@@void @al_assert(const char *file, int line);
@xref ASSERT, al_trace, register_assert_handler
@shortdesc Asserts at the specified file and line number.
   Raises an assert for an error at the specified file and line number. The
   file parameter is always given in ASCII format. By default, this will call
   the system driver's assert handler. If there is none, the error will be
   sent to stderr and the program will abort. However, if the environment
   variable ALLEGRO_ASSERT is set, this function writes a message into the
   file specified by the environment variable and program execution will
   continue. If none of this behaviours is wanted, you can override them with
   a custom assert handler.

I don't feel any of that is necessary.

Peter




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