Skip to content

Commit 484e4de

Browse files
Update to QP/C++ v7.3.4, which is not backwards compatible to v7.2.*.
1 parent 4d51823 commit 484e4de

17 files changed

+155
-266
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ if(NOT DEFINED CMS_QPCPP_TOP_DIR)
1414
set(CMS_QPCPP_TOP_DIR ${CMS_EXTERNALS_TOP_DIR}/qpcpp)
1515
FetchContent_Declare(qpcpp
1616
GIT_REPOSITORY https://github.com/QuantumLeaps/qpcpp.git
17-
GIT_TAG 6b7d766521a5c9681f61922a64027690721c2478 #7.2.1
17+
GIT_TAG 10441f7a03fa956b9e4772a073a05a96487983e2 #7.3.4
1818
SOURCE_DIR ${CMS_QPCPP_TOP_DIR}
1919
)
2020
message("Fetching QP/C++ git repository")

cpputest-for-qpcpp-lib/include/cmsDummyActiveObject.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ class DummyActiveObject : public QP::QActive {
4848
m_incomingEvents.fill(nullptr);
4949
}
5050

51+
virtual ~DummyActiveObject() = default;
52+
5153
DummyActiveObject(const DummyActiveObject&) = delete;
5254
DummyActiveObject& operator=(const DummyActiveObject&) = delete;
5355
DummyActiveObject(DummyActiveObject&&) = delete;

