diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-10-19 10:02:54 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-10-19 10:02:54 +0000 |
commit | 13736c9983ff599650b38cda38a58999b53e9bf4 (patch) | |
tree | f3c156dde75bd26fd932e566a8b52aa7728e8ea5 | |
parent | 37b6f04da92d0a9514e8cf8cb7e6496be490d9a3 (diff) |
__assert added, impl from netbsd, however put elsewhere. use it instead
of private versions (one even using the userland header) in if_sn.c
-rw-r--r-- | sys/arch/arc/dev/if_sn.c | 26 | ||||
-rw-r--r-- | sys/arch/mac68k/dev/if_sn.c | 16 | ||||
-rw-r--r-- | sys/kern/subr_prf.c | 16 | ||||
-rw-r--r-- | sys/sys/systm.h | 4 |
4 files changed, 36 insertions, 26 deletions
diff --git a/sys/arch/arc/dev/if_sn.c b/sys/arch/arc/dev/if_sn.c index f15ba5814a2..7ec82f8d391 100644 --- a/sys/arch/arc/dev/if_sn.c +++ b/sys/arch/arc/dev/if_sn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sn.c,v 1.6 1996/10/12 00:50:43 deraadt Exp $ */ +/* $OpenBSD: if_sn.c,v 1.7 1996/10/19 10:02:51 niklas Exp $ */ /* * National Semiconductor SONIC Driver * Copyright (c) 1991 Algorithmics Ltd (http://www.algor.co.uk) @@ -113,16 +113,20 @@ struct cfdriver sn_cd = { NULL, "sn", DV_IFNET, NULL, 0 }; -#include <assert.h> -void -__assert(file, line, failedexpr) - const char *file, *failedexpr; - int line; -{ - (void)printf( - "assertion \"%s\" failed: file \"%s\", line %d\n", - failedexpr, file, line); -} +#undef assert +#undef _assert + +#ifdef NDEBUG +#define assert(e) ((void)0) +#define _assert(e) ((void)0) +#else +#define _assert(e) assert(e) +#ifdef __STDC__ +#define assert(e) ((e) ? (void)0 : __assert("sn ", __FILE__, __LINE__, #e)) +#else /* PCC */ +#define assert(e) ((e) ? (void)0 : __assert("sn "__FILE__, __LINE__, "e")) +#endif +#endif void m_check(m) diff --git a/sys/arch/mac68k/dev/if_sn.c b/sys/arch/mac68k/dev/if_sn.c index bdd88d64351..51c7b5f9507 100644 --- a/sys/arch/mac68k/dev/if_sn.c +++ b/sys/arch/mac68k/dev/if_sn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sn.c,v 1.6 1996/09/21 03:34:55 briggs Exp $ */ +/* $OpenBSD: if_sn.c,v 1.7 1996/10/19 10:02:53 niklas Exp $ */ /* * National Semiconductor SONIC Driver @@ -140,22 +140,12 @@ struct cfdriver sn_cd = { #else #define _assert(e) assert(e) #ifdef __STDC__ -#define assert(e) ((e) ? (void)0 : __assert(__FILE__, __LINE__, #e)) +#define assert(e) ((e) ? (void)0 : __assert("sn ", __FILE__, __LINE__, #e)) #else /* PCC */ -#define assert(e) ((e) ? (void)0 : __assert(__FILE__, __LINE__, "e")) +#define assert(e) ((e) ? (void)0 : __assert("sn "__FILE__, __LINE__, "e")) #endif #endif -void -__assert(file, line, failedexpr) - const char *file, *failedexpr; - int line; -{ - (void)printf( - "assertion \"%s\" failed: file \"%s\", line %d\n", - failedexpr, file, line); -} - int ethdebug = 0; /* diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c index c38fad6e73f..70ef3d1b944 100644 --- a/sys/kern/subr_prf.c +++ b/sys/kern/subr_prf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_prf.c,v 1.10 1996/07/28 01:05:48 deraadt Exp $ */ +/* $OpenBSD: subr_prf.c,v 1.11 1996/10/19 10:02:49 niklas Exp $ */ /* $NetBSD: subr_prf.c,v 1.25 1996/04/22 01:38:46 christos Exp $ */ /*- @@ -135,6 +135,20 @@ panic(fmt, va_alist) } /* + * Partial support (the failure case) of the assertion facility + * commonly found in userland. + */ +void +__assert(t, f, l, e) + const char *t, *f, *e; + int l; +{ + + panic("kernel %sassertion \"%s\" failed: file \"%s\", line %d\n", + t, e, f, l); +} + +/* * Warn that a system table is full. */ void diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 26ca775d9a9..7373b61865e 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -1,4 +1,4 @@ -/* $OpenBSD: systm.h,v 1.9 1996/08/15 13:49:48 niklas Exp $ */ +/* $OpenBSD: systm.h,v 1.10 1996/10/19 10:02:45 niklas Exp $ */ /* $NetBSD: systm.h,v 1.50 1996/06/09 04:55:09 briggs Exp $ */ /*- @@ -138,6 +138,8 @@ void panic __P((const char *, ...)) #else __attribute__((__noreturn__)); #endif +void __assert __P((const char *, const char *, int, const char *)) + __attribute__((__noreturn__)); int printf __P((const char *, ...)) __kprintf_attribute__((__format__(__kprintf__,1,2))); void uprintf __P((const char *, ...)) |