AVR Libc Home Page |  | AVR Libc Development Pages
Main Page | User Manual | Library Reference | FAQ | Alphabetical Index | Example Projects

assert.h
Go to the documentation of this file.
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 1196 2007-01-23 15:34:58Z joerg_wunsch $
37 */
38
39 /** \file */
40 /** \defgroup avr_assert <assert.h>: Diagnostics
41 \code #include <assert.h> \endcode
42
43 This header file defines a debugging aid.
44
45 As there is no standard error output stream available for many
46 applications using this library, the generation of a printable
47 error message is not enabled by default. These messages will
48 only be generated if the application defines the macro
49
50 \code __ASSERT_USE_STDERR \endcode
51
52 before including the \c <assert.h> header file. By default,
53 only abort() will be called to halt the application.
54 */
55
56 /*@{*/
57
58 /*
59 * The ability to include this file (with or without NDEBUG) is a
60 * feature.
61 */
62
63 #undef assert
64
65 #if defined(__DOXYGEN__)
66 /**
67 * \def assert
68 * \param expression Expression to test for.
69 *
70 * The assert() macro tests the given expression and if it is false,
71 * the calling process is terminated. A diagnostic message is written
72 * to stderr and the function abort() is called, effectively
73 * terminating the program.
74 *
75 * If expression is true, the assert() macro does nothing.
76 *
77 * The assert() macro may be removed at compile time by defining
78 * NDEBUG as a macro (e.g., by using the compiler option -DNDEBUG).
79 */
80 # define assert(expression)
81
82 #else /* !DOXYGEN */
83
84 # if defined(NDEBUG)
85 # define assert(e) ((void)0)
86 # else /* !NDEBUG */
87 # if defined(__ASSERT_USE_STDERR)
88 # define assert(e) ((e) ? (void)0 : \
89 __assert(__func__, __FILE__, __LINE__, #e))
90 # else /* !__ASSERT_USE_STDERR */
91 # define assert(e) ((e) ? (void)0 : abort())
92 # endif /* __ASSERT_USE_STDERR */
93 # endif /* NDEBUG */
94 #endif /* DOXYGEN */
95
96 #ifdef __cplusplus
97 extern "C" {
98 #endif
99
100 #if !defined(__DOXYGEN__)
101
102 extern void __assert(const char *__func, const char *__file,
103 int __lineno, const char *__sexp);
104
105 #endif /* not __DOXYGEN__ */
106
107 #ifdef __cplusplus
108 }
109 #endif
110
111 /*@}*/
112 /* EOF */

Automatically generated by Doxygen 1.8.3.1 on Sun Sep 29 2013.