cpputest-for-qpcpp-lib/include/cmsOrthogonalComponent.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class OrthogonalComponent : public QP::QHsm {
4444
m_container(container), m_qs_id(qs_id)
4545
{
4646
}
47+
virtual ~OrthogonalComponent() = default;
4748

4849
OrthogonalComponent(const OrthogonalComponent&) = delete;
4950
OrthogonalComponent& operator=(const OrthogonalComponent&) = delete;

cpputest-for-qpcpp-lib/include/cmsOrthogonalContainer.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ class OrthogonalContainer : public QP::QActive {
5555
{
5656
}
5757

58+
virtual ~OrthogonalContainer() = default;
59+
5860
protected:
5961
// The 'ForEachInTuple' support inspired by:
6062
// https://stackoverflow.com/questions/26902633/how-to-iterate-over-a-stdtuple-in-c-11

cpputest-for-qpcpp-lib/include/qassertMockSupport.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,27 @@
2525
#define CPPUTEST_FOR_QPCPP_QASSERTMOCKSUPPORT_HPP
2626

2727
#include "CppUTestExt/MockSupport.h"
28-
#include "qassert.h"
28+
#include "qsafe.h"
2929

3030
namespace cms {
3131
namespace test {
3232

3333
static constexpr const char* QASSERT_MOCK_NAME = "QASSERT";
34-
static constexpr const char* ONASSERT_FUNC_NAME = "Q_onAssert";
34+
static constexpr const char* ONERROR_FUNC_NAME = "Q_onError";
3535

3636
inline void MockExpectQAssert()
3737
{
3838
mock(QASSERT_MOCK_NAME)
39-
.expectOneCall(ONASSERT_FUNC_NAME)
39+
.expectOneCall(ONERROR_FUNC_NAME)
4040
.ignoreOtherParameters();
4141
}
4242

43-
inline void MockExpectQAssert(const char* file, int loc)
43+
inline void MockExpectQAssert(const char* module, int id)
4444
{
4545
mock(QASSERT_MOCK_NAME)
46-
.expectOneCall(ONASSERT_FUNC_NAME)
47-
.withParameter("file", file)
48-
.withParameter("loc", loc);
46+
.expectOneCall(ONERROR_FUNC_NAME)
47+
.withParameter("module", module)
48+
.withParameter("id", id);
4949
}
5050

5151
} // namespace test

cpputest-for-qpcpp-lib/include/qep_port.hpp

Lines changed: 0 additions & 50 deletions
This file was deleted.

cpputest-for-qpcpp-lib/include/qf_port.hpp

Lines changed: 0 additions & 151 deletions
This file was deleted.
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
//
2+
//
3+
//
4+
5+
#ifndef CPPUTEST_FOR_QPCPP_LIB_QP_PORT_HPP
6+
#define CPPUTEST_FOR_QPCPP_LIB_QP_PORT_HPP
7+
8+
#include <cstdint> // Exact-width types. C++11 Standard
9+
10+
#ifdef QP_CONFIG
11+
#include "qp_config.hpp" // external QP configuration
12+
#endif
13+
14+
// no-return function specifier (C++11 Standard)
15+
// removed due to certain cpputest test functions
16+
#define Q_NORETURN void
17+
18+
#define QACTIVE_EQUEUE_TYPE QEQueue
19+
#define QF_EPOOL_TYPE_ QMPool
20+
21+
// QF critical section for POSIX-QV, see NOTE1
22+
#define QF_CRIT_STAT
23+
#define QF_CRIT_ENTRY()
24+
#define QF_CRIT_EXIT()
25+
26+
27+
// Activate the QF QActive::stop() API
28+
#define QACTIVE_CAN_STOP 1
29+
30+
// QF_LOG2 not defined -- use the internal LOG2() implementation
31+
32+
#include "qequeue.hpp" // QP event queue (for deferring events)
33+
#include "qmpool.hpp" // QP memory pool (for event pools)
34+
#include "qp.hpp" // QP platform-independent public interface
35+
36+
37+
namespace QP {
38+
39+
void RunUntilNoReadyActiveObjects();
40+
41+
} // namespace QP
42+
43+
//============================================================================
44+
// interface used only inside QF implementation, but not in applications
45+
46+
#ifdef QP_IMPL
47+
48+
// QF scheduler locking for POSIX-QV (not needed in single-thread port)
49+
#define QF_SCHED_STAT_
50+
#define QF_SCHED_LOCK_(dummy) (static_cast<void>(0))
51+
#define QF_SCHED_UNLOCK_() (static_cast<void>(0))
52+
53+
#define QACTIVE_EQUEUE_WAIT_(me_) \
54+
Q_ASSERT_INCRIT(302, (me_)->m_eQueue.m_frontEvt != nullptr)
55+
56+
57+
58+
#define QACTIVE_EQUEUE_SIGNAL_(me_) do { \
59+
cpputest_readySet_.insert((me_)->m_prio); \
60+
} while (false)
61+
62+
// native QF event pool operations
63+
#define QF_EPOOL_TYPE_ QMPool
64+
#define QF_EPOOL_INIT_(p_, poolSto_, poolSize_, evtSize_) \
65+
(p_).init((poolSto_), (poolSize_), (evtSize_))
66+
#define QF_EPOOL_EVENT_SIZE_(p_) ((p_).getBlockSize())
67+
#define QF_EPOOL_GET_(p_, e_, m_, qsId_) \
68+
((e_) = static_cast<QEvt *>((p_).get((m_), (qsId_))))
69+
#define QF_EPOOL_PUT_(p_, e_, qsId_) ((p_).put((e_), (qsId_)))
70+
71+
72+
namespace QP {
73+
extern QPSet cpputest_readySet_; // ready set of active objects
74+
} // namespace QP
75+
76+
namespace QP {
77+
namespace QF {
78+
79+
} // namespace QF
80+
} // namespace QP
81+
82+
#endif // QP_IMPL
83+
84+
#endif // CPPUTEST_FOR_QPCPP_LIB_QP_PORT_HPP

cpputest-for-qpcpp-lib/src/cms_cpputest_q_onAssert.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@
2727
/// @endcond
2828

2929
#include "CppUTest/TestHarness.h"
30-
#include "qassert.h"
30+
#include "qp_port.hpp"
31+
#include "qsafe.h"
3132
#include "qassertMockSupport.hpp"
3233

33-
Q_NORETURN Q_onAssert(char const* const file, int_t const loc)
34+
void Q_onError(char const* const module, int_t const id)
3435
{
35-
// fprintf(stderr, "%s(%s , %d)\n", __FUNCTION__ , file, loc);
36+
//fprintf(stderr, "%s(%s , %d)\n", __FUNCTION__ , module, id);
3637

3738
// The TEST_EXIT macro used below is throwing an exception.
3839
// However, many of QP/QF methods are marked as 'noexcept'
@@ -46,9 +47,9 @@ Q_NORETURN Q_onAssert(char const* const file, int_t const loc)
4647
// the function std::terminate ... is called ..."
4748
//
4849
mock(cms::test::QASSERT_MOCK_NAME)
49-
.actualCall(cms::test::ONASSERT_FUNC_NAME)
50-
.withParameter("file", file)
51-
.withParameter("loc", loc);
50+
.actualCall(cms::test::ONERROR_FUNC_NAME)
51+
.withParameter("module", module)
52+
.withParameter("id", id);
5253

5354
TEST_EXIT;
5455
}

0 commit comments

Comments
 (0)