source: trunk/sys/dietlibc/include/assert.h @ 1

Last change on this file since 1 was 1, checked in by alain, 7 years ago

First import

File size: 961 bytes
Line 
1#ifndef _ASSERT_H
2#define _ASSERT_H
3
4
5#ifdef __PRETTY_FUNCTION__
6#define __ASSERT_FUNCTION __PRETTY_FUNCTION__
7#else
8#  if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
9#   define __ASSERT_FUNCTION    __func__
10#  else
11#   define __ASSERT_FUNCTION    ((const char *) 0)
12#  endif
13#endif
14
15#undef assert
16#ifdef NDEBUG
17#define assert(expr) ((void)0)
18#else
19
20/* This prints an "Assertion failed" message and aborts.  */
21extern void __assert_fail (const char *__assertion, const char *__file,
22                           unsigned int __line, const char *__function)
23     __attribute__ ((__noreturn__));
24
25#ifdef expect
26# define assert(expr)                                                         \
27  ((void) (expect((long)(expr),0) ? 0 :                                       \
28           (__assert_fail (#expr,                                     \
29                           __FILE__, __LINE__, __ASSERT_FUNCTION), 0)))
30#else
31# define assert(expr)                                                         \
32  ((void) ((expr) ? 0 :                                                       \
33           (__assert_fail (#expr,                                     \
34                           __FILE__, __LINE__, __ASSERT_FUNCTION), 0)))
35#endif
36#endif
37
38
39#endif
Note: See TracBrowser for help on using the repository browser.