From b3f4b2ea49267dd4c96a7d40be28c2e74e070d2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 30 Jun 2004 02:34:10 +0000 Subject: [PATCH] Added a BeOS compatible assert.h. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8240 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/posix/assert.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 headers/posix/assert.h diff --git a/headers/posix/assert.h b/headers/posix/assert.h new file mode 100644 index 0000000000..b47812abdc --- /dev/null +++ b/headers/posix/assert.h @@ -0,0 +1,33 @@ +/* +** Distributed under the terms of the Haiku 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); + +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__)) + +#else // NDEBUG +# define assert(condition) ; +#endif + +#endif /* _ASSERT_H_ */