xref: /onnv-gate/usr/src/cmd/man/src/util/nsgmls.src/include/macros.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate // Copyright (c) 1994 James Clark
2*0Sstevel@tonic-gate // See the file COPYING for copying permission.
3*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
4*0Sstevel@tonic-gate 
5*0Sstevel@tonic-gate #ifndef macros_INCLUDED
6*0Sstevel@tonic-gate #define macros_INCLUDED 1
7*0Sstevel@tonic-gate 
8*0Sstevel@tonic-gate #ifndef __GNUG__
9*0Sstevel@tonic-gate #define __attribute__(args) /* as nothing */
10*0Sstevel@tonic-gate #endif
11*0Sstevel@tonic-gate 
12*0Sstevel@tonic-gate #ifdef NDEBUG
13*0Sstevel@tonic-gate 
14*0Sstevel@tonic-gate #include <stdlib.h>
15*0Sstevel@tonic-gate #define ASSERT(expr) ((void)0)
16*0Sstevel@tonic-gate #define CANNOT_HAPPEN() ((void)abort())
17*0Sstevel@tonic-gate 
18*0Sstevel@tonic-gate #else /* not NDEBUG */
19*0Sstevel@tonic-gate 
20*0Sstevel@tonic-gate #ifdef SP_NAMESPACE
21*0Sstevel@tonic-gate namespace SP_NAMESPACE {
22*0Sstevel@tonic-gate #endif
23*0Sstevel@tonic-gate extern SP_API void assertionFailed(const char *, const char *, int)
24*0Sstevel@tonic-gate      __attribute__((noreturn));
25*0Sstevel@tonic-gate #ifdef SP_NAMESPACE
26*0Sstevel@tonic-gate }
27*0Sstevel@tonic-gate #endif
28*0Sstevel@tonic-gate 
29*0Sstevel@tonic-gate #define ASSERT(expr) \
30*0Sstevel@tonic-gate   ((void)((expr) || \
31*0Sstevel@tonic-gate   (::SP_NAMESPACE_SCOPE assertionFailed(# expr, __FILE__, __LINE__), 0)))
32*0Sstevel@tonic-gate #define CANNOT_HAPPEN() ASSERT(0)
33*0Sstevel@tonic-gate 
34*0Sstevel@tonic-gate #endif /* not NDEBUG */
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate #define SIZEOF(v) (sizeof(v)/sizeof(v[0]))
37*0Sstevel@tonic-gate 
38*0Sstevel@tonic-gate #endif /* not macros_INCLUDED */
39