OpenCores
URL https://opencores.org/ocsvn/c0or1k/c0or1k/trunk

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [conts/] [posix/] [libposix/] [include/] [posix/] [assert.h] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 drasko
/* Copyright (C) 1991,1992,1994-2001,2003,2004 Free Software Foundation, Inc.
2
   This file is part of the GNU C Library.
3
 
4
   The GNU C Library is free software; you can redistribute it and/or
5
   modify it under the terms of the GNU Lesser General Public
6
   License as published by the Free Software Foundation; either
7
   version 2.1 of the License, or (at your option) any later version.
8
 
9
   The GNU C Library is distributed in the hope that it will be useful,
10
   but WITHOUT ANY WARRANTY; without even the implied warranty of
11
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
   Lesser General Public License for more details.
13
 
14
   You should have received a copy of the GNU Lesser General Public
15
   License along with the GNU C Library; if not, write to the Free
16
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17
   02111-1307 USA.  */
18
 
19
/*
20
 *      ISO C99 Standard: 7.2 Diagnostics       <assert.h>
21
 */
22
 
23
#ifdef  _ASSERT_H
24
 
25
# undef _ASSERT_H
26
# undef assert
27
# undef __ASSERT_VOID_CAST
28
 
29
#endif /* assert.h      */
30
 
31
#define _ASSERT_H       1
32
#include <features.h>
33
 
34
#if defined __cplusplus && __GNUC_PREREQ(2,95)
35
# define __ASSERT_VOID_CAST static_cast<void>
36
#else
37
# define __ASSERT_VOID_CAST (void)
38
#endif
39
 
40
/* void assert (int expression);
41
 
42
   If NDEBUG is defined, do nothing.
43
   If not, and EXPRESSION is zero, print an error message and abort.  */
44
 
45
#ifdef  NDEBUG
46
 
47
# define assert(expr)           (__ASSERT_VOID_CAST (0))
48
 
49
#else /* Not NDEBUG.  */
50
 
51
__BEGIN_DECLS
52
 
53
/* This prints an "Assertion failed" message and aborts.  */
54
extern void __assert __P((const char *, const char *, int, const char *));
55
 
56
__END_DECLS
57
 
58
# define assert(expr) \
59
  (__ASSERT_VOID_CAST ((expr) ? 0 :                                            \
60
                       (__assert (__STRING(expr), __FILE__, __LINE__,    \
61
                                       __ASSERT_FUNCTION), 0)))
62
 
63
/* Define some temporaries to workaround tinyx makedepend bug */
64
#define __GNUC_PREREQ_2_6       __GNUC_PREREQ(2, 6)
65
#define __GNUC_PREREQ_2_4       __GNUC_PREREQ(2, 4)
66
/* Version 2.4 and later of GCC define a magical variable `__PRETTY_FUNCTION__'
67
   which contains the name of the function currently being defined.
68
   This is broken in G++ before version 2.6.
69
   C9x has a similar variable called __func__, but prefer the GCC one since
70
   it demangles C++ function names.  */
71
 
72
# if defined __cplusplus ? __GNUC_PREREQ_2_6 : __GNUC_PREREQ_2_4
73
#   define __ASSERT_FUNCTION    __PRETTY_FUNCTION__
74
# else
75
#  if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
76
#   define __ASSERT_FUNCTION    __func__
77
#  else
78
#   define __ASSERT_FUNCTION    ((__const char *) 0)
79
#  endif
80
# endif
81
 
82
#endif /* NDEBUG.  */

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.