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