Skip to content

Commit e10fded

Browse files
add additional warnings to the library build and misc clean up
switch to ubuntu 24.04 for github build
1 parent 590a095 commit e10fded

8 files changed

Lines changed: 18 additions & 17 deletions

File tree

.github/workflows/cmake.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ env:
1212

1313
jobs:
1414
build:
15-
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
15+
# The CMake configure and build commands are platform-agnostic and should work equally well on Windows or Mac.
1616
# You can convert this to a matrix build if you need cross-platform coverage.
1717
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
18-
runs-on: ubuntu-22.04
18+
runs-on: ubuntu-24.04
1919

2020
steps:
2121
- uses: actions/checkout@v3

cpputest-for-qpc-lib/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ add_library(cpputest-for-qpc-lib
1616
target_link_libraries(cpputest-for-qpc-lib qassert-meta-lib)
1717
add_subdirectory(tests)
1818
19+
target_compile_options(cpputest-for-qpc-lib PRIVATE -Wall -Wextra -Werror -Wpedantic -Wsign-conversion)
20+
1921
target_include_directories(cpputest-for-qpc-lib PUBLIC
2022
${CMS_QPC_INCLUDE_DIR}
2123
include)

cpputest-for-qpc-lib/include/cmsTestPublishedEventRecorder.hpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include "cmsDummyActiveObject.hpp"
3030
#include "cmsVectorBackedQEQueue.hpp"
3131
#include "qevtUniquePtr.hpp"
32-
#include <vector>
3332

3433
namespace cms {
3534
namespace test {
@@ -60,7 +59,7 @@ class PublishedEventRecorder final : public DefaultDummyActiveObject {
6059

6160
/// Upon construction and init/start, this active object will
6261
/// subscribe and record all events in the signal range:
63-
/// [startingValue .. endValue)
62+
/// [startingValue ... endValue)
6463
/// \param startingValue - starting sig value the recorder will record
6564
/// \param endValue - final value in sig range to record. This value is
6665
/// NOT recorded, rather "endValue - 1" is recorded.
@@ -102,11 +101,11 @@ class PublishedEventRecorder final : public DefaultDummyActiveObject {
102101
}
103102
}
104103

105-
bool isEmpty() { return m_recordedEvents.isEmpty(); }
104+
bool isEmpty() const { return m_recordedEvents.isEmpty(); }
106105

107-
bool isAnyEventRecorded() { return !m_recordedEvents.isEmpty(); }
106+
bool isAnyEventRecorded() const { return !m_recordedEvents.isEmpty(); }
108107

109-
bool isSignalRecorded(enum_t sig)
108+
bool isSignalRecorded(const enum_t sig)
110109
{
111110
if (!isAnyEventRecorded()) {
112111
return false;
@@ -117,10 +116,10 @@ class PublishedEventRecorder final : public DefaultDummyActiveObject {
117116
return recordedSig == sig;
118117
}
119118

120-
cms::QEvtUniquePtr getRecordedEvent()
119+
QEvtUniquePtr getRecordedEvent()
121120
{
122121
if (!isAnyEventRecorded()) {
123-
return cms::QEvtUniquePtr();
122+
return {};
124123
}
125124

126125
return cms::QEvtUniquePtr(m_recordedEvents.get());

cpputest-for-qpc-lib/include/cms_cpputest_qf_ctrl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ void PublishEvent(QEvt const * e);
9999
/// Publish a trivial QEvt event to the QF framework followed internally
100100
/// by ProcessEvents().
101101
/// \param sig
102-
/// \param recorder, if provided, will automatically ensure the published
102+
/// \param recorder if provided, will automatically ensure the published
103103
/// event is ignored by the recorder.
104104
void PublishAndProcess(enum_t sig,
105105
PublishedEventRecorder* recorder = nullptr);

cpputest-for-qpc-lib/include/qevtUniquePtr.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ namespace cms {
3131

3232
/// I love a nice RAII pattern, such as std::unique_ptr.
3333
/// A QEvt may have been allocated from an event pool, which must be
34-
/// garbage collected. This is easy to forget, and is therefore more error
35-
/// prone, especially when deferring events or recording events. This
34+
/// garbage collected. This is easy to forget, and is therefore more
35+
/// error-prone, especially when deferring events or recording events. This
3636
/// class helps guarantee that the event is appropriately garbage collected.
3737
///
3838
/// https://covemountainsoftware.com/2019/11/26/why-i-prefer-c-raii-all-the-things/
@@ -53,7 +53,7 @@ class QEvtUniquePtr {
5353
}
5454
}
5555

56-
QEvtUniquePtr(QEvtUniquePtr&& o) noexcept : m_evt(std::move(o.m_evt))
56+
QEvtUniquePtr(QEvtUniquePtr&& o) noexcept : m_evt(o.m_evt)
5757
{
5858
o.m_evt = nullptr;
5959
}
@@ -69,7 +69,7 @@ class QEvtUniquePtr {
6969

7070
bool operator!=(void* ptr) const { return ptr != m_evt; }
7171

72-
const QEvt* get() noexcept { return m_evt; }
72+
const QEvt* get() const noexcept { return m_evt; }
7373

7474
private:
7575
QEvt const* m_evt;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/// @brief Provides an implementation of the required QP function
2-
/// Q_onAssert(..).
2+
/// Q_onAssert(...).
33
/// This implementation uses cpputest mock and the TEST_EXIT macro
44
/// which throws an exception. This will generally not work in most
55
/// of QP, as most methods are marked noexcept.

cpputest-for-qpc-lib/src/cms_cpputest_qf_ctrl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ void Setup(enum_t const maxPubSubSignalValue, uint32_t ticksPerSecond,
6868
l_memPoolOption = memPoolOpt;
6969
l_ticksPerSecond = ticksPerSecond;
7070
l_subscriberStorage = new SubscriberList();
71-
l_subscriberStorage->resize(maxPubSubSignalValue);
71+
l_subscriberStorage->resize(static_cast<size_t>(maxPubSubSignalValue));
7272
QSubscrList nullValue;
7373
QPSet_setEmpty(&nullValue.set);
7474
QPSet_setEmpty(&nullValue.set_dis);

cpputest-for-qpc-lib/src/cpputest_qf_port.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ extern "C" void QF_init(void)
4141
++tickRate)
4242
{
4343
QTimeEvt_ctorX(&QTimeEvt_timeEvtHead_[tickRate],
44-
(QActive *)0, Q_USER_SIG, tickRate);
44+
nullptr, Q_USER_SIG, tickRate);
4545
}
4646

4747
bzero(&QActive_registry_[0], static_cast<uint_fast16_t>(sizeof(QActive_registry_)));

0 commit comments

Comments
 (0)