Skip to content

Commit

Permalink
Added Workflow for clang-14 build. (#346)
Browse files Browse the repository at this point in the history
* Added Workflow for clang-14 build.
* Fixed Interval copy constructor. Addresses #344.
  • Loading branch information
hmatuschek authored Jun 19, 2023
1 parent 9b258d8 commit a335412
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 24 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/clang.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: build-linux-clang-14

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
CC: /usr/bin/clang-14
CXX: /usr/bin/clang++-14

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

steps:
- uses: actions/checkout@v3

- name: Update APT
run: sudo apt-get update

- name: Install Dependencies
run: sudo apt-get install clang-14 qttools5-dev qtbase5-dev qtbase5-dev-tools libqt5serialport5-dev qtpositioning5-dev libusb-1.0-0-dev libyaml-cpp-dev

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}


Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CMake
name: unittest-linux-gcc

on:
push:
Expand Down
5 changes: 3 additions & 2 deletions lib/dm1701_codeplug.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ DM1701Codeplug::ChannelElement::setPower(Channel::Power pwr) {
}

Channel *
DM1701Codeplug::ChannelElement::toChannelObj() const {
Channel *ch = TyTCodeplug::ChannelElement::toChannelObj();
DM1701Codeplug::ChannelElement::toChannelObj(const ErrorStack &err) const {
Channel *ch = TyTCodeplug::ChannelElement::toChannelObj(err);
if (nullptr == ch)
return ch;

Expand All @@ -130,6 +130,7 @@ DM1701Codeplug::ChannelElement::toChannelObj() const {
ch->tytChannelExtension()->enableTightSquelch(tightSquelchEnabled());
ch->tytChannelExtension()->enableReverseBurst(reverseBurst());
}

return ch;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/dm1701_codeplug.hh
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ public:
virtual void setPower(Channel::Power pwr);

/** Constructs a generic @c Channel object from the codeplug channel. */
virtual Channel *toChannelObj() const;
Channel *toChannelObj(const ErrorStack &err=ErrorStack()) const;
/** Initializes this codeplug channel from the given generic configuration. */
virtual void fromChannelObj(const Channel *c, Context &ctx);
void fromChannelObj(const Channel *c, Context &ctx);
};

/** Extends the @c ChannelElement to implement the VFO channel settings for the DM-1701.
Expand Down
13 changes: 0 additions & 13 deletions lib/interval.cc
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
#include "interval.hh"
#include <QRegularExpression>

Interval::Interval()
: _duration(0)
{
// pass...
}


Interval::Interval(const Interval &other)
: _duration(other._duration)
{
// pass...
}

QString
Interval::format(Format f) const {
if (0 == _duration)
Expand Down
15 changes: 12 additions & 3 deletions lib/interval.hh
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,26 @@ public:

protected:
/** Constructor from milliseconds. */
explicit inline constexpr Interval(unsigned long long ms)
constexpr explicit Interval(unsigned long long ms)
: _duration(ms)
{
// pass...
}

public:
/** Default constructor. */
Interval();
Interval()
: _duration(0)
{
// pass...
}

/** Copy constructor. */
Interval(const Interval &other);
constexpr Interval(const Interval &other)
: _duration(other._duration)
{
// pass...
}

inline Interval &operator =(const Interval &other) { ///< Assignment.
_duration = other._duration; return *this;
Expand Down
5 changes: 3 additions & 2 deletions lib/md390_codeplug.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,16 @@ MD390Codeplug::ChannelElement::enableCompressedUDPHeader(bool enable) {
}

Channel *
MD390Codeplug::ChannelElement::toChannelObj() const {
Channel *ch = DM1701Codeplug::ChannelElement::toChannelObj();
MD390Codeplug::ChannelElement::toChannelObj(const ErrorStack &err) const {
Channel *ch = DM1701Codeplug::ChannelElement::toChannelObj(err);
if (nullptr == ch)
return ch;

// Apply extension
if (ch->tytChannelExtension()) {
ch->tytChannelExtension()->enableCompressedUDPHeader(compressedUDPHeader());
}

return ch;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/md390_codeplug.hh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public:
virtual void enableCompressedUDPHeader(bool enable);

/** Constructs a generic @c Channel object from the codeplug channel. */
virtual Channel *toChannelObj() const;
virtual Channel *toChannelObj(const ErrorStack &err=ErrorStack()) const;
/** Initializes this codeplug channel from the given generic configuration. */
virtual void fromChannelObj(const Channel *c, Context &ctx);
};
Expand Down

0 comments on commit a335412

Please sign in to comment.