define PDQ_ASSERT directly in terms of __assert, because cpp doesn't seem
to do: #define foo(x) ... #define bar foo like we'd like it to.
This commit is contained in:
parent
4deb6e56b8
commit
a4bb0a41da
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: pdqreg.h,v 1.5 1996/08/27 00:51:29 cgd Exp $ */
|
/* $NetBSD: pdqreg.h,v 1.6 1996/08/28 16:01:29 cgd Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1995, 1996 Matt Thomas <matt@3am-software.com>
|
* Copyright (c) 1995, 1996 Matt Thomas <matt@3am-software.com>
|
||||||
|
@ -48,11 +48,22 @@
|
||||||
* Including user-land headers in kernel code is not allowed in NetBSD.
|
* Including user-land headers in kernel code is not allowed in NetBSD.
|
||||||
*/
|
*/
|
||||||
#define offsetof(type, member) ((size_t)(&((type *)0)->member))
|
#define offsetof(type, member) ((size_t)(&((type *)0)->member))
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Can't directly use "assert", because apparenltly cpp won't expand it
|
||||||
|
* unless it has an argument, which loses.
|
||||||
|
*/
|
||||||
#ifdef PDQ_NDEBUG
|
#ifdef PDQ_NDEBUG
|
||||||
#undef NDEBUG
|
#define PDQ_ASSERT(e) ((void)0)
|
||||||
#define NDEBUG
|
#else
|
||||||
|
#ifdef __STDC__
|
||||||
|
#define PDQ_ASSERT(e) ((e) ? (void)0 : \
|
||||||
|
__assert("PDQ ", __FILE__, __LINE__, #e))
|
||||||
|
#else
|
||||||
|
#define PDQ_ASSERT(e) ((e) ? (void)0 : \
|
||||||
|
__assert("PDQ ", __FILE__, __LINE__, "e"))
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#define PDQ_ASSERT assert
|
|
||||||
#endif /* __NetBSD__ */
|
#endif /* __NetBSD__ */
|
||||||
|
|
||||||
#define PDQ_RING_SIZE(array) ((sizeof(array) / sizeof(array[0])))
|
#define PDQ_RING_SIZE(array) ((sizeof(array) / sizeof(array[0])))
|
||||||
|
|
Loading…
Reference in New Issue