QP/C  7.3.4
Real-Time Embedded Framework
Loading...
Searching...
No Matches
qsafe.h
Go to the documentation of this file.
1//$file${include::qsafe.h} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
2//
3// Model: qpc.qm
4// File: ${include::qsafe.h}
5//
6// This code has been generated by QM 6.1.1 <www.state-machine.com/qm>.
7// DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost.
8//
9// This code is covered by the following QP license:
10// License # : LicenseRef-QL-dual
11// Issued to : Any user of the QP/C real-time embedded framework
12// Framework(s) : qpc
13// Support ends : 2024-12-31
14// License scope:
15//
16// Copyright (C) 2005 Quantum Leaps, LLC <state-machine.com>.
17//
18// Q u a n t u m L e a P s
19// ------------------------
20// Modern Embedded Software
21//
22// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial
23//
24// This software is dual-licensed under the terms of the open source GNU
25// General Public License version 3 (or any later version), or alternatively,
26// under the terms of one of the closed source Quantum Leaps commercial
27// licenses.
28//
29// The terms of the open source GNU General Public License version 3
30// can be found at: <www.gnu.org/licenses/gpl-3.0>
31//
32// The terms of the closed source Quantum Leaps commercial licenses
33// can be found at: <www.state-machine.com/licensing>
34//
35// Redistributions in source code must retain this top-level comment block.
36// Plagiarizing this software to sidestep the license obligations is illegal.
37//
38// Contact information:
39// <www.state-machine.com/licensing>
40// <info@state-machine.com>
41//
42//$endhead${include::qsafe.h} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
43#ifndef QSAFE_H_
44#define QSAFE_H_
45
46#ifdef __cplusplus
47extern "C" {
48#endif
49
50// QF-FuSa enabled ===========================================================
51#ifndef Q_UNSAFE
52
53#ifndef QF_CRIT_STAT
54#define QF_CRIT_STAT
55#endif
56
57#ifndef QF_CRIT_ENTRY
58#define QF_CRIT_ENTRY() ((void)0)
59#endif
60
61#ifndef QF_CRIT_EXIT
62#define QF_CRIT_EXIT() ((void)0)
63#endif
64
65//$declare${QP-FuSa::enabled} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
66
67//${QP-FuSa::enabled::Q_DEFINE_THIS_MODULE} ..................................
68#define Q_DEFINE_THIS_MODULE(name_) \
69 static char const Q_this_module_[] = name_;
70
71//${QP-FuSa::enabled::Q_ASSERT_INCRIT} .......................................
72#define Q_ASSERT_INCRIT(id_, expr_) \
73 ((expr_) ? ((void)0) : Q_onError(&Q_this_module_[0], (id_)))
74
75//${QP-FuSa::enabled::Q_ERROR_INCRIT} ........................................
76#define Q_ERROR_INCRIT(id_) \
77 (Q_onError(&Q_this_module_[0], (id_)))
78
79//${QP-FuSa::enabled::Q_ASSERT_ID} ...........................................
80#define Q_ASSERT_ID(id_, expr_) do { \
81 QF_CRIT_STAT \
82 QF_CRIT_ENTRY(); \
83 (expr_) ? ((void)0) : Q_onError(&Q_this_module_[0], (id_)); \
84 QF_CRIT_EXIT(); \
85} while (false)
86
87//${QP-FuSa::enabled::Q_ERROR_ID} ............................................
88#define Q_ERROR_ID(id_) do { \
89 QF_CRIT_STAT \
90 QF_CRIT_ENTRY(); \
91 Q_onError(&Q_this_module_[0], (id_)); \
92 QF_CRIT_EXIT(); \
93} while (false)
94//$enddecl${QP-FuSa::enabled} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
95
96// QF-FuSa disabled ==========================================================
97#else
98//$declare${QP-FuSa::disabled} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
99
100//${QP-FuSa::disabled::Q_DEFINE_THIS_MODULE} .................................
101#define Q_DEFINE_THIS_MODULE(name_)
102
103//${QP-FuSa::disabled::Q_ASSERT_INCRIT} ......................................
104#define Q_ASSERT_INCRIT(id_, expr_) ((void)0)
105
106//${QP-FuSa::disabled::Q_ERROR_INCRIT} .......................................
107#define Q_ERROR_INCRIT(id_) ((void)0)
108
109//${QP-FuSa::disabled::Q_ASSERT_ID} ..........................................
110#define Q_ASSERT_ID(id_, expr_) ((void)0)
111
112//${QP-FuSa::disabled::Q_ERROR_ID} ...........................................
113#define Q_ERROR_ID(id_) ((void)0)
114//$enddecl${QP-FuSa::disabled} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
115#endif
116
117//============================================================================
118//$declare1${QP-FuSa} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
119
120//${QP-FuSa::Q_DEFINE_THIS_FILE} .............................................
121#define Q_DEFINE_THIS_FILE Q_DEFINE_THIS_MODULE(__FILE__)
122
123//${QP-FuSa::Q_ASSERT} .......................................................
124#define Q_ASSERT(expr_) Q_ASSERT_ID(__LINE__, (expr_))
125
126//${QP-FuSa::Q_ERROR} ........................................................
127#define Q_ERROR() Q_ERROR_ID(__LINE__)
128
129//${QP-FuSa::Q_REQUIRE_ID} ...................................................
130#define Q_REQUIRE_ID(id_, expr_) Q_ASSERT_ID((id_), (expr_))
131
132//${QP-FuSa::Q_REQUIRE} ......................................................
133#define Q_REQUIRE(expr_) Q_ASSERT(expr_)
134
135//${QP-FuSa::Q_REQUIRE_INCRIT} ...............................................
136#define Q_REQUIRE_INCRIT(id_, expr_) Q_ASSERT_INCRIT((id_), (expr_))
137
138//${QP-FuSa::Q_ENSURE_ID} ....................................................
139#define Q_ENSURE_ID(id_, expr_) Q_ASSERT_ID((id_), (expr_))
140
141//${QP-FuSa::Q_ENSURE} .......................................................
142#define Q_ENSURE(expr_) Q_ASSERT(expr_)
143
144//${QP-FuSa::Q_ENSURE_INCRIT} ................................................
145#define Q_ENSURE_INCRIT(id_, expr_) Q_ASSERT_INCRIT((id_), (expr_))
146
147//${QP-FuSa::Q_INVARIANT_ID} .................................................
148#define Q_INVARIANT_ID(id_, expr_) Q_ASSERT_ID((id_), (expr_))
149
150//${QP-FuSa::Q_INVARIANT} ....................................................
151#define Q_INVARIANT(expr_) Q_ASSERT(expr_)
152
153//${QP-FuSa::Q_ASSERT_STATIC} ................................................
154#define Q_ASSERT_STATIC(expr_) extern char Q_static_assert_[(expr_) ? 1 : -1]
155
156//${QP-FuSa::Q_NORETURN} .....................................................
157#ifndef Q_NORETURN
158#define Q_NORETURN _Noreturn void
159#endif // ndef Q_NORETURN
160
161//${QP-FuSa::int_t} ..........................................................
162#ifndef QP_VERSION
163typedef int int_t;
164#endif // ndef QP_VERSION
165
166//${QP-FuSa::Q_onError} ......................................................
168 char const * const module,
169 int_t const id);
170
171//${QP-FuSa::Q_DIM} ..........................................................
172#ifndef QP_VERSION
173#define Q_DIM(array_) (sizeof(array_) / sizeof((array_)[0U]))
174#endif // ndef QP_VERSION
175//$enddecl${QP-FuSa} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
176
177#ifdef __cplusplus
178}
179#endif
180
181#endif // QSAFE_H_
int int_t
Definition qp.h:106
#define Q_NORETURN
Definition qsafe.h:158
Q_NORETURN Q_onError(char const *const module, int_t const id)
int int_t
Definition qsafe.h:163