[C++ Patch] Change my_fancy_abort() to abort()

Zack Weinberg zack@codesourcery.com
Wed Jan 23 12:25:00 GMT 2002


On Wed, Jan 23, 2002 at 03:08:38PM -0500, Craig Rodrigues wrote:
> On Wed, Jan 23, 2002 at 07:13:07PM +0000, Jason Merrill wrote:
> > > OK, just to make sure, will replacing my_friendly_assert() with
> > > just assert() be the way to go?
> > 
> > There doesn't seem to be a definition of assert in the compiler headers
> > like there is of abort.  Either provide one, or change the asserts to 
> > if (!cond) abort.  My preference would be the former, unless someone knows
> > of a reason not to.
> 
> Looking at the gcc ChangeLog, I see the following:
> 
> 2001-05-11  Zack Weinberg  <zackw@stanford.edu>
>  
>         * Makefile.in: Exterminate all references to assert.h.
>         * cross-make: Likewise.
>         * assert.h: Delete.
> 
> I am not familiar with all the issues regarding assert, 
> so want to proceed with caution and understand the
> issues before touching my_friendly_assert().

The issues I'm aware of are that <assert.h> is not provided by pre-C89
libraries, that the C library's assert won't call our special abort,
and that -DNDEBUG makes the assertions go away which we don't want.

Since we are careful not to include assert.h, I think we could put a
reliable definition for assert() in system.h and not worry about it.
Base your definition on the tree-checking macros.

zw



More information about the Gcc-patches mailing list