diff options
Diffstat (limited to 'system/include/libc/assert.h')
-rw-r--r-- | system/include/libc/assert.h | 45 |
1 files changed, 9 insertions, 36 deletions
diff --git a/system/include/libc/assert.h b/system/include/libc/assert.h index 8d112839..ab745db1 100644 --- a/system/include/libc/assert.h +++ b/system/include/libc/assert.h @@ -1,45 +1,18 @@ -/* - assert.h -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "_ansi.h" +#include <features.h> #undef assert -#ifdef NDEBUG /* required by ANSI standard */ -# define assert(__e) ((void)0) +#ifdef NDEBUG +#define assert(x) (void)0 #else -# define assert(__e) ((__e) ? (void)0 : __assert_func (__FILE__, __LINE__, \ - __ASSERT_FUNC, #__e)) - -# ifndef __ASSERT_FUNC - /* Use g++'s demangled names in C++. */ -# if defined __cplusplus && defined __GNUC__ -# define __ASSERT_FUNC __PRETTY_FUNCTION__ - - /* C99 requires the use of __func__. */ -# elif __STDC_VERSION__ >= 199901L -# define __ASSERT_FUNC __func__ - - /* Older versions of gcc don't have __func__ but can use __FUNCTION__. */ -# elif __GNUC__ >= 2 -# define __ASSERT_FUNC __FUNCTION__ +#define assert(x) ((void)((x) || (__assert_fail(#x, __FILE__, __LINE__, __func__),0))) +#endif - /* failed to detect __func__ support. */ -# else -# define __ASSERT_FUNC ((char *) 0) -# endif -# endif /* !__ASSERT_FUNC */ -#endif /* !NDEBUG */ +#ifdef __cplusplus +extern "C" { +#endif -void _EXFUN(__assert, (const char *, int, const char *) - _ATTRIBUTE(noreturn)); -void _EXFUN(__assert_func, (const char *, int, const char *, const char *) - _ATTRIBUTE(noreturn)); +void __assert_fail (const char *, const char *, int, const char *); #ifdef __cplusplus } |