QP/C  8.0.0
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 7.0.0 <www.state-machine.com/qm>.
7// DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost.
8//
9// Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved.
10//
11// Q u a n t u m L e a P s
12// ------------------------
13// Modern Embedded Software
14//
15// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial
16//
17// The QP/C software is dual-licensed under the terms of the open-source GNU
18// General Public License (GPL) or under the terms of one of the closed-
19// source Quantum Leaps commercial licenses.
20//
21// Redistributions in source code must retain this top-level comment block.
22// Plagiarizing this software to sidestep the license obligations is illegal.
23//
24// NOTE:
25// The GPL does NOT permit the incorporation of this code into proprietary
26// programs. Please contact Quantum Leaps for commercial licensing options,
27// which expressly supersede the GPL and are designed explicitly for
28// closed-source distribution.
29//
30// Quantum Leaps contact information:
31// <www.state-machine.com/licensing>
32// <info@state-machine.com>
33//
34//$endhead${include::qsafe.h} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
35#ifndef QSAFE_H_
36#define QSAFE_H_
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
42// QF-FuSa enabled ===========================================================
43#ifndef Q_UNSAFE
44
45#ifndef QF_CRIT_STAT
46#define QF_CRIT_STAT
47#endif
48
49#ifndef QF_CRIT_ENTRY
50#define QF_CRIT_ENTRY() ((void)0)
51#endif
52
53#ifndef QF_CRIT_EXIT
54#define QF_CRIT_EXIT() ((void)0)
55#endif
56
57//$declare${QP-FuSa::enabled} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
58
59//${QP-FuSa::enabled::Q_DEFINE_THIS_MODULE} ..................................
60#define Q_DEFINE_THIS_MODULE(name_) \
61 static char const Q_this_module_[] = name_;
62
63//${QP-FuSa::enabled::Q_ASSERT_INCRIT} .......................................
64#define Q_ASSERT_INCRIT(id_, expr_) \
65 ((expr_) ? ((void)0) : Q_onError(&Q_this_module_[0], (id_)))
66
67//${QP-FuSa::enabled::Q_ERROR_INCRIT} ........................................
68#define Q_ERROR_INCRIT(id_) \
69 (Q_onError(&Q_this_module_[0], (id_)))
70
71//${QP-FuSa::enabled::Q_ASSERT_ID} ...........................................
72#define Q_ASSERT_ID(id_, expr_) do { \
73 QF_CRIT_STAT \
74 QF_CRIT_ENTRY(); \
75 (expr_) ? ((void)0) : Q_onError(&Q_this_module_[0], (id_)); \
76 QF_CRIT_EXIT(); \
77} while (false)
78
79//${QP-FuSa::enabled::Q_ERROR_ID} ............................................
80#define Q_ERROR_ID(id_) do { \
81 QF_CRIT_STAT \
82 QF_CRIT_ENTRY(); \
83 Q_onError(&Q_this_module_[0], (id_)); \
84 QF_CRIT_EXIT(); \
85} while (false)
86//$enddecl${QP-FuSa::enabled} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
87
88// QF-FuSa disabled ==========================================================
89#else
90//$declare${QP-FuSa::disabled} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
91
92//${QP-FuSa::disabled::Q_DEFINE_THIS_MODULE} .................................
93#define Q_DEFINE_THIS_MODULE(name_)
94
95//${QP-FuSa::disabled::Q_ASSERT_INCRIT} ......................................
96#define Q_ASSERT_INCRIT(id_, expr_) ((void)0)
97
98//${QP-FuSa::disabled::Q_ERROR_INCRIT} .......................................
99#define Q_ERROR_INCRIT(id_) ((void)0)
100
101//${QP-FuSa::disabled::Q_ASSERT_ID} ..........................................
102#define Q_ASSERT_ID(id_, expr_) ((void)0)
103
104//${QP-FuSa::disabled::Q_ERROR_ID} ...........................................
105#define Q_ERROR_ID(id_) ((void)0)
106//$enddecl${QP-FuSa::disabled} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
107#endif
108
109//============================================================================
110//$declare1${QP-FuSa} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
111
112//${QP-FuSa::Q_DEFINE_THIS_FILE} .............................................
113#define Q_DEFINE_THIS_FILE Q_DEFINE_THIS_MODULE(__FILE__)
114
115//${QP-FuSa::Q_ASSERT} .......................................................
116#define Q_ASSERT(expr_) Q_ASSERT_ID(__LINE__, (expr_))
117
118//${QP-FuSa::Q_ERROR} ........................................................
119#define Q_ERROR() Q_ERROR_ID(__LINE__)
120
121//${QP-FuSa::Q_REQUIRE_ID} ...................................................
122#define Q_REQUIRE_ID(id_, expr_) Q_ASSERT_ID((id_), (expr_))
123
124//${QP-FuSa::Q_REQUIRE} ......................................................
125#define Q_REQUIRE(expr_) Q_ASSERT(expr_)
126
127//${QP-FuSa::Q_REQUIRE_INCRIT} ...............................................
128#define Q_REQUIRE_INCRIT(id_, expr_) Q_ASSERT_INCRIT((id_), (expr_))
129
130//${QP-FuSa::Q_ENSURE_ID} ....................................................
131#define Q_ENSURE_ID(id_, expr_) Q_ASSERT_ID((id_), (expr_))
132
133//${QP-FuSa::Q_ENSURE} .......................................................
134#define Q_ENSURE(expr_) Q_ASSERT(expr_)
135
136//${QP-FuSa::Q_ENSURE_INCRIT} ................................................
137#define Q_ENSURE_INCRIT(id_, expr_) Q_ASSERT_INCRIT((id_), (expr_))
138
139//${QP-FuSa::Q_INVARIANT_ID} .................................................
140#define Q_INVARIANT_ID(id_, expr_) Q_ASSERT_ID((id_), (expr_))
141
142//${QP-FuSa::Q_INVARIANT} ....................................................
143#define Q_INVARIANT(expr_) Q_ASSERT(expr_)
144
145//${QP-FuSa::Q_INVARIANT_INCRIT} .............................................
146#define Q_INVARIANT_INCRIT(id_, expr_) Q_ASSERT_INCRIT((id_), (expr_))
147
148//${QP-FuSa::Q_ASSERT_STATIC} ................................................
149#define Q_ASSERT_STATIC(expr_) extern char Q_static_assert_[(expr_) ? 1 : -1]
150
151//${QP-FuSa::Q_NORETURN} .....................................................
152#ifndef Q_NORETURN
153#define Q_NORETURN _Noreturn void
154#endif // ndef Q_NORETURN
155
156//${QP-FuSa::int_t} ..........................................................
157#ifndef QP_VERSION
158typedef int int_t;
159#endif // ndef QP_VERSION
160
161//${QP-FuSa::Q_onError} ......................................................
163 char const * const module,
164 int_t const id);
165
166//${QP-FuSa::Q_DIM} ..........................................................
167#ifndef QP_VERSION
168#define Q_DIM(array_) (sizeof(array_) / sizeof((array_)[0U]))
169#endif // ndef QP_VERSION
170//$enddecl${QP-FuSa} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
171
172#ifdef __cplusplus
173}
174#endif
175
176#endif // QSAFE_H_
int int_t
Alias for assertion-ID numbers in QP assertions and return from QF_run()
Definition qp.h:96
#define Q_NORETURN
Definition qsafe.h:153
Q_NORETURN Q_onError(char const *const module, int_t const id)
int int_t
Definition qsafe.h:158