X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/39feb7f4efdca512951b1066a7eafab75c94e294..205e11aa1178f12d79e93b9208e3a4a1b9fa1904:/usr/src/include/assert.h diff --git a/usr/src/include/assert.h b/usr/src/include/assert.h index a8cee82330..629f916ed0 100644 --- a/usr/src/include/assert.h +++ b/usr/src/include/assert.h @@ -1,23 +1,34 @@ /*- - * Copyright (c) 1990 The Regents of the University of California. + * Copyright (c) 1992 The Regents of the University of California. * All rights reserved. * * %sccs.include.redist.c% * - * @(#)assert.h 4.3 (Berkeley) %G% + * @(#)assert.h 5.3 (Berkeley) %G% */ +/* + * Unlike other ANSI header files, may usefully be included + * multiple times, with and without NDEBUG defined. + */ + +#undef assert +#undef _assert + #ifdef NDEBUG -#define assert -#define _assert +#define assert(e) ((void)0) +#define _assert(e) ((void)0) #else -#define assert(expression) { \ - if (!(expression)) { \ - (void)fprintf(stderr, \ - "assertion \"%s\" failed: file \"%s\", line %d\n", \ - "expression", __FILE__, __LINE__); \ - exit(2); \ - } \ -} -#define _assert(expression) assert(expression) +#define _assert(e) assert(e) +#ifdef __STDC__ +#define assert(e) ((e) ? (void)0 : __assert(__FILE__, __LINE__, #e)) +#else /* PCC */ +#define assert(e) ((e) ? (void)0 : __assert(__FILE__, __LINE__, "e")) #endif +#endif + +#include + +__BEGIN_DECLS +void __assert __P((const char *, int, const char *)); +__END_DECLS