summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2006-01-13 17:54:31 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2006-01-13 17:54:31 +0000
commitf6b436a174305ff928248488ed2bb681ecd79d40 (patch)
tree74921fcc339a2de8a558a6c4b57a1817016a082c
parent598a52dbb36d2b27f3e596c194bf0dd096ea75c3 (diff)
Include the function name in assert() output. From espie@
-rw-r--r--include/assert.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/include/assert.h b/include/assert.h
index 9c8a5dcc7be..1246c84251f 100644
--- a/include/assert.h
+++ b/include/assert.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: assert.h,v 1.10 2003/07/15 17:31:18 deraadt Exp $ */
+/* $OpenBSD: assert.h,v 1.11 2006/01/13 17:54:30 millert Exp $ */
/* $NetBSD: assert.h,v 1.6 1994/10/26 00:55:44 cgd Exp $ */
/*-
@@ -42,19 +42,23 @@
* multiple times, with and without NDEBUG defined.
*/
+#include <sys/cdefs.h>
+
#undef assert
#undef _assert
#ifdef NDEBUG
-#define assert(e) ((void)0)
-#define _assert(e) ((void)0)
+# define assert(e) ((void)0)
+# define _assert(e) ((void)0)
#else
-#define _assert(e) assert(e)
-#define assert(e) ((e) ? (void)0 : __assert(__FILE__, __LINE__, #e))
+# define _assert(e) assert(e)
+# if __ISO_C_VISIBLE >= 1999
+# define assert(e) ((e) ? (void)0 : __assert2(__FILE__, __LINE__, __func__, #e))
+# else
+# define assert(e) ((e) ? (void)0 : __assert(__FILE__, __LINE__, #e))
+# endif
#endif
-#include <sys/cdefs.h>
-
__BEGIN_DECLS
void __assert(const char *, int, const char *);
void __assert2(const char *, int, const char *, const char *);