diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2002-06-10 14:59:02 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2002-06-10 14:59:02 +0000 |
commit | e478162b268e8795ca68fcaa4063e5a871ea93c6 (patch) | |
tree | 0d3cd0fbf98ac9f65a1ede98d55dd8b441b0ba4f | |
parent | 3bc966a50af3c458b034c56438895be7b09e9666 (diff) |
put back in the assert changes for ISO C 99 (put __func__ in it)
-rw-r--r-- | include/assert.h | 18 | ||||
-rw-r--r-- | lib/libc/gen/assert.c | 12 | ||||
-rw-r--r-- | lib/libc/shlib_version | 2 | ||||
-rw-r--r-- | lib/libc_r/shlib_version | 2 |
4 files changed, 25 insertions, 9 deletions
diff --git a/include/assert.h b/include/assert.h index 66f96c9828f..1d728f52cbd 100644 --- a/include/assert.h +++ b/include/assert.h @@ -1,4 +1,4 @@ -/* $OpenBSD: assert.h,v 1.6 2002/04/19 15:48:35 deraadt Exp $ */ +/* $OpenBSD: assert.h,v 1.7 2002/06/10 14:59:01 espie Exp $ */ /* $NetBSD: assert.h,v 1.6 1994/10/26 00:55:44 cgd Exp $ */ /*- @@ -49,16 +49,22 @@ #undef assert #undef _assert +#include <sys/cdefs.h> + #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 __GNUC_PREREQ__(2, 95) || (defined(__STDC__) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) +# 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 *); __END_DECLS diff --git a/lib/libc/gen/assert.c b/lib/libc/gen/assert.c index 60d1ba1eecd..370e02279f6 100644 --- a/lib/libc/gen/assert.c +++ b/lib/libc/gen/assert.c @@ -32,7 +32,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: assert.c,v 1.4 2002/04/19 15:48:35 deraadt Exp $"; +static char *rcsid = "$OpenBSD: assert.c,v 1.5 2002/06/10 14:59:01 espie Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> @@ -51,3 +51,13 @@ __assert(file, line, failedexpr) abort(); /* NOTREACHED */ } + +void +__assert2(const char *file, int line, const char *func, const char *failedexpr) +{ + (void)fprintf(stderr, + "assertion \"%s\" failed: file \"%s\", line %d, function \"%s\"\n", + failedexpr, file, line, func); + abort(); + /* NOTREACHED */ +} diff --git a/lib/libc/shlib_version b/lib/libc/shlib_version index 51feb7c82c1..0a19050cd2f 100644 --- a/lib/libc/shlib_version +++ b/lib/libc/shlib_version @@ -1,2 +1,2 @@ major=28 -minor=3 # note: remember to update minor in ../libc_r/shlib_version +minor=4 # note: remember to update minor in ../libc_r/shlib_version diff --git a/lib/libc_r/shlib_version b/lib/libc_r/shlib_version index 1c51894bdac..dd2e39acd75 100644 --- a/lib/libc_r/shlib_version +++ b/lib/libc_r/shlib_version @@ -1,2 +1,2 @@ major=6 -minor=3 +minor=4 |