This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: gcc compiles assert() to code that requires linking with gcc


On Sun, Jun 25, 2000 at 05:55:24PM +0900, Martin Buchholz wrote:
> I cannot create a static library that includes a call to assert() and
> that is intended for use with the native compiler as well as with gcc.
...

assert's helper function, __eprintf, is different from all the other
routines in libgcc.  It exists because in the past, you couldn't count
on the system <assert.h> to be standard compliant.  It might declare
fprintf, or require you to have included <stdio.h>, or not honor
NDEBUG, or something like that.  Just another of the problems we have
to patch around in the system headers - only in this case, the
solution chosen was to provide our own copy entirely, instead of
patching the system copy.  And it needed a routine it could call that
was in the implementation namespace, and that was the same across all
platforms.  Hence __eprintf.

Nowadays, the system usually gets assert.h right by itself, and gcc
can be told to forget its private version.  All you have to do is add
a couple lines to the appropriate t-* makefile fragment.  Sample from
config/i386/t-beos:

# Use the system assert.h.
INSTALL_ASSERT_H =

We'd be happy to take patches applying this to whatever platforms you
can verify it's safe for.

zw

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]