2 * Copyright 2004-2015 Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
6 /* Include guards are only on part of the file, as assert.h is required
7 to support being included multiple times.
9 E.g. the following is required to be valid:
14 assert(0); // this assertion will be triggered
19 assert(0); // this assertion will not be triggered
25 /* defining NDEBUG disables assert() functionality */
34 extern void __assert_fail(const char *assertion
, const char *file
,
35 unsigned int line
, const char *function
)
36 __attribute__ ((noreturn
));
38 extern void __assert_perror_fail(int error
, const char *file
,
39 unsigned int line
, const char *function
)
40 __attribute__ ((noreturn
));
46 #endif /* !_ASSERT_H_ */
48 #define assert(assertion) \
49 ((assertion) ? (void)0 : __assert_fail(#assertion, __FILE__, __LINE__, __PRETTY_FUNCTION__))
52 # define assert(condition) ((void)0)