2004-06-30 06:34:10 +04:00
|
|
|
/*
|
|
|
|
** Distributed under the terms of the Haiku License.
|
|
|
|
*/
|
|
|
|
#ifndef _ASSERT_H_
|
|
|
|
#define _ASSERT_H_
|
|
|
|
|
|
|
|
#undef assert
|
|
|
|
|
|
|
|
#ifndef NDEBUG
|
2008-05-11 01:30:34 +04:00
|
|
|
/* defining NDEBUG disables assert() functionality */
|
2004-06-30 06:34:10 +04:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
extern void __assert_fail(const char *assertion, const char *file,
|
|
|
|
unsigned int line, const char *function);
|
|
|
|
|
|
|
|
extern void __assert_perror_fail(int error, const char *file,
|
|
|
|
unsigned int line, const char *function);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define assert(assertion) \
|
|
|
|
((assertion) ? (void)0 : __assert_fail(#assertion, __FILE__, __LINE__, __PRETTY_FUNCTION__))
|
|
|
|
|
2008-05-11 01:30:34 +04:00
|
|
|
#else /* NDEBUG */
|
|
|
|
# define assert(condition) ((void)0)
|
2004-06-30 06:34:10 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* _ASSERT_H_ */
|