AvrIO  1.4.5
Bibliothèque C modulaire pour ATMEL AVR
assert.h
1 /* Copyright (c) 2005,2007 Joerg Wunsch
2  All rights reserved.
3 
4  Portions of documentation Copyright (c) 1991, 1993
5  The Regents of the University of California.
6 
7  All rights reserved.
8 
9  Redistribution and use in source and binary forms, with or without
10  modification, are permitted provided that the following conditions are met:
11 
12  * Redistributions of source code must retain the above copyright
13  notice, this list of conditions and the following disclaimer.
14 
15  * Redistributions in binary form must reproduce the above copyright
16  notice, this list of conditions and the following disclaimer in
17  the documentation and/or other materials provided with the
18  distribution.
19 
20  * Neither the name of the copyright holders nor the names of
21  contributors may be used to endorse or promote products derived
22  from this software without specific prior written permission.
23 
24  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  POSSIBILITY OF SUCH DAMAGE.
35 
36  $Id: assert.h,v 1.3 2007/01/23 15:32:48 joerg_wunsch Exp $
37 */
38 
39 #include <stdlib.h>
40 
62 #undef assert
63 
64 #if defined(__DOXYGEN__)
65 
79 #define assert(expression)
80 
86 #else /* !DOXYGEN */
87 
88 #ifndef ASSERT_TYPE_EQUAL
89 
90 #define ASSERT_TYPE_EQUAL(var1, var2) \
91  do { (void)(&(var1) == &(var2)); } while(0)
92 #endif
93 
94 #ifndef ASSERT_TYPE_IS
95 
96 #define ASSERT_TYPE_IS(var, type) \
97  do { (void)(&(var) == (type *)0); } while(0)
98 #endif
99 
100 #if defined(NASSERT)
101 #define assert(e) ((void)0)
102 #else /* !NASSERT */
103 #if defined(__ASSERT_USE_STDERR)
104 #define assert(e) ((e) ? (void)0 : \
105  __assert(__func__, __LINE__, #e))
106 #else /* !__ASSERT_USE_STDERR */
107 #define assert(e) ((e) ? (void)0 : abort())
108 #endif /* __ASSERT_USE_STDERR */
109 #endif /* NASSERT */
110 #endif /* DOXYGEN */
111 
112 #ifdef __cplusplus
113 extern "C" {
114 #endif
115 
116 #if !defined(__DOXYGEN__)
117 
118 extern void __assert (const char *__func, int __lineno, const char *__sexp);
119 
120 #endif /* not __DOXYGEN__ */
121 
122 #ifdef __cplusplus
123 }
124 #endif
125 
127 /* EOF */