Browse Source

Include the function name in assert() output. From espie@

OPENBSD_3_9
millert 19 years ago
parent
commit
7e7c8eb496
1 changed files with 11 additions and 7 deletions
  1. +11
    -7
      src/include/assert.h

+ 11
- 7
src/include/assert.h View File

@ -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 $ */ /* $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. * multiple times, with and without NDEBUG defined.
*/ */
#include <sys/cdefs.h>
#undef assert #undef assert
#undef _assert #undef _assert
#ifdef NDEBUG #ifdef NDEBUG
#define assert(e) ((void)0)
#define _assert(e) ((void)0)
# define assert(e) ((void)0)
# define _assert(e) ((void)0)
#else #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 #endif
#include <sys/cdefs.h>
__BEGIN_DECLS __BEGIN_DECLS
void __assert(const char *, int, const char *); void __assert(const char *, int, const char *);
void __assert2(const char *, int, const char *, const char *); void __assert2(const char *, int, const char *, const char *);


Loading…
Cancel
Save