assert.h revision 9f170279
1/*
2 * Copyright 2004-2015 Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
4 */
5
6#undef assert
7
8#ifndef NDEBUG
9	/* defining NDEBUG disables assert() functionality */
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15extern void __assert_fail(const char *assertion, const char *file,
16				unsigned int line, const char *function)
17	__attribute__ ((noreturn));
18
19extern void __assert_perror_fail(int error, const char *file,
20				unsigned int line, const char *function)
21	__attribute__ ((noreturn));
22
23#ifdef __cplusplus
24}
25#endif
26
27#define assert(assertion) \
28	((assertion) ? (void)0 : __assert_fail(#assertion, __FILE__, __LINE__, __PRETTY_FUNCTION__))
29
30#else	/* NDEBUG */
31#	define assert(condition) ((void)0)
32#endif
33