AVR Libc Home Page | AVR Libc Development Pages | ||||
Main Page | User Manual | Library Reference | FAQ | Alphabetical Index | Example Projects |
00001 /* Copyright (c) 2005,2007 Joerg Wunsch 00002 All rights reserved. 00003 00004 Portions of documentation Copyright (c) 1991, 1993 00005 The Regents of the University of California. 00006 00007 All rights reserved. 00008 00009 Redistribution and use in source and binary forms, with or without 00010 modification, are permitted provided that the following conditions are met: 00011 00012 * Redistributions of source code must retain the above copyright 00013 notice, this list of conditions and the following disclaimer. 00014 00015 * Redistributions in binary form must reproduce the above copyright 00016 notice, this list of conditions and the following disclaimer in 00017 the documentation and/or other materials provided with the 00018 distribution. 00019 00020 * Neither the name of the copyright holders nor the names of 00021 contributors may be used to endorse or promote products derived 00022 from this software without specific prior written permission. 00023 00024 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00025 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00026 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00027 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00028 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00029 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00030 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00031 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00032 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00033 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00034 POSSIBILITY OF SUCH DAMAGE. 00035 00036 $Id: assert.h 1196 2007-01-23 15:34:58Z joerg_wunsch $ 00037 */ 00038 00039 /** \file */ 00040 /** \defgroup avr_assert <assert.h>: Diagnostics 00041 \code #include <assert.h> \endcode 00042 00043 This header file defines a debugging aid. 00044 00045 As there is no standard error output stream available for many 00046 applications using this library, the generation of a printable 00047 error message is not enabled by default. These messages will 00048 only be generated if the application defines the macro 00049 00050 \code __ASSERT_USE_STDERR \endcode 00051 00052 before including the \c <assert.h> header file. By default, 00053 only abort() will be called to halt the application. 00054 */ 00055 00056 /*@{*/ 00057 00058 /* 00059 * The ability to include this file (with or without NDEBUG) is a 00060 * feature. 00061 */ 00062 00063 #undef assert 00064 00065 #if defined(__DOXYGEN__) 00066 /** 00067 * \def assert 00068 * \param expression Expression to test for. 00069 * 00070 * The assert() macro tests the given expression and if it is false, 00071 * the calling process is terminated. A diagnostic message is written 00072 * to stderr and the function abort() is called, effectively 00073 * terminating the program. 00074 * 00075 * If expression is true, the assert() macro does nothing. 00076 * 00077 * The assert() macro may be removed at compile time by defining 00078 * NDEBUG as a macro (e.g., by using the compiler option -DNDEBUG). 00079 */ 00080 # define assert(expression) 00081 00082 #else /* !DOXYGEN */ 00083 00084 # if defined(NDEBUG) 00085 # define assert(e) ((void)0) 00086 # else /* !NDEBUG */ 00087 # if defined(__ASSERT_USE_STDERR) 00088 # define assert(e) ((e) ? (void)0 : \ 00089 __assert(__func__, __FILE__, __LINE__, #e)) 00090 # else /* !__ASSERT_USE_STDERR */ 00091 # define assert(e) ((e) ? (void)0 : abort()) 00092 # endif /* __ASSERT_USE_STDERR */ 00093 # endif /* NDEBUG */ 00094 #endif /* DOXYGEN */ 00095 00096 #ifdef __cplusplus 00097 extern "C" { 00098 #endif 00099 00100 #if !defined(__DOXYGEN__) 00101 00102 extern void __assert(const char *__func, const char *__file, 00103 int __lineno, const char *__sexp); 00104 00105 #endif /* not __DOXYGEN__ */ 00106 00107 #ifdef __cplusplus 00108 } 00109 #endif 00110 00111 /*@}*/ 00112 /* EOF */