bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: __func__


From: Eric Blake
Subject: Re: __func__
Date: Mon, 03 Mar 2008 19:14:18 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080213 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Simon Josefsson on 3/3/2008 9:07 AM:
|> I like the idea.  I would also like to see the assert module use it, if
the
|> platform's assert() lacks __func__ information as required by C99/POSIX
2001.
|
| How can that be implemented?  The current assert module seems to only
| add a --disable-assert, rather than replacing a incorrect assert
| function.

Well, it would imply a gnulib replacement <assert.h>.  Unfortunately, I
don't see any easy way to see what underlying function assert expands to
when NDEBUG is not defined, so all I can think of is adding assert.c to
gnulib, declaring rpl_assert(int expr, const char *file, int line, const
char *function), and doing:

#ifdef NDEBUG
# define assert(e) ((void) 0)
#else
# define assert(e) ((e) ? (void) 0 \
~  : rpl_assert (#e, __FILE__, __LINE__, __func__))
#endif

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHzLB684KuGfSFAYARAkrxAJ9jAFnkYpxv62w7wjwLGAHt0OrBhwCgj160
NchmcLAz8jFb6yceQbUjq+E=
=+4u7
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]