AVR-LibC
2.3.0
Standard C library for AVR-GCC
AVR-LibC Manual
AVR-LibC Sources
Main Page
User Manual
Library Reference
FAQ
Example Projects
Index
Loading...
Searching...
No Matches
source
avr-libc-onlinedocs
include
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
/** \file */
37
/** \defgroup avr_assert <assert.h>: Diagnostics
38
\code #include <assert.h> \endcode
39
40
This header file defines a debugging aid.
41
42
As there is no standard error output stream available for many
43
applications using this library, the generation of a printable
44
error message is not enabled by default. These messages will
45
only be generated if the application defines the macro
46
47
\code __ASSERT_USE_STDERR \endcode
48
49
before including the \c <assert.h> header file. By default,
50
only abort() will be called to halt the application.
51
*/
52
53
/**@{*/
54
55
/*
56
* The ability to include this file (with or without NDEBUG) is a
57
* feature.
58
*/
59
60
#undef assert
61
62
#include <
stdlib.h
>
63
64
#if defined(__DOXYGEN__)
65
/**
66
\def assert
67
\param expression Expression to test for.
68
69
The assert() macro tests the given expression and if it is false,
70
the calling process is terminated by calling abort().
71
When the macro \c __ASSERT_USE_STDERR was defined prior to including
72
\c <assert.h>, then a diagnostic message is written to \c stderr.
73
74
If expression is true, the assert() macro does nothing.
75
76
The assert() macro may be removed at compile time by defining
77
NDEBUG as a macro (e.g., by using the compiler option -DNDEBUG).
78
*/
79
# define assert(expression)
80
81
#else
/* !DOXYGEN */
82
83
# if defined(NDEBUG)
84
# define assert(e) ((void)0)
85
# else
/* !NDEBUG */
86
# if defined(__ASSERT_USE_STDERR)
87
# define assert(e) ((e) ? (void)0 : \
88
__assert(__func__, __FILE__, __LINE__, #e))
89
# else
/* !__ASSERT_USE_STDERR */
90
# define assert(e) ((e) ? (void)0 : abort())
91
# endif
/* __ASSERT_USE_STDERR */
92
# endif
/* NDEBUG */
93
#endif
/* DOXYGEN */
94
95
#if (defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L) || \
96
((_GNUC_ > 4 || (_GNUC_ == 4 && _GNUC_MINOR_ >= 6)) && !defined __cplusplus)
97
# undef static_assert
98
# define static_assert _Static_assert
99
#endif
100
101
#ifdef __cplusplus
102
extern
"C"
{
103
#endif
104
105
#if !defined(__DOXYGEN__)
106
107
extern
void
__assert(
const
char
*__func,
const
char
*__file,
108
int
__lineno,
const
char
*__sexp);
109
110
#endif
/* not __DOXYGEN__ */
111
112
#ifdef __cplusplus
113
}
114
#endif
115
116
/**@}*/
117
/* EOF */
stdlib.h
Generated on Sun Dec 28 2025 13:38:37 for AVR-LibC by
1.9.6