Subversion Repositories Kolibri OS

Rev

Rev 4874 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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