db61366a55
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41628 a95241bf-73f2-0310-859d-f6bbb57e9c96
38 lines
798 B
C
38 lines
798 B
C
/*
|
|
* Copyright 2004-2010 Haiku Inc. All Rights Reserved.
|
|
* Distributed under the terms of the MIT License.
|
|
*/
|
|
#ifndef _ASSERT_H_
|
|
#define _ASSERT_H_
|
|
|
|
|
|
#undef assert
|
|
|
|
#ifndef NDEBUG
|
|
/* defining NDEBUG disables assert() functionality */
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
extern void __assert_fail(const char *assertion, const char *file,
|
|
unsigned int line, const char *function)
|
|
__attribute__ ((noreturn));
|
|
|
|
extern void __assert_perror_fail(int error, const char *file,
|
|
unsigned int line, const char *function)
|
|
__attribute__ ((noreturn));
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#define assert(assertion) \
|
|
((assertion) ? (void)0 : __assert_fail(#assertion, __FILE__, __LINE__, __PRETTY_FUNCTION__))
|
|
|
|
#else /* NDEBUG */
|
|
# define assert(condition) ((void)0)
|
|
#endif
|
|
|
|
#endif /* _ASSERT_H_ */
|