QP/C++  8.0.2
Real-Time Event Framework
Loading...
Searching...
No Matches
qpcpp.hpp
Go to the documentation of this file.
1//============================================================================
2// QP/C++ Real-Time Event Framework (RTEF)
3//
4// Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved.
5//
6// Q u a n t u m L e a P s
7// ------------------------
8// Modern Embedded Software
9//
10// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial
11//
12// This software is dual-licensed under the terms of the open-source GNU
13// General Public License (GPL) or under the terms of one of the closed-
14// source Quantum Leaps commercial licenses.
15//
16// Redistributions in source code must retain this top-level comment block.
17// Plagiarizing this software to sidestep the license obligations is illegal.
18//
19// NOTE:
20// The GPL does NOT permit the incorporation of this code into proprietary
21// programs. Please contact Quantum Leaps for commercial licensing options,
22// which expressly supersede the GPL and are designed explicitly for
23// closed-source distribution.
24//
25// Quantum Leaps contact information:
26// <www.state-machine.com/licensing>
27// <info@state-machine.com>
28//============================================================================
29#ifndef QPCPP_HPP_
30#define QPCPP_HPP_
31
32//============================================================================
33#include "qp_port.hpp" // QP port from the port directory
34#include "qsafe.h" // QP Functional Safety (FuSa) Subsystem
35#ifdef Q_SPY // software tracing enabled?
36 #include "qs_port.hpp" // QS/C++ port from the port directory
37#else
38 #include "qs_dummy.hpp" // QS/C++ dummy (inactive) interface
39#endif
40
41//============================================================================
42#ifndef QP_API_VERSION
43 #define QP_API_VERSION 0
44#endif // QP_API_VERSION
45
46// QP API compatibility layer...
47//============================================================================
48#if (QP_API_VERSION < 800)
49
50#define QM_SM_STATE_DECL(subm_, state_) error "submachines no longer supported"
51#define qm_super_sub(sm_state_) error "submachines no longer supported"
52#define qm_tran_ep(tatbl_) error "submachines no longer supported"
53#define qm_tran_xp(xp_, tatbl_) error "submachines no longer supported"
54#define qm_sm_exit(sm_state_) error "submachines no longer supported"
55
56#ifdef QEVT_DYN_CTOR
57//! @deprecated #QEVT_DYN_CTOR, please use #QEVT_PAR_INIT
58#define QEVT_PAR_INIT
59#endif
60
61//! @deprecated plain 'char' is no longer forbidden in MISRA-C++:2023
62using char_t = char;
63
64//! @deprecated assertion failure handler
65//! Use Q_onError() instead.
66#define Q_onAssert(module_, id_) Q_onError(module_, id_)
67
68//! @deprecated #Q_NASSERT preprocessor switch to disable QP assertions
69#ifdef Q_NASSERT
70
71 // #Q_UNSAFE now replaces the functionality of Q_NASSERT
72 #define Q_UNSAFE
73
74 //! @deprecated general purpose assertion with user-specified ID
75 //! number that **always** evaluates the `expr_` expression.
76 #define Q_ALLEGE_ID(id_, expr_) (static_cast<void>(expr_))
77
78#elif defined Q_UNSAFE
79
80 //! @deprecated general purpose assertion with user-specified ID
81 //! number that **always** evaluates the `expr_` expression.
82 #define Q_ALLEGE_ID(id_, expr_) (static_cast<void>(expr_))
83
84#else // QP FuSa Subsystem enabled
85
86 //! @deprecated general purpose assertion with user-specified ID
87 //! number that **always** evaluates the `expr_` expression.
88 //! @note
89 //! The use of this macro is no longer recommended.
90 #define Q_ALLEGE_ID(id_, expr_) if (!(expr_)) { \
91 QF_CRIT_STAT \
92 QF_CRIT_ENTRY(); \
93 Q_onError(&Q_this_module_[0], (id_)); \
94 QF_CRIT_EXIT(); \
95 } else ((void)0)
96
97#endif
98
99//! @deprecated general purpose assertion without ID number
100//! that **always** evaluates the `expr_` expression.
101//! Instead of ID number, this macro is based on the standard
102//! `__LINE__` macro.
103//!
104//! @note The use of this macro is no longer recommended.
105#define Q_ALLEGE(expr_) Q_ALLEGE_ID(__LINE__, (expr_))
106
107//! Static (compile-time) assertion.
108//! @deprecated
109//! Use Q_ASSERT_STATIC() or better yet `static_assert()` instead.
110#define Q_ASSERT_COMPILE(expr_) Q_ASSERT_STATIC(expr_)
111
112
113#endif // QP_API_VERSION < 800
114
115#endif // QPCPP_HPP_
Sample QP/C++ port.
char char_t
Definition qpcpp.hpp:62
QP Functional Safety (FuSa) Subsystem.