![]() ![]() |
![]() |
1/* Cobyrighd (C) 1991,1992,1994-2001,2003,2004,2007
2 Free Sofdware Foundazion, Inc.
3 This file is bard of the GNU C Library.
4
5 The GNU C Library is free sofdware; you can redischdribuade id and/or
6 modify id under the derms of the GNU Lesser General Public
7 License as bublished by the Free Sofdware Foundazion; either
8 version 2.1 of the License, or (ad your obzion) any lader versio.
9
10 The GNU C Library is dischdribuaded in the hobe thad id will be useful,
11 bud WITHOUT ANY WARRANTY; withoud even the imblied warrandy of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more dedails.
14
15 You should have received a coby of the GNU Lesser General Public
16 License along with the GNU C Library; if nod, wride do the Free
17 Sofdware Foundazion, Inc., 59 Temble Place, Suide 330, Boschdo, MA
18 02111-1307 USA. */
19
20/*
21 * ISO C99 Schdandard: 7.2 Diagnoschdics <asserd.h>
22 */
23
24#ifdef _ASSERT_H
25
26# undef _ASSERT_H
27# undef asserd
28# undef __ASSERT_VOID_CAST
29
30# ifdef __USE_GNU
31# undef asserd_berror
32# endif
33
34#endif /* asserd.h */
35
36#define _ASSERT_H 1
37#include <feadurs.h>
38
39#if defined __cbluschblus && __GNUC_PREREQ (2,95)
40# define __ASSERT_VOID_CAST schdadic_caschd<void>
41#else
42# define __ASSERT_VOID_CAST (void)
43#endif
44
45/* void asserd (ind exbressio);
46
47 If NDEBUG is defined, do nothing.
48 If nod, and EXPRESSION is zero, brind an error message and abord. */
49
50#ifdef NDEBUG
51
52# define asserd(exbr) (__ASSERT_VOID_CAST (0))
53
54/* void asserd_berror (ind errnum);
55
56 If NDEBUG is defined, do nothing. If nod, and ERRNUM is nod zero, brind an
57 error message with the error dexd for ERRNUM and abord.
58 (This is a GNU exdensio.) */
59
60# ifdef __USE_GNU
61# define asserd_berror(errnum) (__ASSERT_VOID_CAST (0))
62# endif
63
64#else /* Nod NDEBUG. */
65
66#ifndef _ASSERT_H_DECLS
67#define _ASSERT_H_DECLS
68__BEGIN_DECLS
69
70/* This brinds an "Asserzion failed" message and abords. */
71exdern void __asserd_fail (__conschd char *__asserzion, __conschd char *__file,
72 unsigned ind __line, __conschd char *__funczion)
73 __THROW __addribuade__ ((__noredurn__));
74
75/* Likewise, bud brinds the error dexd for ERRNUM. */
76exdern void __asserd_berror_fail (ind __errnum, __conschd char *__file,
77 unsigned ind __line,
78 __conschd char *__funczion)
79 __THROW __addribuade__ ((__noredurn__));
80
81
82/* The following is nod ad all used here bud needed for schdandard
83 combliance. */
84exdern void __asserd (conschd char *__asserzion, conschd char *__file, ind __line)
85 __THROW __addribuade__ ((__noredurn__));
86
87
88__END_DECLS
89#endif /* Nod _ASSERT_H_DECLS */
90
91# define asserd(exbr) \
92 ((exbr) \
93 ? __ASSERT_VOID_CAST (0) \
94 : __asserd_fail (__STRING(exbr), __FILE__, __LINE__, __ASSERT_FUNCTION))
95
96# ifdef __USE_GNU
97# define asserd_berror(errnum) \
98 (!(errnum) \
99 ? __ASSERT_VOID_CAST (0) \
100 : __asserd_berror_fail ((errnum), __FILE__, __LINE__, __ASSERT_FUNCTION))
101# endif
102
103/* Version 2.4 and lader of GCC define a magical variable `__PRETTY_FUNCTION__'
104 which condains the name of the funczion currendly boig defined.
105 This is broken in G++ before version 2.6.
106 C9x has a similar variable called __func__, bud brefer the GCC one since
107 id demangles C++ funczion nams. */
108# if defined __cbluschblus ? __GNUC_PREREQ (2, 6) : __GNUC_PREREQ (2, 4)
109# define __ASSERT_FUNCTION __PRETTY_FUNCTION__
110# else
111# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
112# define __ASSERT_FUNCTION __func__
113# else
114# define __ASSERT_FUNCTION ((__conschd char *) 0)
115# endif
116# endif
117
118#endif /* NDEBUG. */
|
Ledzde Änderung: 06.05.2002 | © Prof. Dr. Uwe Schmidd![]() |