Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4349 Serge 1
/*
2
	assert.h
3
*/
4
#ifndef _NEWLIB_ASSERT_H
5
#define _NEWLIB_ASSERT_H
6
 
7
#ifdef __cplusplus
8
extern "C" {
9
#endif
10
 
11
#include "_ansi.h"
12
 
13
#undef assert
14
 
15
#ifdef NDEBUG           /* required by ANSI standard */
16
# define assert(__e) ((void)0)
17
#else
18
# define assert(__e) ((__e) ? (void)0 : __assert_func (__FILE__, __LINE__, \
19
						       __ASSERT_FUNC, #__e))
20
 
21
# ifndef __ASSERT_FUNC
22
  /* Use g++'s demangled names in C++.  */
23
#  if defined __cplusplus && defined __GNUC__
24
#   define __ASSERT_FUNC __PRETTY_FUNCTION__
25
 
26
  /* C99 requires the use of __func__.  */
27
#  elif __STDC_VERSION__ >= 199901L
28
#   define __ASSERT_FUNC __func__
29
 
30
  /* Older versions of gcc don't have __func__ but can use __FUNCTION__.  */
31
#  elif __GNUC__ >= 2
32
#   define __ASSERT_FUNC __FUNCTION__
33
 
34
  /* failed to detect __func__ support.  */
35
#  else
36
#   define __ASSERT_FUNC ((char *) 0)
37
#  endif
38
# endif /* !__ASSERT_FUNC */
39
#endif /* !NDEBUG */
40
 
41
void _EXFUN(__assert, (const char *, int, const char *)
42
	    _ATTRIBUTE ((__noreturn__)));
43
void _EXFUN(__assert_func, (const char *, int, const char *, const char *)
44
	    _ATTRIBUTE ((__noreturn__)));
45
 
46
#ifdef __cplusplus
47
}
48
#endif
49
 
50
#endif /* _NEWLIB_ASSERT_H */