From 5135288a704dd2322c073fb4c0be82dd8a46d550 Mon Sep 17 00:00:00 2001 From: Philipp Jungkamp Date: Tue, 27 May 2025 18:00:34 +0200 Subject: [PATCH 01/26] Introduce .clang-tidy Signed-off-by: Philipp Jungkamp Signed-off-by: Steffen Vogel --- .clang-tidy | 9 +++++++++ CMakeLists.txt | 8 +++++++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 .clang-tidy diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 000000000..935505740 --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,9 @@ +# SPDX-FileCopyrightText: 2025 Institute for Automation of Complex Power Systems, RWTH Aachen University +# SPDX-License-Identifier: Apache-2.0 + +Checks: > + -*, + modernize-use-override, +WarningsAsErrors: '*' +HeaderFilterRegex: villas/.* +FormatStyle: file diff --git a/CMakeLists.txt b/CMakeLists.txt index ff81c5d46..7631b9de0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,7 +52,13 @@ include(FindSymbol) include(CMakeDependentOption) add_definitions(-D_POSIX_C_SOURCE=200809L -D_GNU_SOURCE) -add_compile_options(-Wall -Wno-unknown-pragmas -fdiagnostics-color=auto) +add_compile_options( + -Wall + -Wno-unknown-pragmas + -Wno-vla-cxx-extension + -Wno-unused-command-line-argument + -fdiagnostics-color=auto +) # Check OS check_include_file("sys/eventfd.h" HAS_EVENTFD) From c422b4c8be5d570570819e2ca67ccc1a1062b0d9 Mon Sep 17 00:00:00 2001 From: Philipp Jungkamp Date: Wed, 4 Jun 2025 15:19:30 +0200 Subject: [PATCH 02/26] nix: Add clang based package and devShell Signed-off-by: Philipp Jungkamp Signed-off-by: Steffen Vogel --- flake.nix | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/flake.nix b/flake.nix index 5f4563838..2d0211ac0 100644 --- a/flake.nix +++ b/flake.nix @@ -81,6 +81,10 @@ withAllNodes = true; }; + villas-node-clang = pkgs.villas-node.override { + stdenv = pkgs.clangStdenv; + }; + dockerImage = pkgs.dockerTools.buildLayeredImage { name = "villas-node"; tag = "latest-nix"; @@ -89,7 +93,6 @@ }; # Cross-compiled packages - villas-node-x86_64-linux = if pkgs.system == "x86_64-linux" then pkgs.villas-node else pkgs.pkgsCross.x86_64-linux.villas-node; villas-node-aarch64-linux = @@ -144,7 +147,7 @@ system: let pkgs = devPkgsFor system; - hardeningDisable = [ "all" ]; + packages = with pkgs; [ bashInteractive bc @@ -161,19 +164,35 @@ pre-commit ruby # for pre-commit markdownlint hook ]; + + mkShellFor = stdenv: pkg: stdenv.mkDerivation { + name = "${pkg.pname}-${stdenv.cc.cc.pname}-devShell"; + + # disable all hardening to suppress warnings in debug builds + hardeningDisable = [ "all" ]; + + # inherit inputs from pkg + buildInputs = pkg.buildInputs ++ packages; + nativeBuildInputs = pkg.nativeBuildInputs ++ packages; + propagatedBuildInputs = pkg.propagatedBuildInputs; + propagatedNativeBuildInputs = pkg.propagatedNativeBuildInputs; + + # configure nix-ld for pre-commit + env = { + NIX_LD = lib.fileContents "${stdenv.cc}/nix-support/dynamic-linker"; + NIX_LD_LIBRARY_PATH = lib.makeLibraryPath [ pkgs.gcc-unwrapped.lib ]; + }; + }; in rec { - default = full; + default = gcc; - full = pkgs.mkShell { - inherit hardeningDisable packages; - name = "full"; - inputsFrom = with pkgs; [ villas-node ]; - }; + gcc = mkShellFor pkgs.stdenv pkgs.villas-node; + clang = mkShellFor pkgs.clangStdenv pkgs.villas-node; python = pkgs.mkShell { - inherit hardeningDisable; - name = "python"; + name = "villas-python-devShell"; + hardeningDisable = [ "all" ]; inputsFrom = with pkgs; [ villas-node-python ]; packages = with pkgs; From 61832cc19aa4e15a4848d60f098a1f9d4357a2e4 Mon Sep 17 00:00:00 2001 From: Philipp Jungkamp Date: Sat, 24 Jan 2026 23:30:25 +0100 Subject: [PATCH 03/26] Make villas::utils::PopenStream operator>> a friend Signed-off-by: Philipp Jungkamp Signed-off-by: Steffen Vogel --- common/include/villas/popen.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/common/include/villas/popen.hpp b/common/include/villas/popen.hpp index f47881eba..47e47a69e 100644 --- a/common/include/villas/popen.hpp +++ b/common/include/villas/popen.hpp @@ -70,6 +70,11 @@ class PopenStream : public Popen { void open(); int close(); + template + friend std::istream &operator>>(villas::utils::PopenStream &po, T &value) { + return *(po.input.stream) >> value; + } + protected: struct { std::unique_ptr stream; @@ -84,8 +89,3 @@ class PopenStream : public Popen { } // namespace utils } // namespace villas - -template -std::istream &operator>>(villas::utils::PopenStream &po, T &value) { - return *(po.input.stream) >> value; -} From f53bc12fc47680689fee233166a596a9348a1fab Mon Sep 17 00:00:00 2001 From: Philipp Jungkamp Date: Sun, 25 Jan 2026 01:34:00 +0100 Subject: [PATCH 04/26] fix(vfio_device): Remove unused pci_device pointer Signed-off-by: Philipp Jungkamp Signed-off-by: Steffen Vogel --- common/include/villas/kernel/vfio_device.hpp | 3 --- common/lib/kernel/vfio_device.cpp | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/common/include/villas/kernel/vfio_device.hpp b/common/include/villas/kernel/vfio_device.hpp index 9aaa645fe..d1af0951d 100644 --- a/common/include/villas/kernel/vfio_device.hpp +++ b/common/include/villas/kernel/vfio_device.hpp @@ -98,9 +98,6 @@ class Device { std::vector regions; std::vector mappings; - // libpci handle of the device - const kernel::devices::PciDevice *pci_device; - Logger log; }; diff --git a/common/lib/kernel/vfio_device.cpp b/common/lib/kernel/vfio_device.cpp index b173faef7..871ea853c 100644 --- a/common/lib/kernel/vfio_device.cpp +++ b/common/lib/kernel/vfio_device.cpp @@ -55,7 +55,7 @@ static const char *vfio_pci_irq_names[] = { Device::Device(const std::string &name, int groupFileDescriptor, const kernel::devices::PciDevice *pci_device) : name(name), fd(-1), attachedToGroup(false), groupFd(groupFileDescriptor), - info(), info_irq_vectors(), regions(), mappings(), pci_device(pci_device), + info(), info_irq_vectors(), regions(), mappings(), log(Log::get("kernel:vfio:device")) { if (groupFileDescriptor < 0) throw RuntimeError("Invalid group file descriptor"); From 4eba32c0e7a5e9cce5084ad8cad27e9b185b38c5 Mon Sep 17 00:00:00 2001 From: Philipp Jungkamp Date: Sun, 25 Jan 2026 01:34:38 +0100 Subject: [PATCH 05/26] fix(vfio_device): Make IrqVectorInfo initialization more explicit Signed-off-by: Philipp Jungkamp Signed-off-by: Steffen Vogel --- common/lib/kernel/vfio_device.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/lib/kernel/vfio_device.cpp b/common/lib/kernel/vfio_device.cpp index 871ea853c..f599a1c3e 100644 --- a/common/lib/kernel/vfio_device.cpp +++ b/common/lib/kernel/vfio_device.cpp @@ -254,7 +254,7 @@ bool Device::pciEnable() { std::vector Device::initEventFds() { std::vector vectors; for (auto info_irq_vector : info_irq_vectors) { - Device::IrqVectorInfo irq = {0}; + Device::IrqVectorInfo irq = {.eventFds = {0}}; const size_t irqCount = info_irq_vector.count; const size_t irqSetSize = sizeof(struct vfio_irq_set) + sizeof(int) * irqCount; From e7812ed6026fd6521e641b6a0f2f6beb6564acba Mon Sep 17 00:00:00 2001 From: Philipp Jungkamp Date: Sun, 25 Jan 2026 01:35:12 +0100 Subject: [PATCH 06/26] fix(fpga/intc): Make IrqVectorInfo initialization more explicit Signed-off-by: Philipp Jungkamp Signed-off-by: Steffen Vogel --- common/lib/kernel/vfio_device.cpp | 6 +++--- fpga/lib/ips/intc.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/lib/kernel/vfio_device.cpp b/common/lib/kernel/vfio_device.cpp index f599a1c3e..cc1680704 100644 --- a/common/lib/kernel/vfio_device.cpp +++ b/common/lib/kernel/vfio_device.cpp @@ -296,7 +296,7 @@ std::vector Device::initEventFds() { return vectors; } -int Device::pciMsiInit(int efds[]) { +int Device::pciMsiInit(int efds[32]) { // Check if this is really a vfio-pci device if (not isVfioPciDevice()) return -1; @@ -341,7 +341,7 @@ int Device::pciMsiInit(int efds[]) { return irqCount; } -int Device::pciMsiDeinit(int efds[]) { +int Device::pciMsiDeinit(int efds[32]) { Log::get("Device")->debug("Deinitializing MSI interrupts for device {}", name); // Check if this is really a vfio-pci device @@ -381,7 +381,7 @@ int Device::pciMsiDeinit(int efds[]) { return irqCount; } -bool Device::pciMsiFind(int nos[]) { +bool Device::pciMsiFind(int nos[32]) { int ret, idx, irq; char *end, *col, *last, line[1024], name[13]; FILE *f; diff --git a/fpga/lib/ips/intc.cpp b/fpga/lib/ips/intc.cpp index 4f3fd035e..f4ec9fa17 100644 --- a/fpga/lib/ips/intc.cpp +++ b/fpga/lib/ips/intc.cpp @@ -29,7 +29,7 @@ bool InterruptController::init() { this->vfioDevice = pciecard->vfioDevice; const uintptr_t base = getBaseAddr(registerMemory); - kernel::vfio::Device::IrqVectorInfo irq_vector = {0}; + kernel::vfio::Device::IrqVectorInfo irq_vector = {.eventFds = {0}}; irq_vector.numFds = this->vfioDevice->pciMsiInit(irq_vector.eventFds); irq_vector.automask = true; irq_vectors.push_back(irq_vector); From 2bdd6e0bdc70453ef9b501249bc7c7501aef0dad Mon Sep 17 00:00:00 2001 From: Philipp Jungkamp Date: Sat, 24 Jan 2026 23:39:11 +0100 Subject: [PATCH 07/26] fix(kernel): Mark ~Driver interface destructor as virtual Signed-off-by: Philipp Jungkamp Signed-off-by: Steffen Vogel --- common/include/villas/kernel/devices/driver.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/include/villas/kernel/devices/driver.hpp b/common/include/villas/kernel/devices/driver.hpp index e156af96a..8e1f13685 100644 --- a/common/include/villas/kernel/devices/driver.hpp +++ b/common/include/villas/kernel/devices/driver.hpp @@ -1,4 +1,4 @@ -/* Interface for device drivers. OS/platform independend. +/* Interface for device drivers. OS/platform independent. * Implemented for Linux/Unix drivers in linux_driver.hpp * * Author: Pascal Bauer @@ -24,6 +24,7 @@ class Driver { virtual std::string name() const = 0; virtual void override(const Device &device) const = 0; virtual void unbind(const Device &device) const = 0; + virtual ~Driver() = default; }; } // namespace devices From e20190a6204a5f230e966f23d62acaaefd833cde Mon Sep 17 00:00:00 2001 From: Philipp Jungkamp Date: Sun, 25 Jan 2026 00:08:43 +0100 Subject: [PATCH 08/26] fix(clang): Allow unkown warning options Signed-off-by: Philipp Jungkamp Signed-off-by: Steffen Vogel --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7631b9de0..8272382e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,6 +55,7 @@ add_definitions(-D_POSIX_C_SOURCE=200809L -D_GNU_SOURCE) add_compile_options( -Wall -Wno-unknown-pragmas + -Wno-unknown-warning-option -Wno-vla-cxx-extension -Wno-unused-command-line-argument -fdiagnostics-color=auto From 33c1a1324ccf6e43adf6a73ac1e44ac123d64113 Mon Sep 17 00:00:00 2001 From: Philipp Jungkamp Date: Sun, 25 Jan 2026 00:09:43 +0100 Subject: [PATCH 09/26] fix(tests/utils): Fix string use-after-free Signed-off-by: Philipp Jungkamp Signed-off-by: Steffen Vogel --- common/tests/unit/utils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/tests/unit/utils.cpp b/common/tests/unit/utils.cpp index ee31f7f7d..d49e793dd 100644 --- a/common/tests/unit/utils.cpp +++ b/common/tests/unit/utils.cpp @@ -86,7 +86,7 @@ Test(utils, cpuset) { cset4.clear(6); cr_assert_not(cset4[6]); - cr_assert_str_eq(static_cast(cset4).c_str(), "1-5"); + cr_assert_eq(static_cast(cset4), "1-5"); cr_assert_any_throw(CpuSet cset5("0-")); From a03a7eb5382d272a44259f116d85153b5f5f25bc Mon Sep 17 00:00:00 2001 From: Philipp Jungkamp Date: Sun, 25 Jan 2026 00:10:38 +0100 Subject: [PATCH 10/26] fix(fpga/rtds): Fix broken reinterpret_cast to virtual base class Signed-off-by: Philipp Jungkamp Signed-off-by: Steffen Vogel --- fpga/include/villas/fpga/utils.hpp | 1 + fpga/tests/unit/rtds.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/fpga/include/villas/fpga/utils.hpp b/fpga/include/villas/fpga/utils.hpp index d8493063c..f87a37c22 100644 --- a/fpga/include/villas/fpga/utils.hpp +++ b/fpga/include/villas/fpga/utils.hpp @@ -80,6 +80,7 @@ class BufferedSampleFormatter { } currentBufLoc = 0; } + virtual ~BufferedSampleFormatter() = default; protected: std::vector buf; diff --git a/fpga/tests/unit/rtds.cpp b/fpga/tests/unit/rtds.cpp index b0c9e69f5..c30c9401d 100644 --- a/fpga/tests/unit/rtds.cpp +++ b/fpga/tests/unit/rtds.cpp @@ -34,12 +34,12 @@ Test(fpga, rtds, .description = "RTDS") { for (auto &ip : state.cards.front()->ips) { if (*ip == villas::fpga::Vlnv("acs.eonerc.rwth-aachen.de:user:rtds_axis:")) { - auto rtds = reinterpret_cast(ip.get()); + auto rtds = dynamic_cast(ip.get()); rtdsIps.push_back(rtds); } if (*ip == villas::fpga::Vlnv("xilinx.com:ip:axi_dma:")) { - auto dma = reinterpret_cast(ip.get()); + auto dma = dynamic_cast(ip.get()); dmaIps.push_back(dma); } } From 7cee0f32837bd1182048a676ad1cdfed637967b9 Mon Sep 17 00:00:00 2001 From: Philipp Jungkamp Date: Sun, 25 Jan 2026 00:11:51 +0100 Subject: [PATCH 11/26] fix(cpuset): Fix ambiguous C++20 operator== overload Signed-off-by: Philipp Jungkamp Signed-off-by: Steffen Vogel --- common/include/villas/cpuset.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/include/villas/cpuset.hpp b/common/include/villas/cpuset.hpp index 5b8d02fba..8ae35fd6b 100644 --- a/common/include/villas/cpuset.hpp +++ b/common/include/villas/cpuset.hpp @@ -80,7 +80,9 @@ class CpuSet { return full ^ *this; } - bool operator==(const CpuSet &rhs) { return CPU_EQUAL_S(sz, setp, rhs.setp); } + friend bool operator==(const CpuSet &lhs, const CpuSet &rhs) { + return CPU_EQUAL_S(lhs.sz, lhs.setp, rhs.setp); + } CpuSet &operator&=(const CpuSet &rhs) { CPU_AND_S(sz, setp, setp, rhs.setp); From 11e4f1106dcf3282d6162fc3fc7860eab6247a2c Mon Sep 17 00:00:00 2001 From: Philipp Jungkamp Date: Sun, 25 Jan 2026 00:12:44 +0100 Subject: [PATCH 12/26] fix(memory): Fix non-virtual destructor in polymorphic class Signed-off-by: Philipp Jungkamp Signed-off-by: Steffen Vogel --- common/include/villas/memory.hpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/common/include/villas/memory.hpp b/common/include/villas/memory.hpp index 8434d6e51..52b1cc7f3 100644 --- a/common/include/villas/memory.hpp +++ b/common/include/villas/memory.hpp @@ -135,8 +135,9 @@ template class BaseAllocator { derivedAlloc = nullptr; } - virtual std::unique_ptr + virtual ~BaseAllocator() = default; + virtual std::unique_ptr allocateBlock(size_t size) = 0; template MemoryAccessor allocate(size_t num) { @@ -217,8 +218,8 @@ class LinearAllocator : public BaseAllocator { std::string getName() const; - virtual std::unique_ptr - allocateBlock(size_t size); + std::unique_ptr + allocateBlock(size_t size) override; private: static constexpr size_t alignBytes = sizeof(uintptr_t); @@ -247,7 +248,7 @@ class HostRam { std::string getName() const { return "HostRamAlloc"; } std::unique_ptr - allocateBlock(size_t size); + allocateBlock(size_t size) override; }; static HostRamAllocator &getAllocator() { @@ -264,7 +265,7 @@ class HostDmaRam { public: HostDmaRamAllocator(int num); - virtual ~HostDmaRamAllocator(); + ~HostDmaRamAllocator() override; std::string getName() const { return getUdmaBufName(num); } From 8d0780c0f922174cac0f72f7210893348348a369 Mon Sep 17 00:00:00 2001 From: Philipp Jungkamp Date: Sun, 25 Jan 2026 00:13:10 +0100 Subject: [PATCH 13/26] fix(exceptions): Add missing override annotation Signed-off-by: Philipp Jungkamp Signed-off-by: Steffen Vogel --- common/include/villas/exceptions.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/include/villas/exceptions.hpp b/common/include/villas/exceptions.hpp index 5d3c960d9..282ef9ee8 100644 --- a/common/include/villas/exceptions.hpp +++ b/common/include/villas/exceptions.hpp @@ -90,7 +90,7 @@ class ConfigError : public std::runtime_error { } public: - ~ConfigError() { + ~ConfigError() override { if (msg) free(msg); } From fa748f6e28b854b644ab3cb2314d33a65818d79a Mon Sep 17 00:00:00 2001 From: Philipp Jungkamp Date: Sun, 25 Jan 2026 00:34:16 +0100 Subject: [PATCH 14/26] fix(opal/ddf): Fix non-virtual destructor in polymorphic class Signed-off-by: Philipp Jungkamp Signed-off-by: Steffen Vogel --- include/villas/nodes/opal_orchestra/ddf.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/villas/nodes/opal_orchestra/ddf.hpp b/include/villas/nodes/opal_orchestra/ddf.hpp index f41168804..df16bb85f 100644 --- a/include/villas/nodes/opal_orchestra/ddf.hpp +++ b/include/villas/nodes/opal_orchestra/ddf.hpp @@ -29,6 +29,7 @@ namespace orchestra { class Item { public: virtual void toXml(xmlNode *parent, bool withDefault) const = 0; + virtual ~Item() = default; }; class DataItem : public Item { @@ -77,6 +78,7 @@ class Connection { virtual void toXml(xmlNode *domain) const = 0; virtual std::string getDetails() const = 0; virtual void parse(json_t *json) = 0; + virtual ~Connection() = default; static std::shared_ptr fromJson(json_t *json); }; From a90acbf2bd4ce7638716cd30f4a845892d18e496 Mon Sep 17 00:00:00 2001 From: Philipp Jungkamp Date: Sun, 25 Jan 2026 00:35:48 +0100 Subject: [PATCH 15/26] fix(webrtc): Fix use of deleted default constructor of sample_pool Signed-off-by: Philipp Jungkamp Signed-off-by: Steffen Vogel --- lib/nodes/webrtc.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/nodes/webrtc.cpp b/lib/nodes/webrtc.cpp index e89026817..3fe4a2f82 100644 --- a/lib/nodes/webrtc.cpp +++ b/lib/nodes/webrtc.cpp @@ -28,8 +28,8 @@ static villas::node::Web *web; WebRTCNode::WebRTCNode(const uuid_t &id, const std::string &name) : Node(id, name), server("https://villas.k8s.eonerc.rwth-aachen.de/ws/signaling"), - peer(uuid::toString(id)), wait_seconds(0), formatter(), queue({}), - pool({}), dci({}) { + peer(uuid::toString(id)), wait_seconds(0), formatter(), queue(), pool(), + dci() { #if RTC_VERSION_NUM < 0x001400 dci.reliability.type = rtc::Reliability::Type::Rexmit; From 968474e99252e5e184d79a6a72fd3210dda568e5 Mon Sep 17 00:00:00 2001 From: Philipp Jungkamp Date: Sun, 25 Jan 2026 01:10:47 +0100 Subject: [PATCH 16/26] fix(tests/config): Remove broken putenv call Signed-off-by: Philipp Jungkamp Signed-off-by: Steffen Vogel --- tests/unit/config.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/config.cpp b/tests/unit/config.cpp index 4e1b12bc4..0ecd3a2fe 100644 --- a/tests/unit/config.cpp +++ b/tests/unit/config.cpp @@ -54,8 +54,8 @@ Test(config, include) { std::fputs(cfg_f1.c_str(), f1); std::rewind(f1); - auto env = fmt::format("INCLUDE_FILE={}", f2_fn_tpl).c_str(); - putenv((char *)env); + auto env = fmt::format("{}", f2_fn_tpl); + setenv("INCLUDE_FILE", env.c_str(), true); auto c = Config(); From 33be336970602203353723900b7da156e0079d0d Mon Sep 17 00:00:00 2001 From: Philipp Jungkamp Date: Sun, 25 Jan 2026 01:11:49 +0100 Subject: [PATCH 17/26] fix(tests/queue): Fix unintentional sleep(0) using usleep Signed-off-by: Philipp Jungkamp Signed-off-by: Steffen Vogel --- tests/unit/queue.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/queue.cpp b/tests/unit/queue.cpp index ddc3c2ce6..349a4056e 100644 --- a/tests/unit/queue.cpp +++ b/tests/unit/queue.cpp @@ -290,7 +290,7 @@ ParameterizedTest(struct param *p, queue, multi_threaded, .timeout = 20, pthread_create(&threads[i], nullptr, p->many ? producer_consumer_many : producer_consumer, p); - sleep(0.2); + usleep(200'000); ret = tsc_init(&tsc); cr_assert(!ret); From 0e7575fb7141a23823181cb6a44ae4dc630f84d6 Mon Sep 17 00:00:00 2001 From: Philipp Jungkamp Date: Sun, 25 Jan 2026 01:12:44 +0100 Subject: [PATCH 18/26] fix(tests/format): Use proper printf formatting specifiers for std::int64_t Signed-off-by: Philipp Jungkamp Signed-off-by: Steffen Vogel --- tests/unit/format.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/unit/format.cpp b/tests/unit/format.cpp index 020399bf1..0a6e5e31f 100644 --- a/tests/unit/format.cpp +++ b/tests/unit/format.cpp @@ -5,12 +5,12 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include #include +#include #include #include -#include -#include #include #include @@ -117,8 +117,9 @@ void cr_assert_eq_sample(struct Sample *a, struct Sample *b, int flags) { case SignalType::INTEGER: cr_assert_eq(a->data[j].i, b->data[j].i, - "Sample data mismatch at index %d: %lld != %lld", j, - a->data[j].i, b->data[j].i); + "Sample data mismatch at index %d: %" PRId64 + " != %" PRId64, + j, a->data[j].i, b->data[j].i); break; case SignalType::BOOLEAN: @@ -171,8 +172,9 @@ void cr_assert_eq_sample_raw(struct Sample *a, struct Sample *b, int flags, case SignalType::INTEGER: cr_assert_eq(a->data[j].i, b->data[j].i, - "Sample data mismatch at index %d: %lld != %lld", j, - a->data[j].i, b->data[j].i); + "Sample data mismatch at index %d: %" PRId64 + " != %" PRId64, + j, a->data[j].i, b->data[j].i); break; case SignalType::BOOLEAN: From 86aadc31b858e785fd7ed5c44157112c963883a0 Mon Sep 17 00:00:00 2001 From: Philipp Jungkamp Date: Sun, 25 Jan 2026 01:14:14 +0100 Subject: [PATCH 19/26] fix(config): Fix string use-after-free Signed-off-by: Philipp Jungkamp Signed-off-by: Steffen Vogel --- lib/config.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/config.cpp b/lib/config.cpp index f01e85822..37aac542d 100644 --- a/lib/config.cpp +++ b/lib/config.cpp @@ -187,8 +187,8 @@ void Config::resolveEnvVars(std::string &text) { std::smatch match; while (std::regex_search(text, match, env_re)) { auto const from = match[0]; - auto const var_name = match[1].str().c_str(); - char *var_value = std::getenv(var_name); + auto const var_name = match[1].str(); + char *var_value = std::getenv(var_name.c_str()); if (!var_value) throw RuntimeError("Unresolved environment variable: {}", var_name); From ba18200d340538b6f3ba54f41b0bfad3fbf79c61 Mon Sep 17 00:00:00 2001 From: Philipp Jungkamp Date: Sun, 25 Jan 2026 01:14:54 +0100 Subject: [PATCH 20/26] fix(hook/lua): Remove unused lua_tojson function Signed-off-by: Philipp Jungkamp Signed-off-by: Steffen Vogel --- lib/hooks/lua.cpp | 68 ----------------------------------------------- 1 file changed, 68 deletions(-) diff --git a/lib/hooks/lua.cpp b/lib/hooks/lua.cpp index 0dd89a402..8f9c6ba0c 100644 --- a/lib/hooks/lua.cpp +++ b/lib/hooks/lua.cpp @@ -285,74 +285,6 @@ static void lua_pushjson(lua_State *L, json_t *json) { } } -static json_t *lua_tojson(lua_State *L, int index = -1) { - double n; - const char *s; - bool b; - - switch (lua_type(L, index)) { - case LUA_TFUNCTION: - case LUA_TUSERDATA: - case LUA_TTHREAD: - case LUA_TLIGHTUSERDATA: - case LUA_TNIL: - return json_null(); - - case LUA_TNUMBER: - n = lua_tonumber(L, index); - return n == (int)n ? json_integer(n) : json_real(n); - - case LUA_TBOOLEAN: - b = lua_toboolean(L, index); - return json_boolean(b); - - case LUA_TSTRING: - s = lua_tostring(L, index); - return json_string(s); - - case LUA_TTABLE: { - int keys_total = 0, keys_int = 0, key_highest = -1; - - lua_pushnil(L); - while (lua_next(L, index) != 0) { - keys_total++; - if (lua_type(L, -2) == LUA_TNUMBER) { - int key = lua_tonumber(L, -1); - - if (key == (int)key) { - keys_int++; - if (key > key_highest) - key_highest = key; - } - } - lua_pop(L, 1); - } - - bool is_array = keys_total == keys_int && key_highest / keys_int > 0.5; - - json_t *json = is_array ? json_array() : json_object(); - - lua_pushnil(L); - while (lua_next(L, index) != 0) { - json_t *val = lua_tojson(L, -1); - if (is_array) { - int key = lua_tonumber(L, -2); - json_array_set(json, key, val); - } else { - const char *key = lua_tostring(L, -2); - if (key) // Skip table entries whose keys are neither string or number! - json_object_set(json, key, val); - } - lua_pop(L, 1); - } - - return json; - } - } - - return nullptr; -} - namespace villas { namespace node { From 1d786d9b631e625f487f2cc091c9d0dd3e96df82 Mon Sep 17 00:00:00 2001 From: Philipp Jungkamp Date: Sun, 25 Jan 2026 01:17:21 +0100 Subject: [PATCH 21/26] fix(hooks/lua): Fix forward declaration of SignalType Signed-off-by: Philipp Jungkamp Signed-off-by: Steffen Vogel --- include/villas/hooks/lua.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/villas/hooks/lua.hpp b/include/villas/hooks/lua.hpp index f281b79cd..8961db7af 100644 --- a/include/villas/hooks/lua.hpp +++ b/include/villas/hooks/lua.hpp @@ -21,7 +21,7 @@ namespace node { // Forward declarations class LuaHook; -enum SignalType; +enum class SignalType; class LuaSignalExpression { From bcd629a1b88d46b0609b67316cc81c4cf4be1692 Mon Sep 17 00:00:00 2001 From: Philipp Jungkamp Date: Sun, 25 Jan 2026 01:17:58 +0100 Subject: [PATCH 22/26] fix(format/json_kafka): Fix json_pack string parameter Signed-off-by: Philipp Jungkamp Signed-off-by: Steffen Vogel --- lib/formats/json_kafka.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/formats/json_kafka.cpp b/lib/formats/json_kafka.cpp index 32f1c6e25..c4452ce76 100644 --- a/lib/formats/json_kafka.cpp +++ b/lib/formats/json_kafka.cpp @@ -64,7 +64,7 @@ int JsonKafkaFormat::packSample(json_t **json_smp, const struct Sample *smp) { json_field = json_pack("{ s: s, s: b, s: s }", "type", villasToKafkaType(sig->type), - "optional", false, "field", sig->name); + "optional", false, "field", sig->name.c_str()); json_value = data->toJson(sig->type); From b267998bdb998400211764a21dbe4fe58ee9cf05 Mon Sep 17 00:00:00 2001 From: Philipp Jungkamp Date: Sun, 25 Jan 2026 01:18:46 +0100 Subject: [PATCH 23/26] fix(sample): Remove C compatability macros Signed-off-by: Philipp Jungkamp Signed-off-by: Steffen Vogel --- lib/sample.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/sample.cpp b/lib/sample.cpp index ac48e8674..aeb5e665b 100644 --- a/lib/sample.cpp +++ b/lib/sample.cpp @@ -29,7 +29,7 @@ int villas::node::sample_init(struct Sample *s) { s->capacity = pool ? ((*pool)->blocksz - sizeof(struct Sample)) / sizeof(s->data[0]) : 0; - s->refcnt = ATOMIC_VAR_INIT(1); + s->refcnt = 1; new (&s->signals) std::shared_ptr; @@ -67,7 +67,7 @@ struct Sample *villas::node::sample_alloc_mem(int capacity) { s->length = 0; s->capacity = capacity; - s->refcnt = ATOMIC_VAR_INIT(1); + s->refcnt = 1; return s; } From d3b2ec2797818777f71b8e4c5af9af6233370c04 Mon Sep 17 00:00:00 2001 From: Philipp Jungkamp Date: Sun, 25 Jan 2026 01:57:35 +0100 Subject: [PATCH 24/26] fix(web): Conditionally add global extensions array Signed-off-by: Philipp Jungkamp Signed-off-by: Steffen Vogel --- lib/web.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/web.cpp b/lib/web.cpp index e96ae849d..97c2df2dc 100644 --- a/lib/web.cpp +++ b/lib/web.cpp @@ -77,6 +77,7 @@ static lws_http_mount mounts[] = { #endif // WITH_API }; +#ifndef LWS_WITHOUT_EXTENSIONS // List of libwebsockets extensions. static const lws_extension extensions[] = { #ifdef LWS_DEFLATE_FOUND @@ -88,6 +89,7 @@ static const lws_extension extensions[] = { .client_offer = "deflate_frame"}, #endif // LWS_DEFLATE_FOUND {nullptr /* terminator */}}; +#endif void Web::lwsLogger(int lws_lvl, const char *msg) { char *nl; From 4a3288730227a4a75fe934788a9b31a47584641a Mon Sep 17 00:00:00 2001 From: Philipp Jungkamp Date: Sun, 25 Jan 2026 01:20:42 +0100 Subject: [PATCH 25/26] fix(opal-async-param): Close header comment Signed-off-by: Philipp Jungkamp Signed-off-by: Steffen Vogel --- src/opal-async-param.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opal-async-param.cpp b/src/opal-async-param.cpp index fd1ca453d..8c20ab1f3 100644 --- a/src/opal-async-param.cpp +++ b/src/opal-async-param.cpp @@ -3,7 +3,7 @@ * Author: Steffen Vogel * SPDX-FileCopyrightText: 2023-2025 OPAL-RT Germany GmbH * SPDX-License-Identifier: Apache-2.0 - * + */ #include #include From c788b7321fe44ae55711704cd7d2899808af1b7f Mon Sep 17 00:00:00 2001 From: Philipp Jungkamp Date: Sun, 25 Jan 2026 01:22:38 +0100 Subject: [PATCH 26/26] fix(treewide): Fix virtual/override annotations Signed-off-by: Philipp Jungkamp Signed-off-by: Steffen Vogel --- clients/shmem/villas-shmem.cpp | 6 ++-- common/include/villas/dsp/window_cosine.hpp | 2 +- fpga/include/villas/fpga/core.hpp | 12 ++++---- fpga/include/villas/fpga/ips/aurora.hpp | 10 ++++--- .../include/villas/fpga/ips/aurora_xilinx.hpp | 4 +-- fpga/include/villas/fpga/ips/axis_cache.hpp | 6 ++-- fpga/include/villas/fpga/ips/bram.hpp | 16 +++++----- fpga/include/villas/fpga/ips/dino.hpp | 30 +++++++++---------- fpga/include/villas/fpga/ips/dma.hpp | 16 +++++----- fpga/include/villas/fpga/ips/emc.hpp | 4 +-- fpga/include/villas/fpga/ips/fifo.hpp | 6 ++-- fpga/include/villas/fpga/ips/gpio.hpp | 4 +-- fpga/include/villas/fpga/ips/gpu2rtds.hpp | 4 +-- fpga/include/villas/fpga/ips/hls.hpp | 4 +-- fpga/include/villas/fpga/ips/i2c.hpp | 24 +++++++-------- fpga/include/villas/fpga/ips/intc.hpp | 8 ++--- fpga/include/villas/fpga/ips/pcie.hpp | 22 +++++++------- fpga/include/villas/fpga/ips/register.hpp | 6 ++-- fpga/include/villas/fpga/ips/rtds.hpp | 10 ++++--- fpga/include/villas/fpga/ips/rtds2gpu.hpp | 8 ++--- fpga/include/villas/fpga/ips/switch.hpp | 16 +++++----- fpga/include/villas/fpga/ips/timer.hpp | 4 +-- fpga/include/villas/fpga/ips/zynq.hpp | 12 ++++---- fpga/include/villas/fpga/node.hpp | 10 +++---- fpga/include/villas/fpga/pcie_card.hpp | 8 ++--- fpga/include/villas/fpga/platform_card.hpp | 2 +- fpga/include/villas/fpga/utils.hpp | 4 +-- include/villas/api/request.hpp | 10 +++---- include/villas/api/response.hpp | 4 +-- include/villas/format.hpp | 8 ++--- include/villas/formats/villas_binary.hpp | 2 +- include/villas/hook.hpp | 24 +++++++-------- include/villas/hooks/lua.hpp | 2 +- include/villas/node.hpp | 12 ++++---- include/villas/node_compat.hpp | 2 +- include/villas/nodes/exec.hpp | 2 +- include/villas/nodes/fpga.hpp | 2 +- include/villas/nodes/iec60870.hpp | 2 +- include/villas/nodes/iec61850_goose.hpp | 2 +- include/villas/nodes/loopback.hpp | 2 +- include/villas/nodes/loopback_internal.hpp | 2 +- include/villas/nodes/modbus.hpp | 2 +- include/villas/nodes/opal_async.hpp | 27 ++++++++--------- include/villas/nodes/opendss.hpp | 2 +- include/villas/nodes/temper.hpp | 10 +++---- include/villas/nodes/test_rtt.hpp | 2 +- include/villas/nodes/webrtc.hpp | 2 +- include/villas/path_source.hpp | 2 +- include/villas/usb.hpp | 4 +-- lib/api/requests/graph.cpp | 2 +- lib/api/requests/metrics.cpp | 2 +- lib/hooks/digest.cpp | 4 +-- lib/hooks/dp.cpp | 6 ++-- lib/hooks/drop.cpp | 6 ++-- lib/hooks/ebm.cpp | 4 +-- lib/hooks/frame.cpp | 6 ++-- lib/hooks/lua.cpp | 2 +- lib/hooks/pmu_dft.cpp | 2 +- lib/hooks/pmu_ipdft.cpp | 6 ++-- lib/hooks/pps_ts.cpp | 2 +- lib/hooks/print.cpp | 4 +-- lib/hooks/reorder_ts.cpp | 8 ++--- lib/hooks/restart.cpp | 4 +-- lib/hooks/skip_first.cpp | 4 +-- lib/hooks/stats.cpp | 16 +++++----- lib/node.cpp | 2 +- lib/nodes/example.cpp | 2 +- lib/path.cpp | 7 ++--- plugins/example_hook.cpp | 2 +- src/villas-compare.cpp | 6 ++-- src/villas-conf2json.cpp | 4 +-- src/villas-convert.cpp | 6 ++-- src/villas-graph.cpp | 8 ++--- src/villas-hook.cpp | 10 ++++--- src/villas-node.cpp | 8 ++--- src/villas-pipe.cpp | 18 +++++------ src/villas-signal.cpp | 6 ++-- src/villas-test-config.cpp | 6 ++-- src/villas-zmq-keygen.cpp | 2 +- 79 files changed, 276 insertions(+), 274 deletions(-) diff --git a/clients/shmem/villas-shmem.cpp b/clients/shmem/villas-shmem.cpp index 0f2f05ca2..2668b5bfe 100644 --- a/clients/shmem/villas-shmem.cpp +++ b/clients/shmem/villas-shmem.cpp @@ -34,7 +34,7 @@ class Shmem : public Tool { protected: std::atomic stop; - void usage() { + void usage() override { std::cout << "Usage: villas-test-shmem WNAME VECTORIZE" << std::endl << " WNAME name of the shared memory object for the output queue" @@ -47,9 +47,9 @@ class Shmem : public Tool { printCopyright(); } - void handler(int, siginfo_t *, void *) { stop = true; } + void handler(int, siginfo_t *, void *) override { stop = true; } - int main() { + int main() override { int ret, readcnt, writecnt, avail; struct ShmemInterface shm; diff --git a/common/include/villas/dsp/window_cosine.hpp b/common/include/villas/dsp/window_cosine.hpp index aedfa478e..1864dd8c2 100644 --- a/common/include/villas/dsp/window_cosine.hpp +++ b/common/include/villas/dsp/window_cosine.hpp @@ -27,7 +27,7 @@ class CosineWindow : public Window { T correctionFactor; - virtual T filter(T in, size_type i) const { return in * coefficients[i]; } + T filter(T in, size_type i) const override { return in * coefficients[i]; } public: CosineWindow(double a0, double a1, double a2, double a3, double a4, diff --git a/fpga/include/villas/fpga/core.hpp b/fpga/include/villas/fpga/core.hpp index 16cb40142..8fb0847f8 100644 --- a/fpga/include/villas/fpga/core.hpp +++ b/fpga/include/villas/fpga/core.hpp @@ -227,7 +227,7 @@ class CoreFactory : public plugin::Plugin { // Returns a running and checked FPGA IP static std::list> make(Card *card, json_t *json_ips); - virtual std::string getType() const { return "core"; } + std::string getType() const override { return "core"; } protected: enum PollingMode { @@ -235,7 +235,7 @@ class CoreFactory : public plugin::Plugin { IRQ, }; - Logger getLogger() { return villas::Log::get(getName()); } + Logger getLogger() override { return villas::Log::get(getName()); } // Configure IP instance from JSON config virtual void parse(Core &, json_t *) {} @@ -257,15 +257,15 @@ template class CorePlugin : public CoreFactory { public: - virtual std::string getName() const { return name; } + std::string getName() const override { return name; } - virtual std::string getDescription() const { return desc; } + std::string getDescription() const override { return desc; } private: - virtual Vlnv getCompatibleVlnv() const { return Vlnv(vlnv); } + Vlnv getCompatibleVlnv() const override { return Vlnv(vlnv); } // Create a concrete IP instance - Core *make() const { return new T; }; + Core *make() const override { return new T; }; }; } // namespace ip diff --git a/fpga/include/villas/fpga/ips/aurora.hpp b/fpga/include/villas/fpga/ips/aurora.hpp index 7c969687d..904a41fc6 100644 --- a/fpga/include/villas/fpga/ips/aurora.hpp +++ b/fpga/include/villas/fpga/ips/aurora.hpp @@ -18,15 +18,17 @@ class Aurora : public Node { static constexpr const char *masterPort = "m_axis"; static constexpr const char *slavePort = "s_axis"; - virtual void dump() override; + void dump() override; - std::list getMemoryBlocks() const { return {registerMemory}; } + std::list getMemoryBlocks() const override { + return {registerMemory}; + } - const StreamVertex &getDefaultSlavePort() const { + const StreamVertex &getDefaultSlavePort() const override { return getSlavePort(slavePort); } - const StreamVertex &getDefaultMasterPort() const { + const StreamVertex &getDefaultMasterPort() const override { return getMasterPort(masterPort); } diff --git a/fpga/include/villas/fpga/ips/aurora_xilinx.hpp b/fpga/include/villas/fpga/ips/aurora_xilinx.hpp index 4da5628f0..29d6c6bac 100644 --- a/fpga/include/villas/fpga/ips/aurora_xilinx.hpp +++ b/fpga/include/villas/fpga/ips/aurora_xilinx.hpp @@ -18,11 +18,11 @@ class AuroraXilinx : public Node { static constexpr const char *masterPort = "USER_DATA_M_AXI_RX"; static constexpr const char *slavePort = "USER_DATA_S_AXI_TX"; - const StreamVertex &getDefaultSlavePort() const { + const StreamVertex &getDefaultSlavePort() const override { return getSlavePort(slavePort); } - const StreamVertex &getDefaultMasterPort() const { + const StreamVertex &getDefaultMasterPort() const override { return getMasterPort(masterPort); } }; diff --git a/fpga/include/villas/fpga/ips/axis_cache.hpp b/fpga/include/villas/fpga/ips/axis_cache.hpp index 53153164d..d19d4b7d7 100644 --- a/fpga/include/villas/fpga/ips/axis_cache.hpp +++ b/fpga/include/villas/fpga/ips/axis_cache.hpp @@ -18,9 +18,9 @@ namespace ip { class AxisCache : public Node { public: AxisCache(); - virtual ~AxisCache(); - virtual bool init() override; - virtual bool check() override; + ~AxisCache() override; + bool init() override; + bool check() override; void invalidate(); protected: diff --git a/fpga/include/villas/fpga/ips/bram.hpp b/fpga/include/villas/fpga/ips/bram.hpp index 5381f5afb..b36f336a1 100644 --- a/fpga/include/villas/fpga/ips/bram.hpp +++ b/fpga/include/villas/fpga/ips/bram.hpp @@ -20,14 +20,16 @@ class Bram : public Core { friend class BramFactory; public: - virtual bool init() override; + bool init() override; LinearAllocator &getAllocator() { return *allocator; } private: static constexpr const char *memoryBlock = "Mem0"; - std::list getMemoryBlocks() const { return {memoryBlock}; } + std::list getMemoryBlocks() const override { + return {memoryBlock}; + } size_t size; std::unique_ptr allocator; @@ -36,20 +38,20 @@ class Bram : public Core { class BramFactory : public CoreFactory { public: - virtual std::string getName() const { return "bram"; } + std::string getName() const override { return "bram"; } - virtual std::string getDescription() const { return "Block RAM"; } + std::string getDescription() const override { return "Block RAM"; } private: - virtual Vlnv getCompatibleVlnv() const { + Vlnv getCompatibleVlnv() const override { return Vlnv("xilinx.com:ip:axi_bram_ctrl:"); } // Create a concrete IP instance - Core *make() const { return new Bram; }; + Core *make() const override { return new Bram; }; protected: - virtual void parse(Core &, json_t *) override; + void parse(Core &, json_t *) override; }; } // namespace ip diff --git a/fpga/include/villas/fpga/ips/dino.hpp b/fpga/include/villas/fpga/ips/dino.hpp index e97800a71..9c964c7dd 100644 --- a/fpga/include/villas/fpga/ips/dino.hpp +++ b/fpga/include/villas/fpga/ips/dino.hpp @@ -53,8 +53,8 @@ class Dino : public Node { enum Gain { GAIN_1 = 0, GAIN_2 = 1, GAIN_5 = 2, GAIN_10 = 3 }; Dino(); - virtual ~Dino(); - virtual bool init() override; + ~Dino() override; + bool init() override; void setI2c(std::shared_ptr i2cdev, uint8_t i2c_channel) { this->i2cdev = i2cdev; this->i2c_channel = i2c_channel; @@ -89,8 +89,8 @@ class Dino : public Node { class DinoAdc : public Dino { public: DinoAdc(); - virtual ~DinoAdc(); - virtual void configureHardware() override; + ~DinoAdc() override; + void configureHardware() override; /* Set the configuration of the ADC registers * @@ -109,42 +109,40 @@ class DinoAdc : public Dino { class DinoDac : public Dino { public: DinoDac(); - virtual ~DinoDac(); - virtual void configureHardware() override; + ~DinoDac() override; + void configureHardware() override; void setGain(Gain gain); Gain getGain(); }; class DinoFactory : NodeFactory { public: - virtual std::string getDescription() const override { - return "Dino Analog I/O"; - } + std::string getDescription() const override { return "Dino Analog I/O"; } protected: - virtual void parse(Core &ip, json_t *json) override; + void parse(Core &ip, json_t *json) override; }; class DinoAdcFactory : DinoFactory { public: - virtual std::string getName() const { return "dinoAdc"; } + std::string getName() const override { return "dinoAdc"; } private: - virtual Vlnv getCompatibleVlnv() const { + Vlnv getCompatibleVlnv() const override { return Vlnv("xilinx.com:module_ref:dinoif_adc:"); } - Core *make() const { return new DinoAdc; }; + Core *make() const override { return new DinoAdc; }; }; class DinoDacFactory : DinoFactory { public: - virtual std::string getName() const { return "dinoDac"; } + std::string getName() const override { return "dinoDac"; } private: - virtual Vlnv getCompatibleVlnv() const { + Vlnv getCompatibleVlnv() const override { return Vlnv("xilinx.com:module_ref:dinoif_dac:"); } - Core *make() const { return new DinoDac; }; + Core *make() const override { return new DinoDac; }; }; } // namespace ip diff --git a/fpga/include/villas/fpga/ips/dma.hpp b/fpga/include/villas/fpga/ips/dma.hpp index 44e26c25c..abf9a092d 100644 --- a/fpga/include/villas/fpga/ips/dma.hpp +++ b/fpga/include/villas/fpga/ips/dma.hpp @@ -25,9 +25,9 @@ class Dma : public Node { public: friend class DmaFactory; - virtual ~Dma(); + ~Dma() override; - virtual bool init() override; + bool init() override; bool reset() override; @@ -84,7 +84,7 @@ class Dma : public Node { bool isMemoryBlockAccesible(const MemoryBlock &mem, const std::string &interface); - virtual void dump() override; + void dump() override; private: bool writeScatterGather(const void *buf, size_t len); @@ -154,14 +154,14 @@ class Dma : public Node { class DmaFactory : NodeFactory { public: - virtual std::string getName() const override { return "dma"; } + std::string getName() const override { return "dma"; } - virtual std::string getDescription() const override { + std::string getDescription() const override { return "Xilinx's AXI4 Direct Memory Access Controller"; } private: - virtual Vlnv getCompatibleVlnv() const override { + Vlnv getCompatibleVlnv() const override { return Vlnv("xilinx.com:ip:axi_dma:"); } @@ -169,9 +169,9 @@ class DmaFactory : NodeFactory { Core *make() const override { return new Dma; }; protected: - virtual void parse(Core &ip, json_t *json) override; + void parse(Core &ip, json_t *json) override; - virtual void configurePollingMode(Core &ip, PollingMode mode) override { + void configurePollingMode(Core &ip, PollingMode mode) override { dynamic_cast(ip).polling = (mode == POLL); } }; diff --git a/fpga/include/villas/fpga/ips/emc.hpp b/fpga/include/villas/fpga/ips/emc.hpp index 0c93f4094..5907dc746 100644 --- a/fpga/include/villas/fpga/ips/emc.hpp +++ b/fpga/include/villas/fpga/ips/emc.hpp @@ -17,7 +17,7 @@ namespace ip { class EMC : public Core { public: - virtual bool init() override; + bool init() override; bool flash(uint32_t offset, const std::string &filename); bool flash(uint32_t offset, uint32_t length, uint8_t *data); @@ -29,7 +29,7 @@ class EMC : public Core { static constexpr char registerMemory[] = "Reg"; - std::list getMemoryBlocks() const { + std::list getMemoryBlocks() const override { return {registerMemory}; } }; diff --git a/fpga/include/villas/fpga/ips/fifo.hpp b/fpga/include/villas/fpga/ips/fifo.hpp index e28c0ef02..3dff5081d 100644 --- a/fpga/include/villas/fpga/ips/fifo.hpp +++ b/fpga/include/villas/fpga/ips/fifo.hpp @@ -22,9 +22,9 @@ class Fifo : public Node { public: friend class FifoFactory; - virtual bool init() override; + bool init() override; - virtual bool stop() override; + bool stop() override; size_t write(const void *buf, size_t len); size_t read(void *buf, size_t len); @@ -34,7 +34,7 @@ class Fifo : public Node { static constexpr char axi4Memory[] = "Mem1"; static constexpr char irqName[] = "interrupt"; - std::list getMemoryBlocks() const { + std::list getMemoryBlocks() const override { return {registerMemory, axi4Memory}; } diff --git a/fpga/include/villas/fpga/ips/gpio.hpp b/fpga/include/villas/fpga/ips/gpio.hpp index c4b85b5ea..11ef20684 100644 --- a/fpga/include/villas/fpga/ips/gpio.hpp +++ b/fpga/include/villas/fpga/ips/gpio.hpp @@ -16,12 +16,12 @@ namespace ip { class Gpio : public Core { public: - virtual bool init() override; + bool init() override; private: static constexpr char registerMemory[] = "Reg"; - std::list getMemoryBlocks() const { + std::list getMemoryBlocks() const override { return {registerMemory}; } }; diff --git a/fpga/include/villas/fpga/ips/gpu2rtds.hpp b/fpga/include/villas/fpga/ips/gpu2rtds.hpp index 0177aeebb..754929df2 100644 --- a/fpga/include/villas/fpga/ips/gpu2rtds.hpp +++ b/fpga/include/villas/fpga/ips/gpu2rtds.hpp @@ -21,7 +21,7 @@ class Gpu2Rtds : public Node, public Hls { public: friend class Gpu2RtdsFactory; - virtual bool init() override; + bool init() override; void dump(spdlog::level::level_enum logLevel = spdlog::level::info); @@ -31,7 +31,7 @@ class Gpu2Rtds : public Node, public Hls { size_t getMaxFrameSize(); - const StreamVertex &getDefaultMasterPort() const { + const StreamVertex &getDefaultMasterPort() const override { return getMasterPort(rtdsOutputStreamPort); } diff --git a/fpga/include/villas/fpga/ips/hls.hpp b/fpga/include/villas/fpga/ips/hls.hpp index e62874b38..979d01b28 100644 --- a/fpga/include/villas/fpga/ips/hls.hpp +++ b/fpga/include/villas/fpga/ips/hls.hpp @@ -16,7 +16,7 @@ namespace ip { class Hls : public virtual Core { public: - virtual bool init() override { + bool init() override { auto ®isters = addressTranslations.at(registerMemory); controlRegister = reinterpret_cast( @@ -91,7 +91,7 @@ class Hls : public virtual Core { static constexpr const char *registerMemory = "Reg"; - virtual std::list getMemoryBlocks() const { + std::list getMemoryBlocks() const override { return {registerMemory}; } diff --git a/fpga/include/villas/fpga/ips/i2c.hpp b/fpga/include/villas/fpga/ips/i2c.hpp index b90f34fac..91f53d2e8 100644 --- a/fpga/include/villas/fpga/ips/i2c.hpp +++ b/fpga/include/villas/fpga/ips/i2c.hpp @@ -31,11 +31,11 @@ class I2c : public Node { friend class I2cFactory; I2c(); - virtual ~I2c(); - virtual bool init() override; - virtual bool check() override; - virtual bool reset() override; - virtual bool stop() override; + ~I2c() override; + bool init() override; + bool check() override; + bool reset() override; + bool stop() override; bool write(u8 address, std::vector &data); bool read(u8 address, std::vector &data, size_t max_read); bool readRegister(u8 address, u8 reg, std::vector &data, size_t max_read); @@ -93,7 +93,7 @@ class I2c : public Node { bool polling; std::unique_ptr switchInstance; - std::list getMemoryBlocks() const { + std::list getMemoryBlocks() const override { return {registerMemory}; } // assumes hwLock is locked @@ -104,21 +104,21 @@ class I2c : public Node { class I2cFactory : NodeFactory { public: - virtual std::string getName() const { return "i2c"; } + std::string getName() const override { return "i2c"; } - virtual std::string getDescription() const { return "Xilinx's AXI4 IIC IP"; } + std::string getDescription() const override { return "Xilinx's AXI4 IIC IP"; } private: - virtual Vlnv getCompatibleVlnv() const { + Vlnv getCompatibleVlnv() const override { return Vlnv("xilinx.com:ip:axi_iic:"); } // Create a concrete IP instance - Core *make() const { return new I2c; }; + Core *make() const override { return new I2c; }; protected: - virtual void parse(Core &ip, json_t *json) override; - virtual void configurePollingMode(Core &ip, PollingMode mode) override { + void parse(Core &ip, json_t *json) override; + void configurePollingMode(Core &ip, PollingMode mode) override { dynamic_cast(ip).polling = (mode == POLL); } }; diff --git a/fpga/include/villas/fpga/ips/intc.hpp b/fpga/include/villas/fpga/ips/intc.hpp index af3eba15c..cb459d989 100644 --- a/fpga/include/villas/fpga/ips/intc.hpp +++ b/fpga/include/villas/fpga/ips/intc.hpp @@ -22,10 +22,10 @@ class InterruptController : public Core { using IrqMaskType = uint32_t; static constexpr int maxIrqs = 32; - virtual ~InterruptController(); + ~InterruptController() override; - virtual bool init() override; - virtual bool stop() override; + bool init() override; + bool stop() override; virtual bool enableInterrupt(IrqMaskType mask, bool polling); bool enableInterrupt(const IrqPort &irq, bool polling) { @@ -47,7 +47,7 @@ class InterruptController : public Core { std::shared_ptr vfioDevice = nullptr; - std::list getMemoryBlocks() const { + std::list getMemoryBlocks() const override { return {registerMemory}; } diff --git a/fpga/include/villas/fpga/ips/pcie.hpp b/fpga/include/villas/fpga/ips/pcie.hpp index b892daf05..66526a66f 100644 --- a/fpga/include/villas/fpga/ips/pcie.hpp +++ b/fpga/include/villas/fpga/ips/pcie.hpp @@ -22,7 +22,7 @@ class AxiPciExpressBridge : public Core { public: friend class AxiPciExpressBridgeFactory; - virtual bool init() override; + bool init() override; protected: virtual const char *getAxiInterfaceName() { return "M_AXI"; }; @@ -44,42 +44,44 @@ class AxiPciExpressBridge : public Core { class XDmaBridge : public AxiPciExpressBridge { protected: - virtual const char *getAxiInterfaceName() { return "M_AXI_B"; }; + const char *getAxiInterfaceName() override { return "M_AXI_B"; }; }; class AxiPciExpressBridgeFactory : CoreFactory { public: - virtual std::string getName() const { return "pcie"; } + std::string getName() const override { return "pcie"; } - virtual std::string getDescription() const { + std::string getDescription() const override { return "Xilinx's AXI-PCIe Bridge"; } private: - virtual Vlnv getCompatibleVlnv() const { + Vlnv getCompatibleVlnv() const override { return Vlnv("xilinx.com:ip:axi_pcie:"); } // Create a concrete IP instance - Core *make() const { return new AxiPciExpressBridge; }; + Core *make() const override { return new AxiPciExpressBridge; }; protected: - virtual void parse(Core &, json_t *) override; + void parse(Core &, json_t *) override; }; class XDmaBridgeFactory : public AxiPciExpressBridgeFactory { public: - virtual std::string getDescription() const { + std::string getDescription() const override { return "Xilinx's XDMA IP configured as AXI-PCIe Bridge"; } private: - virtual Vlnv getCompatibleVlnv() const { return Vlnv("xilinx.com:ip:xdma:"); } + Vlnv getCompatibleVlnv() const override { + return Vlnv("xilinx.com:ip:xdma:"); + } // Create a concrete IP instance - Core *make() const { return new XDmaBridge; }; + Core *make() const override { return new XDmaBridge; }; }; } // namespace ip diff --git a/fpga/include/villas/fpga/ips/register.hpp b/fpga/include/villas/fpga/ips/register.hpp index 18657d7ee..69f1bd065 100644 --- a/fpga/include/villas/fpga/ips/register.hpp +++ b/fpga/include/villas/fpga/ips/register.hpp @@ -16,9 +16,9 @@ namespace ip { class Register : public Node { public: Register(); - virtual ~Register(); - virtual bool init() override; - virtual bool check() override; + ~Register() override; + bool init() override; + bool check() override; void setRegister(size_t reg, uint32_t value); void setRegister(size_t reg, float value); uint32_t getRegister(size_t reg); diff --git a/fpga/include/villas/fpga/ips/rtds.hpp b/fpga/include/villas/fpga/ips/rtds.hpp index 5168c0025..e14085a75 100644 --- a/fpga/include/villas/fpga/ips/rtds.hpp +++ b/fpga/include/villas/fpga/ips/rtds.hpp @@ -18,17 +18,19 @@ class RtdsGtfpga : public Node { static constexpr const char *masterPort = "m_axis"; static constexpr const char *slavePort = "s_axis"; - virtual void dump() override; + void dump() override; double getDt(); - std::list getMemoryBlocks() const { return {registerMemory}; } + std::list getMemoryBlocks() const override { + return {registerMemory}; + } - const StreamVertex &getDefaultSlavePort() const { + const StreamVertex &getDefaultSlavePort() const override { return getSlavePort(slavePort); } - const StreamVertex &getDefaultMasterPort() const { + const StreamVertex &getDefaultMasterPort() const override { return getMasterPort(masterPort); } diff --git a/fpga/include/villas/fpga/ips/rtds2gpu.hpp b/fpga/include/villas/fpga/ips/rtds2gpu.hpp index 508be3b7f..01af005df 100644 --- a/fpga/include/villas/fpga/ips/rtds2gpu.hpp +++ b/fpga/include/villas/fpga/ips/rtds2gpu.hpp @@ -30,11 +30,11 @@ class Rtds2Gpu : public Node, public Hls { public: friend class Rtds2GpuFactory; - virtual bool init() override; + bool init() override; void dump(spdlog::level::level_enum logLevel = spdlog::level::info); - virtual void dump() override { dump(spdlog::level::info); } + void dump() override { dump(spdlog::level::info); } bool startOnce(const MemoryBlock &mem, size_t frameSize, size_t dataOffset, size_t doorbellOffset); @@ -49,11 +49,11 @@ class Rtds2Gpu : public Node, public Hls { void doorbellReset(uint32_t &doorbellRegister) const { doorbellRegister = 0; } - std::list getMemoryBlocks() const { + std::list getMemoryBlocks() const override { return {registerMemory}; } - const StreamVertex &getDefaultSlavePort() const { + const StreamVertex &getDefaultSlavePort() const override { return getSlavePort(rtdsInputStreamPort); } diff --git a/fpga/include/villas/fpga/ips/switch.hpp b/fpga/include/villas/fpga/ips/switch.hpp index 0c90481f4..d2fe2d801 100644 --- a/fpga/include/villas/fpga/ips/switch.hpp +++ b/fpga/include/villas/fpga/ips/switch.hpp @@ -24,10 +24,10 @@ class AxiStreamSwitch : public Node { public: friend class AxiStreamSwitchFactory; - virtual bool init() override; + bool init() override; bool connectInternal(const std::string &slavePort, - const std::string &masterPort); + const std::string &masterPort) override; void printConfig() const; @@ -38,7 +38,7 @@ class AxiStreamSwitch : public Node { static constexpr char registerMemory[] = "Reg"; - std::list getMemoryBlocks() const { + std::list getMemoryBlocks() const override { return {registerMemory}; } @@ -51,22 +51,22 @@ class AxiStreamSwitch : public Node { class AxiStreamSwitchFactory : NodeFactory { public: - virtual std::string getName() const { return "switch"; } + std::string getName() const override { return "switch"; } - virtual std::string getDescription() const { + std::string getDescription() const override { return "Xilinx's AXI4-Stream switch"; } private: - virtual Vlnv getCompatibleVlnv() const { + Vlnv getCompatibleVlnv() const override { return Vlnv("xilinx.com:ip:axis_switch:"); } // Create a concrete IP instance - Core *make() const { return new AxiStreamSwitch; }; + Core *make() const override { return new AxiStreamSwitch; }; protected: - virtual void parse(Core &, json_t *) override; + void parse(Core &, json_t *) override; }; } // namespace ip diff --git a/fpga/include/villas/fpga/ips/timer.hpp b/fpga/include/villas/fpga/ips/timer.hpp index 1b57d6049..9ea377e6f 100644 --- a/fpga/include/villas/fpga/ips/timer.hpp +++ b/fpga/include/villas/fpga/ips/timer.hpp @@ -25,7 +25,7 @@ class Timer : public Core { friend class TimerFactory; public: - virtual bool init() override; + bool init() override; bool start(uint32_t ticks); bool wait(); @@ -38,7 +38,7 @@ class Timer : public Core { static constexpr uint32_t getFrequency() { return FPGA_AXI_HZ; } private: - std::list getMemoryBlocks() const { + std::list getMemoryBlocks() const override { return {registerMemory}; } diff --git a/fpga/include/villas/fpga/ips/zynq.hpp b/fpga/include/villas/fpga/ips/zynq.hpp index f21894e2c..c07bcbd2b 100644 --- a/fpga/include/villas/fpga/ips/zynq.hpp +++ b/fpga/include/villas/fpga/ips/zynq.hpp @@ -17,26 +17,26 @@ class Zynq : public Core { public: friend class ZynqFactory; - virtual bool init() override; + bool init() override; }; class ZynqFactory : CoreFactory { public: - virtual std::string getName() const { return "Zynq"; } + std::string getName() const override { return "Zynq"; } - virtual std::string getDescription() const { return "Zynq based fpga"; } + std::string getDescription() const override { return "Zynq based fpga"; } private: - virtual Vlnv getCompatibleVlnv() const { + Vlnv getCompatibleVlnv() const override { return Vlnv("xilinx.com:ip:zynq_ultra_ps_e:"); } // Create a concrete IP instance - Core *make() const { return new Zynq; }; + Core *make() const override { return new Zynq; }; protected: - virtual void parse(Core &, json_t *) override; + void parse(Core &, json_t *) override; }; } /* namespace ip */ diff --git a/fpga/include/villas/fpga/node.hpp b/fpga/include/villas/fpga/node.hpp index 9a5c87a0c..3ce7f5251 100644 --- a/fpga/include/villas/fpga/node.hpp +++ b/fpga/include/villas/fpga/node.hpp @@ -138,23 +138,23 @@ class NodeFactory : public CoreFactory { public: using CoreFactory::CoreFactory; - virtual void parse(Core &, json_t *); + void parse(Core &, json_t *) override; }; template class NodePlugin : public NodeFactory { public: - virtual std::string getName() const { return name; } + std::string getName() const override { return name; } - virtual std::string getDescription() const { return desc; } + std::string getDescription() const override { return desc; } private: // Get a VLNV identifier for which this IP / Node type can be used. - virtual Vlnv getCompatibleVlnv() const { return Vlnv(vlnv); } + Vlnv getCompatibleVlnv() const override { return Vlnv(vlnv); } // Create a concrete IP instance - Core *make() const { return new T; } + Core *make() const override { return new T; } }; } // namespace ip diff --git a/fpga/include/villas/fpga/pcie_card.hpp b/fpga/include/villas/fpga/pcie_card.hpp index a8fbcc4b3..95b045567 100644 --- a/fpga/include/villas/fpga/pcie_card.hpp +++ b/fpga/include/villas/fpga/pcie_card.hpp @@ -34,7 +34,7 @@ class PCIeCardFactory; class PCIeCard : public Card { public: - ~PCIeCard(); + ~PCIeCard() override; bool init(); @@ -72,13 +72,13 @@ class PCIeCardFactory : public plugin::Plugin { return villas::Log::get("pcie:card:factory"); } - virtual std::string getName() const { return "pcie"; } + std::string getName() const override { return "pcie"; } - virtual std::string getDescription() const { + std::string getDescription() const override { return "Xilinx PCIe FPGA cards"; } - virtual std::string getType() const { return "card"; } + std::string getType() const override { return "card"; } }; } // namespace fpga diff --git a/fpga/include/villas/fpga/platform_card.hpp b/fpga/include/villas/fpga/platform_card.hpp index 22fc4b93b..39df00441 100644 --- a/fpga/include/villas/fpga/platform_card.hpp +++ b/fpga/include/villas/fpga/platform_card.hpp @@ -25,7 +25,7 @@ class PlatformCard : public Card { public: PlatformCard(std::shared_ptr vfioContainer); - ~PlatformCard(){}; + ~PlatformCard() override{}; std::vector core_connections; diff --git a/fpga/include/villas/fpga/utils.hpp b/fpga/include/villas/fpga/utils.hpp index f87a37c22..8b45306c9 100644 --- a/fpga/include/villas/fpga/utils.hpp +++ b/fpga/include/villas/fpga/utils.hpp @@ -102,7 +102,7 @@ class BufferedSampleFormatterShort : public BufferedSampleFormatter { BufferedSampleFormatterShort(size_t bufSizeInSamples) : BufferedSampleFormatter(bufSizeInSamples, formatStringSize){}; - virtual void format(float value) override { + void format(float value) override { size_t chars; if ((chars = std::snprintf(nextBufPos(), formatStringSize + 1, formatString, value)) > (int)formatStringSize) { @@ -123,7 +123,7 @@ class BufferedSampleFormatterLong : public BufferedSampleFormatter { : BufferedSampleFormatter(bufSizeInSamples, formatStringSize), sampleCnt(0){}; - virtual void format(float value) override { + void format(float value) override { if (std::snprintf(nextBufPos(), formatStringSize + 1, formatString, sampleCnt, value) > (int)formatStringSize) { throw RuntimeError("Output buffer too small"); diff --git a/include/villas/api/request.hpp b/include/villas/api/request.hpp index 7330949fe..909413db5 100644 --- a/include/villas/api/request.hpp +++ b/include/villas/api/request.hpp @@ -103,7 +103,7 @@ class RequestFactory : public plugin::Plugin { virtual void init(Request *r) { r->logger = getLogger(); } - virtual std::string getType() const { return "api:request"; } + std::string getType() const override { return "api:request"; } virtual bool isHidden() const { return false; } }; @@ -117,7 +117,7 @@ class RequestPlugin : public RequestFactory { public: RequestPlugin() : RequestFactory(), regex(re) {} - virtual Request *make(Session *s) { + Request *make(Session *s) override { auto *r = new T(s); init(r); @@ -126,12 +126,12 @@ class RequestPlugin : public RequestFactory { } // Get plugin name - virtual std::string getName() const { return name; } + std::string getName() const override { return name; } // Get plugin description - virtual std::string getDescription() const { return desc; } + std::string getDescription() const override { return desc; } - virtual bool match(const std::string &uri, std::smatch &match) const { + bool match(const std::string &uri, std::smatch &match) const override { return std::regex_match(uri, match, regex); } }; diff --git a/include/villas/api/response.hpp b/include/villas/api/response.hpp index 1ee690363..dea447370 100644 --- a/include/villas/api/response.hpp +++ b/include/villas/api/response.hpp @@ -65,9 +65,9 @@ class JsonResponse : public Response { JsonResponse(Session *s, int c, json_t *r) : Response(s, c, "application/json"), response(r) {} - virtual ~JsonResponse(); + ~JsonResponse() override; - virtual void encodeBody(); + void encodeBody() override; }; class ErrorResponse : public JsonResponse { diff --git a/include/villas/format.hpp b/include/villas/format.hpp index f313e2e8a..56f0fde18 100644 --- a/include/villas/format.hpp +++ b/include/villas/format.hpp @@ -127,7 +127,7 @@ class FormatFactory : public plugin::Plugin { virtual void init(Format *f) { f->logger = getLogger(); } - virtual std::string getType() const { return "format"; } + std::string getType() const override { return "format"; } virtual bool isHidden() const { return false; } }; @@ -138,7 +138,7 @@ class FormatPlugin : public FormatFactory { public: using FormatFactory::FormatFactory; - virtual Format *make() { + Format *make() override { auto *f = new T(flags); init(f); @@ -146,9 +146,9 @@ class FormatPlugin : public FormatFactory { return f; } - virtual std::string getName() const { return name; } + std::string getName() const override { return name; } - virtual std::string getDescription() const { return desc; } + std::string getDescription() const override { return desc; } }; } // namespace node diff --git a/include/villas/formats/villas_binary.hpp b/include/villas/formats/villas_binary.hpp index 700a6772b..f6642132b 100644 --- a/include/villas/formats/villas_binary.hpp +++ b/include/villas/formats/villas_binary.hpp @@ -60,7 +60,7 @@ class VillasBinaryFormatPlugin : public FormatFactory { } // Get plugin description - virtual std::string getDescription() const { + std::string getDescription() const override { std::stringstream ss; ss << "VILLAS binary network format"; diff --git a/include/villas/hook.hpp b/include/villas/hook.hpp index 69eb3f3a1..b0a731ba5 100644 --- a/include/villas/hook.hpp +++ b/include/villas/hook.hpp @@ -131,9 +131,9 @@ class SingleSignalHook : public Hook { SingleSignalHook(Path *p, Node *n, int fl, int prio, bool en = true) : Hook(p, n, fl, prio, en), signalIndex(0) {} - virtual void parse(json_t *json); + void parse(json_t *json) override; - virtual void prepare(); + void prepare() override; }; class MultiSignalHook : public Hook { @@ -145,11 +145,11 @@ class MultiSignalHook : public Hook { public: using Hook::Hook; - virtual void parse(json_t *json); + void parse(json_t *json) override; - virtual void prepare(); + void prepare() override; - virtual void check(); + void check() override; }; class LimitHook : public Hook { @@ -160,7 +160,7 @@ class LimitHook : public Hook { virtual void setRate(double rate, double maxRate = -1) = 0; - virtual void parse(json_t *json) { + void parse(json_t *json) override { assert(state == State::INITIALIZED); state = State::PARSED; @@ -191,7 +191,7 @@ class HookFactory : public plugin::Plugin { virtual unsigned getPriority() const = 0; - virtual std::string getType() const { return "hook"; } + std::string getType() const override { return "hook"; } virtual bool isHidden() const { return false; } }; @@ -203,7 +203,7 @@ class HookPlugin : public HookFactory { public: using HookFactory::HookFactory; - virtual Hook::Ptr make(Path *p, Node *n) { + Hook::Ptr make(Path *p, Node *n) override { auto h = std::make_shared(p, n, getFlags(), getPriority()); init(h); @@ -211,13 +211,13 @@ class HookPlugin : public HookFactory { return h; } - virtual std::string getName() const { return name; } + std::string getName() const override { return name; } - virtual std::string getDescription() const { return desc; } + std::string getDescription() const override { return desc; } - virtual int getFlags() const { return flags; } + int getFlags() const override { return flags; } - virtual unsigned getPriority() const { return prio; } + unsigned getPriority() const override { return prio; } }; } // namespace node diff --git a/include/villas/hooks/lua.hpp b/include/villas/hooks/lua.hpp index 8961db7af..a9b5edd4d 100644 --- a/include/villas/hooks/lua.hpp +++ b/include/villas/hooks/lua.hpp @@ -105,7 +105,7 @@ class LuaHook : public Hook { public: LuaHook(Path *p, Node *n, int fl, int prio, bool en = true); - virtual ~LuaHook(); + ~LuaHook() override; void parse(json_t *json) override; diff --git a/include/villas/node.hpp b/include/villas/node.hpp index f4c52a62e..021b03851 100644 --- a/include/villas/node.hpp +++ b/include/villas/node.hpp @@ -316,7 +316,7 @@ class NodeFactory : public villas::plugin::Plugin { static Node *make(const std::string &type, const uuid_t &id = {}, const std::string &name = ""); - virtual std::string getType() const { return "node"; } + std::string getType() const override { return "node"; } friend std::ostream &operator<<(std::ostream &os, const NodeFactory &f) { os << f.getName(); @@ -346,7 +346,7 @@ template T *getData() { return static_cast(_vd); } diff --git a/include/villas/nodes/exec.hpp b/include/villas/nodes/exec.hpp index 28e3d97c1..d1d014c61 100644 --- a/include/villas/nodes/exec.hpp +++ b/include/villas/nodes/exec.hpp @@ -42,7 +42,7 @@ class ExecNode : public Node { : Node(id, name), stream_in(nullptr), stream_out(nullptr), flush(true), shell(false) {} - virtual ~ExecNode(); + ~ExecNode() override; const std::string &getDetails() override; diff --git a/include/villas/nodes/fpga.hpp b/include/villas/nodes/fpga.hpp index 8264fa616..a17988b86 100644 --- a/include/villas/nodes/fpga.hpp +++ b/include/villas/nodes/fpga.hpp @@ -80,7 +80,7 @@ class FpgaNode : public Node { public: FpgaNode(const uuid_t &id = {}, const std::string &name = ""); - virtual ~FpgaNode(); + ~FpgaNode() override; int prepare() override; diff --git a/include/villas/nodes/iec60870.hpp b/include/villas/nodes/iec60870.hpp index 707503e17..bd0335efc 100644 --- a/include/villas/nodes/iec60870.hpp +++ b/include/villas/nodes/iec60870.hpp @@ -201,7 +201,7 @@ class SlaveNode : public Node { public: SlaveNode(const uuid_t &id = {}, const std::string &name = ""); - virtual ~SlaveNode() override; + ~SlaveNode() override; int parse(json_t *json) override; diff --git a/include/villas/nodes/iec61850_goose.hpp b/include/villas/nodes/iec61850_goose.hpp index 22304b038..47a7d3c77 100644 --- a/include/villas/nodes/iec61850_goose.hpp +++ b/include/villas/nodes/iec61850_goose.hpp @@ -260,7 +260,7 @@ class GooseNode : public Node { public: GooseNode(const uuid_t &id = {}, const std::string &name = ""); - virtual ~GooseNode() override; + ~GooseNode() override; std::vector getPollFDs() override; diff --git a/include/villas/nodes/loopback.hpp b/include/villas/nodes/loopback.hpp index 930e641de..da281d5e8 100644 --- a/include/villas/nodes/loopback.hpp +++ b/include/villas/nodes/loopback.hpp @@ -28,7 +28,7 @@ class LoopbackNode : public Node { public: LoopbackNode(const uuid_t &id = {}, const std::string &name = ""); - virtual ~LoopbackNode(); + ~LoopbackNode() override; int prepare() override; diff --git a/include/villas/nodes/loopback_internal.hpp b/include/villas/nodes/loopback_internal.hpp index 411268ba0..b5f130985 100644 --- a/include/villas/nodes/loopback_internal.hpp +++ b/include/villas/nodes/loopback_internal.hpp @@ -28,7 +28,7 @@ class InternalLoopbackNode : public Node { InternalLoopbackNode(Node *src, unsigned id = 0, unsigned ql = DEFAULT_QUEUE_LENGTH); - virtual ~InternalLoopbackNode(); + ~InternalLoopbackNode() override; std::vector getPollFDs() override; diff --git a/include/villas/nodes/modbus.hpp b/include/villas/nodes/modbus.hpp index d6c455cd6..ce67df311 100644 --- a/include/villas/nodes/modbus.hpp +++ b/include/villas/nodes/modbus.hpp @@ -275,7 +275,7 @@ class ModbusNode final : public Node { public: ModbusNode(const uuid_t &id = {}, const std::string &name = ""); - virtual ~ModbusNode(); + ~ModbusNode() override; int prepare() override; diff --git a/include/villas/nodes/opal_async.hpp b/include/villas/nodes/opal_async.hpp index 5486817ae..a04d10be0 100644 --- a/include/villas/nodes/opal_async.hpp +++ b/include/villas/nodes/opal_async.hpp @@ -81,9 +81,9 @@ class OpalAsyncNode : public Node { std::mutex readyLock; std::condition_variable readyCv; - virtual int _read(struct Sample *smps[], unsigned cnt) override; + int _read(struct Sample *smps[], unsigned cnt) override; - virtual int _write(struct Sample *smps[], unsigned cnt) override; + int _write(struct Sample *smps[], unsigned cnt) override; public: OpalAsyncNode(const uuid_t &id = {}, const std::string &name = "") @@ -98,12 +98,12 @@ class OpalAsyncNode : public Node { out.length = 0; } - virtual const std::string &getDetails() override; + const std::string &getDetails() override; - virtual int start() override; - virtual int stop() override; + int start() override; + int stop() override; - virtual int parse(json_t *json) override; + int parse(json_t *json) override; void markReady(); void waitReady(); @@ -114,8 +114,7 @@ class OpalAsyncNodeFactory : public NodeFactory { public: using NodeFactory::NodeFactory; - virtual Node *make(const uuid_t &id = {}, - const std::string &nme = "") override { + Node *make(const uuid_t &id = {}, const std::string &nme = "") override { auto *n = new OpalAsyncNode(id, nme); init(n); @@ -123,23 +122,23 @@ class OpalAsyncNodeFactory : public NodeFactory { return n; } - virtual int getFlags() const override { + int getFlags() const override { return (int)NodeFactory::Flags::SUPPORTS_READ | (int)NodeFactory::Flags::SUPPORTS_WRITE | (int)NodeFactory::Flags::PROVIDES_SIGNALS; } - virtual std::string getName() const override { return "opal.async"; } + std::string getName() const override { return "opal.async"; } - virtual std::string getDescription() const override { + std::string getDescription() const override { return "OPAL Asynchronous Process (libOpalAsyncApi)"; } - virtual int getVectorize() const override { return 1; } + int getVectorize() const override { return 1; } - virtual int start(SuperNode *sn) override; + int start(SuperNode *sn) override; - virtual int stop() override; + int stop() override; }; } // namespace node diff --git a/include/villas/nodes/opendss.hpp b/include/villas/nodes/opendss.hpp index 1f6e85b65..bc6acb4b1 100644 --- a/include/villas/nodes/opendss.hpp +++ b/include/villas/nodes/opendss.hpp @@ -59,7 +59,7 @@ class OpenDSS : public Node { public: OpenDSS(const uuid_t &id = {}, const std::string &name = ""); - virtual ~OpenDSS(); + ~OpenDSS() override; int prepare() override; diff --git a/include/villas/nodes/temper.hpp b/include/villas/nodes/temper.hpp index 3eeeabcbf..ad0073c73 100644 --- a/include/villas/nodes/temper.hpp +++ b/include/villas/nodes/temper.hpp @@ -52,7 +52,7 @@ class TEMPerDevice : public villas::usb::Device { class TEMPer1Device : public TEMPerDevice { protected: - virtual void decode(unsigned char *answer, float *temp); + void decode(unsigned char *answer, float *temp) override; using TEMPerDevice::TEMPerDevice; @@ -65,7 +65,7 @@ class TEMPer1Device : public TEMPerDevice { class TEMPer2Device : public TEMPer1Device { protected: - virtual void decode(unsigned char *answer, float *temp); + void decode(unsigned char *answer, float *temp) override; using TEMPer1Device::TEMPer1Device; @@ -74,13 +74,13 @@ class TEMPer2Device : public TEMPer1Device { static std::string getName() { return "TEMPer2"; } - virtual int getNumSensors() const { return 2; } + int getNumSensors() const override { return 2; } }; class TEMPerHUMDevice : public TEMPerDevice { protected: - virtual void decode(unsigned char *answer, float *temp); + void decode(unsigned char *answer, float *temp) override; using TEMPerDevice::TEMPerDevice; @@ -89,7 +89,7 @@ class TEMPerHUMDevice : public TEMPerDevice { static std::string getName() { return "TEMPerHUM"; } - virtual bool hasHumiditySensor() const { return true; } + bool hasHumiditySensor() const override { return true; } }; struct temper { diff --git a/include/villas/nodes/test_rtt.hpp b/include/villas/nodes/test_rtt.hpp index 4732dda09..d2b1f68fb 100644 --- a/include/villas/nodes/test_rtt.hpp +++ b/include/villas/nodes/test_rtt.hpp @@ -95,7 +95,7 @@ class TestRTT : public Node { : Node(id, name), task(), formatter(nullptr), stream(nullptr), current(), shutdown(false) {} - virtual ~TestRTT(){}; + ~TestRTT() override{}; int prepare() override; diff --git a/include/villas/nodes/webrtc.hpp b/include/villas/nodes/webrtc.hpp index f09e524c6..a562bd683 100644 --- a/include/villas/nodes/webrtc.hpp +++ b/include/villas/nodes/webrtc.hpp @@ -50,7 +50,7 @@ class WebRTCNode : public Node { public: WebRTCNode(const uuid_t &id = {}, const std::string &name = ""); - virtual ~WebRTCNode(); + ~WebRTCNode() override; int prepare() override; diff --git a/include/villas/path_source.hpp b/include/villas/path_source.hpp index 5967e0902..ce5870ca6 100644 --- a/include/villas/path_source.hpp +++ b/include/villas/path_source.hpp @@ -81,7 +81,7 @@ class MasterPathSource : public PathSource { const SecondaryPathSourceList &getSecondaries() { return secondaries; } - virtual void writeToSecondaries(struct Sample *smps[], unsigned cnt); + void writeToSecondaries(struct Sample *smps[], unsigned cnt) override; }; } // namespace node diff --git a/include/villas/usb.hpp b/include/villas/usb.hpp index e77da36f8..e4060384d 100644 --- a/include/villas/usb.hpp +++ b/include/villas/usb.hpp @@ -47,12 +47,12 @@ class Error : public std::runtime_error { Error(int e, const std::string &what, Args &&...args) : usb::Error((enum libusb_error)e, what, std::forward(args)...) {} - ~Error() { + ~Error() override { if (msg) free(msg); } - virtual const char *what() const noexcept { return msg; } + const char *what() const noexcept override { return msg; } }; class Device { diff --git a/lib/api/requests/graph.cpp b/lib/api/requests/graph.cpp index 9c8da2c1a..7e95878f7 100644 --- a/lib/api/requests/graph.cpp +++ b/lib/api/requests/graph.cpp @@ -33,7 +33,7 @@ class GraphRequest : public Request { layout = "neato"; } - ~GraphRequest() { gvFreeContext(gvc); } + ~GraphRequest() override { gvFreeContext(gvc); } Response *execute() override { if (method != Session::Method::GET) diff --git a/lib/api/requests/metrics.cpp b/lib/api/requests/metrics.cpp index 08d7c9c32..0b3dc30fb 100644 --- a/lib/api/requests/metrics.cpp +++ b/lib/api/requests/metrics.cpp @@ -26,7 +26,7 @@ class MetricsRequest : public Request { public: using Request::Request; - virtual Response *execute() { + Response *execute() override { if (method != Session::Method::GET) { throw Error::invalidMethod(this); } diff --git a/lib/hooks/digest.cpp b/lib/hooks/digest.cpp index 0d82cfc35..4b81ae0c8 100644 --- a/lib/hooks/digest.cpp +++ b/lib/hooks/digest.cpp @@ -221,7 +221,7 @@ class DigestHook : public Hook { throw RuntimeError{"Could not fetch algorithm {}", algorithm}; } - virtual void start() override { + void start() override { Hook::start(); if (!EVP_DigestInit_ex(md_ctx.get(), md, NULL)) @@ -238,7 +238,7 @@ class DigestHook : public Hook { return Reason::OK; } - virtual void stop() override { + void stop() override { Hook::stop(); first_sequence.reset(); diff --git a/lib/hooks/dp.cpp b/lib/hooks/dp.cpp index 75697c9e5..5038ae1f5 100644 --- a/lib/hooks/dp.cpp +++ b/lib/hooks/dp.cpp @@ -98,7 +98,7 @@ class DPHook : public Hook { inverse(0), f0(50.0), timestep(50e-6), time(), steps(0), coeffs(), fharmonics(), fharmonics_len(0) {} - virtual ~DPHook() { + ~DPHook() override { // Release memory if (fharmonics) delete fharmonics; @@ -110,7 +110,7 @@ class DPHook : public Hook { free(signal_name); } - virtual void start() override { + void start() override { assert(state == State::PREPARED); time = 0; @@ -249,7 +249,7 @@ class DPHook : public Hook { state = State::PREPARED; } - virtual void check() { + void check() override { assert(state == State::PARSED); if (signal_index < 0) diff --git a/lib/hooks/drop.cpp b/lib/hooks/drop.cpp index ac6a5728f..5e41e1c06 100644 --- a/lib/hooks/drop.cpp +++ b/lib/hooks/drop.cpp @@ -19,7 +19,7 @@ class DropHook : public Hook { public: using Hook::Hook; - virtual void start() override { + void start() override { assert(state == State::PREPARED || state == State::STOPPED); prev = nullptr; @@ -27,7 +27,7 @@ class DropHook : public Hook { state = State::STARTED; } - virtual void stop() override { + void stop() override { assert(state == State::STARTED); if (prev) @@ -60,7 +60,7 @@ class DropHook : public Hook { return Reason::OK; } - virtual void restart() { + void restart() override { assert(state == State::STARTED); if (prev) { diff --git a/lib/hooks/ebm.cpp b/lib/hooks/ebm.cpp index e134f611d..a9289c9ae 100644 --- a/lib/hooks/ebm.cpp +++ b/lib/hooks/ebm.cpp @@ -55,7 +55,7 @@ class EBMHook : public Hook { state = State::PARSED; } - virtual void start() override { + void start() override { assert(state == State::PREPARED); energy = 0; @@ -64,7 +64,7 @@ class EBMHook : public Hook { state = State::STARTED; } - virtual void periodic() override { + void periodic() override { assert(state == State::STARTED); logger->info("Energy: {}", energy); diff --git a/lib/hooks/frame.cpp b/lib/hooks/frame.cpp index 261ce5e45..3006835ac 100644 --- a/lib/hooks/frame.cpp +++ b/lib/hooks/frame.cpp @@ -65,7 +65,7 @@ class FrameHook : public Hook { : Hook(p, n, fl, prio, en), interval(TimeInterval(0)), last_smp{nullptr, &sample_decref} {} - virtual ~FrameHook() { (void)last_smp.release(); } + ~FrameHook() override { (void)last_smp.release(); } void parse(json_t *json) override { Hook::parse(json); @@ -94,7 +94,7 @@ class FrameHook : public Hook { } } - virtual Hook::Reason process(Sample *smp) override { + Hook::Reason process(Sample *smp) override { Hook::process(smp); if (updateInterval(smp)) @@ -108,7 +108,7 @@ class FrameHook : public Hook { return Reason::OK; } - virtual void stop() override { + void stop() override { Hook::stop(); last_smp = nullptr; diff --git a/lib/hooks/lua.cpp b/lib/hooks/lua.cpp index 8f9c6ba0c..877d859e4 100644 --- a/lib/hooks/lua.cpp +++ b/lib/hooks/lua.cpp @@ -36,7 +36,7 @@ class LuaError : public RuntimeError { public: LuaError(lua_State *l, int e) : RuntimeError(""), L(l), err(e) {} - virtual const char *what() const noexcept { + const char *what() const noexcept override { const char *msg; switch (err) { case LUA_ERRSYNTAX: diff --git a/lib/hooks/pmu_dft.cpp b/lib/hooks/pmu_dft.cpp index 7ab6de59a..37402e2cc 100644 --- a/lib/hooks/pmu_dft.cpp +++ b/lib/hooks/pmu_dft.cpp @@ -324,7 +324,7 @@ class PmuDftHook : public MultiSignalHook { state = State::PARSED; } - virtual void check() { + void check() override { assert(state == State::PARSED); if (endFreqency < 0 || endFreqency > sampleRate) diff --git a/lib/hooks/pmu_ipdft.cpp b/lib/hooks/pmu_ipdft.cpp index 787cb76e5..f67756551 100644 --- a/lib/hooks/pmu_ipdft.cpp +++ b/lib/hooks/pmu_ipdft.cpp @@ -26,7 +26,7 @@ class IpDftPmuHook : public PmuHook { {} - void prepare() { + void prepare() override { PmuHook::prepare(); const double startFrequency = nominalFreq - estimationRange; @@ -53,7 +53,7 @@ class IpDftPmuHook : public PmuHook { } } - void parse(json_t *json) { + void parse(json_t *json) override { PmuHook::parse(json); int ret; @@ -77,7 +77,7 @@ class IpDftPmuHook : public PmuHook { } PmuHook::Phasor estimatePhasor(dsp::CosineWindow *window, - const PmuHook::Phasor &lastPhasor) { + const PmuHook::Phasor &lastPhasor) override { PmuHook::Phasor phasor = {0}; // Calculate DFT diff --git a/lib/hooks/pps_ts.cpp b/lib/hooks/pps_ts.cpp index fe638760c..26abfb6dd 100644 --- a/lib/hooks/pps_ts.cpp +++ b/lib/hooks/pps_ts.cpp @@ -86,7 +86,7 @@ class PpsTsHook : public SingleSignalHook { state = State::PARSED; } - virtual villas::node::Hook::Reason process(struct Sample *smp) { + villas::node::Hook::Reason process(struct Sample *smp) override { switch (mode) { case Mode::SIMPLE: return processSimple(smp); diff --git a/lib/hooks/print.cpp b/lib/hooks/print.cpp index 229970155..6b0ab5b86 100644 --- a/lib/hooks/print.cpp +++ b/lib/hooks/print.cpp @@ -32,7 +32,7 @@ class PrintHook : public Hook { PrintHook(Path *p, Node *n, int fl, int prio, bool en = true) : Hook(p, n, fl, prio, en), output(nullptr) {} - virtual void start() override { + void start() override { assert(state == State::PREPARED || state == State::STOPPED); if (!output_path.empty()) { @@ -47,7 +47,7 @@ class PrintHook : public Hook { state = State::STARTED; } - virtual void stop() override { + void stop() override { if (output) fclose(output); } diff --git a/lib/hooks/reorder_ts.cpp b/lib/hooks/reorder_ts.cpp index 7b96fb68e..aa1f09192 100644 --- a/lib/hooks/reorder_ts.cpp +++ b/lib/hooks/reorder_ts.cpp @@ -57,7 +57,7 @@ class ReorderTsHook : public Hook { state = State::PARSED; } - virtual void start() override { + void start() override { assert(state == State::PREPARED || state == State::STOPPED); window.reserve(window_size); @@ -65,7 +65,7 @@ class ReorderTsHook : public Hook { state = State::STARTED; } - virtual void stop() override { + void stop() override { assert(state == State::STARTED); for (auto sample : window) @@ -79,7 +79,7 @@ class ReorderTsHook : public Hook { state = State::STOPPED; } - virtual Hook::Reason process(Sample *smp) { + Hook::Reason process(Sample *smp) override { assert(state == State::STARTED); assert(smp); @@ -134,7 +134,7 @@ class ReorderTsHook : public Hook { return Hook::Reason::SKIP_SAMPLE; } - virtual void restart() { + void restart() override { assert(state == State::STARTED); for (auto sample : window) diff --git a/lib/hooks/restart.cpp b/lib/hooks/restart.cpp index 116157715..37ea8018a 100644 --- a/lib/hooks/restart.cpp +++ b/lib/hooks/restart.cpp @@ -20,7 +20,7 @@ class RestartHook : public Hook { public: using Hook::Hook; - virtual void start() override { + void start() override { assert(state == State::PREPARED); prev = nullptr; @@ -28,7 +28,7 @@ class RestartHook : public Hook { state = State::STARTED; } - virtual void stop() override { + void stop() override { assert(state == State::STARTED); if (prev) diff --git a/lib/hooks/skip_first.cpp b/lib/hooks/skip_first.cpp index 16c2afbcf..7a5e06df3 100644 --- a/lib/hooks/skip_first.cpp +++ b/lib/hooks/skip_first.cpp @@ -68,12 +68,12 @@ class SkipFirstHook : public Hook { throw ConfigError(json, err, "node-config-hook-skip_first"); } - virtual void start() override { + void start() override { skip_state = SkipState::STARTED; state = State::STARTED; } - virtual void restart() { skip_state = SkipState::STARTED; } + void restart() override { skip_state = SkipState::STARTED; } Hook::Reason process(struct Sample *smp) override { assert(state == State::STARTED); diff --git a/lib/hooks/stats.cpp b/lib/hooks/stats.cpp index d5c5edc2e..f16d5a232 100644 --- a/lib/hooks/stats.cpp +++ b/lib/hooks/stats.cpp @@ -32,7 +32,7 @@ class StatsWriteHook : public Hook { state = State::PARSED; } - virtual Hook::Reason process(struct Sample *smp); + Hook::Reason process(struct Sample *smp) override; }; class StatsReadHook : public Hook { @@ -50,7 +50,7 @@ class StatsReadHook : public Hook { state = State::PARSED; } - virtual void start() override { + void start() override { assert(state == State::PREPARED); last = nullptr; @@ -58,7 +58,7 @@ class StatsReadHook : public Hook { state = State::STARTED; } - virtual void stop() override { + void stop() override { assert(state == State::STARTED); if (last) @@ -67,7 +67,7 @@ class StatsReadHook : public Hook { state = State::STOPPED; } - virtual Hook::Reason process(struct Sample *smp); + Hook::Reason process(struct Sample *smp) override; }; class StatsHook : public Hook { @@ -109,7 +109,7 @@ class StatsHook : public Hook { StatsHook &operator=(const StatsHook &) = delete; StatsHook(const StatsHook &) = delete; - virtual void start() override { + void start() override { assert(state == State::PREPARED); if (!uri.empty()) { @@ -121,7 +121,7 @@ class StatsHook : public Hook { state = State::STARTED; } - virtual void stop() override { + void stop() override { assert(state == State::STARTED); stats->print(uri.empty() ? stdout : output, format, verbose); @@ -132,7 +132,7 @@ class StatsHook : public Hook { state = State::STOPPED; } - virtual void restart() { + void restart() override { assert(state == State::STARTED); stats->reset(); @@ -146,7 +146,7 @@ class StatsHook : public Hook { return Hook::Reason::OK; } - virtual void periodic() override { + void periodic() override { assert(state == State::STARTED); stats->printPeriodic(uri.empty() ? stdout : output, format, node); diff --git a/lib/node.cpp b/lib/node.cpp index b7453eb4b..e343ed614 100644 --- a/lib/node.cpp +++ b/lib/node.cpp @@ -140,7 +140,7 @@ int Node::parse(json_t *json) { struct { const char *str; - struct NodeDirection *dir; + NodeDirection *dir; } dirs[] = {{"in", &in}, {"out", &out}}; const char *fields[] = {"signals", "builtin", "vectorize", "hooks"}; diff --git a/lib/nodes/example.cpp b/lib/nodes/example.cpp index 56b969370..579d659e4 100644 --- a/lib/nodes/example.cpp +++ b/lib/nodes/example.cpp @@ -72,7 +72,7 @@ class ExampleNode : public Node { * Have a look at node.hpp/node.cpp for the default behaviour. */ - virtual ~ExampleNode() {} + ~ExampleNode() override {} int prepare() override { state1 = setting1; diff --git a/lib/path.cpp b/lib/path.cpp index 5adac5bc0..a72b99737 100644 --- a/lib/path.cpp +++ b/lib/path.cpp @@ -167,7 +167,7 @@ void Path::prepare(NodeList &nodes) { // Create path sources std::unordered_map psm; - unsigned i = 0, j = 0; + unsigned i = 0; for (auto me : mappings) { Node *n = me->node; PathSource::Ptr ps; @@ -208,7 +208,7 @@ void Path::prepare(NodeList &nodes) { if (masked.empty() || std::find(masked.begin(), masked.end(), n) != masked.end()) { ps->masked = true; - mask.set(j); + mask.set(i); } /* Get the real node backing this path source @@ -219,7 +219,7 @@ void Path::prepare(NodeList &nodes) { rn->sources.push_back(ps); sources.push_back(ps); - j++; + i++; psm[n] = ps; } @@ -251,7 +251,6 @@ void Path::prepare(NodeList &nodes) { } ps->mappings.push_back(me); - i++; } // Prepare path destinations diff --git a/plugins/example_hook.cpp b/plugins/example_hook.cpp index 1c56ce885..bac221e12 100644 --- a/plugins/example_hook.cpp +++ b/plugins/example_hook.cpp @@ -16,7 +16,7 @@ class ExampleHook : public Hook { public: using Hook::Hook; - virtual void restart() { + void restart() override { logger->info("The path {} restarted!", path->toString()); } }; diff --git a/src/villas-compare.cpp b/src/villas-compare.cpp index 818254a6e..8300fba38 100644 --- a/src/villas-compare.cpp +++ b/src/villas-compare.cpp @@ -101,7 +101,7 @@ class Compare : public Tool { std::vector filenames; - void usage() { + void usage() override { std::cout << "Usage: villas-compare [OPTIONS] FILE1 FILE2 ... FILEn" << std::endl << " FILE a list of files to compare" << std::endl @@ -130,7 +130,7 @@ class Compare : public Tool { printCopyright(); } - void parse() { + void parse() override { // Parse Arguments int c; char *endptr; @@ -192,7 +192,7 @@ class Compare : public Tool { filenames.push_back(argv[optind + i]); } - int main() { + int main() override { int ret, rc = 0, failed; unsigned eofs; diff --git a/src/villas-conf2json.cpp b/src/villas-conf2json.cpp index ed9e5bf79..14710818c 100644 --- a/src/villas-conf2json.cpp +++ b/src/villas-conf2json.cpp @@ -26,14 +26,14 @@ class Config2Json : public Tool { Config2Json(int argc, char *argv[]) : Tool(argc, argv, "conf2json") {} protected: - void usage() { + void usage() override { std::cout << "Usage: conf2json input.conf > output.json" << std::endl << std::endl; printCopyright(); } - int main() { + int main() override { int ret; config_t cfg; config_setting_t *cfg_root; diff --git a/src/villas-convert.cpp b/src/villas-convert.cpp index 73fe656b1..e3584631c 100644 --- a/src/villas-convert.cpp +++ b/src/villas-convert.cpp @@ -52,7 +52,7 @@ class Convert : public Tool { Format *formatter; } dirs[2]; - void usage() { + void usage() override { std::cout << "Usage: villas-convert [OPTIONS]" << std::endl << " OPTIONS are:" << std::endl << " -i FMT set the input format" << std::endl @@ -67,7 +67,7 @@ class Convert : public Tool { printCopyright(); } - void parse() { + void parse() override { // Parse optional command line arguments int c; while ((c = getopt(argc, argv, "Vhd:i:o:t:")) != -1) { @@ -105,7 +105,7 @@ class Convert : public Tool { } } - int main() { + int main() override { int ret; for (unsigned i = 0; i < ARRAY_LEN(dirs); i++) { diff --git a/src/villas-graph.cpp b/src/villas-graph.cpp index 78e19c67f..7e810843d 100644 --- a/src/villas-graph.cpp +++ b/src/villas-graph.cpp @@ -56,14 +56,14 @@ class Graph : public Tool { std::string configFilename; - void usage() { + void usage() override { std::cout << "Usage: villas-graph [OPTIONS]" << std::endl << "For OPTIONS see dot(1)."; printCopyright(); } - void parse() { + void parse() override { gvParseArgs(gvc, argc, argv); std::list filenames; @@ -77,7 +77,7 @@ class Graph : public Tool { configFilename = filenames.front(); } - virtual void handler(int signal, siginfo_t *siginfp, void *) { + void handler(int signal, siginfo_t *siginfp, void *) override { #ifndef _WIN32 switch (signal) { case SIGINT: @@ -98,7 +98,7 @@ class Graph : public Tool { #endif // _WIN32 } - int main() { + int main() override { int ret; villas::node::SuperNode sn; diff --git a/src/villas-hook.cpp b/src/villas-hook.cpp index 1441242b3..24e33d33f 100644 --- a/src/villas-hook.cpp +++ b/src/villas-hook.cpp @@ -68,9 +68,11 @@ class Hook : public Tool { json_t *config; - void handler(int signal, siginfo_t *sinfo, void *ctx) { stop = true; } + void handler(int signal, siginfo_t *sinfo, void *ctx) override { + stop = true; + } - void usage() { + void usage() override { std::cout << "Usage: villas-hook [OPTIONS] NAME" << std::endl << " NAME the name of the hook function" << std::endl << " PARAM* a string of configuration settings for the hook" @@ -111,7 +113,7 @@ class Hook : public Tool { printCopyright(); } - void parse() { + void parse() override { int ret; std::string file; @@ -188,7 +190,7 @@ class Hook : public Tool { hook = argv[optind]; } - int main() { + int main() override { int ret, recv, sent; struct Sample *smps[cnt]; diff --git a/src/villas-node.cpp b/src/villas-node.cpp index 8f8a03726..858ef5aaa 100644 --- a/src/villas-node.cpp +++ b/src/villas-node.cpp @@ -51,7 +51,7 @@ class Node : public Tool { std::string uri; bool showCapabilities = false; - void handler(int signal, siginfo_t *sinfo, void *ctx) { + void handler(int signal, siginfo_t *sinfo, void *ctx) override { switch (signal) { case SIGALRM: logger->info("Reached timeout. Terminating..."); @@ -64,7 +64,7 @@ class Node : public Tool { sn.setState(State::STOPPING); } - void usage() { + void usage() override { std::cout << "Usage: villas-node [OPTIONS] [CONFIG]" << std::endl << " OPTIONS is one or more of the following options:" << std::endl @@ -119,7 +119,7 @@ class Node : public Tool { printCopyright(); } - void parse() { + void parse() override { // Parse optional command line arguments int c; while ((c = getopt(argc, argv, "hCVd:")) != -1) { @@ -153,7 +153,7 @@ class Node : public Tool { } } - int main() { return showCapabilities ? capabilities() : daemon(); } + int main() override { return showCapabilities ? capabilities() : daemon(); } int capabilities() { auto *json_caps = getCapabilities(); diff --git a/src/villas-pipe.cpp b/src/villas-pipe.cpp index 8febf76a8..c7b3193f0 100644 --- a/src/villas-pipe.cpp +++ b/src/villas-pipe.cpp @@ -69,11 +69,7 @@ class PipeDirection { throw RuntimeError("Failed to allocate memory for pool."); } - ~PipeDirection() { - int ret __attribute__((unused)); - - ret = pool_destroy(&pool); - } + virtual ~PipeDirection() { std::ignore = pool_destroy(&pool); } virtual void run() = 0; @@ -103,7 +99,7 @@ class PipeSendDirection : public PipeDirection { PipeSendDirection(Node *n, Format *i, bool en = true, int lim = -1) : PipeDirection(n, i, en, lim, "send") {} - virtual void run() { + void run() override { logger->debug("Send thread started"); unsigned last_sequenceno = 0; @@ -169,7 +165,7 @@ class PipeReceiveDirection : public PipeDirection { PipeReceiveDirection(Node *n, Format *i, bool en = true, int lim = -1) : PipeDirection(n, i, en, lim, "recv") {} - virtual void run() { + void run() override { logger->debug("Receive thread started"); int recv, allocated = 0; @@ -265,7 +261,7 @@ class Pipe : public Tool { std::unique_ptr dir; } send; - void handler(int signal, siginfo_t *sinfo, void *ctx) { + void handler(int signal, siginfo_t *sinfo, void *ctx) override { logger->debug("Received {} signal.", strsignal(signal)); switch (signal) { @@ -295,7 +291,7 @@ class Pipe : public Tool { } } - void usage() { + void usage() override { std::cout << "Usage: villas-pipe [OPTIONS] CONFIG NODE" << std::endl << " CONFIG path to a configuration file" << std::endl @@ -324,7 +320,7 @@ class Pipe : public Tool { printCopyright(); } - void parse() { + void parse() override { int c, ret; char *endptr; while ((c = getopt(argc, argv, "Vhxrsd:l:L:T:f:t:o:")) != -1) { @@ -398,7 +394,7 @@ class Pipe : public Tool { nodestr = argv[optind + 1]; } - int main() { + int main() override { int ret; Node *node; json_t *json_format; diff --git a/src/villas-signal.cpp b/src/villas-signal.cpp index 9a5de77a0..f5161cf73 100644 --- a/src/villas-signal.cpp +++ b/src/villas-signal.cpp @@ -53,7 +53,7 @@ class Signal : public Tool { std::string format; - void usage() { + void usage() override { std::cout << "Usage: villas-signal [OPTIONS] SIGNAL" << std::endl << " SIGNAL is on of the following signal types:" << std::endl @@ -203,7 +203,7 @@ class Signal : public Tool { "in", "signals", json_signals); } - void handler(int signal, siginfo_t *sinfo, void *ctx) { + void handler(int signal, siginfo_t *sinfo, void *ctx) override { switch (signal) { case SIGALRM: logger->info("Reached timeout. Terminating..."); @@ -216,7 +216,7 @@ class Signal : public Tool { stop = true; } - int main() { + int main() override { int ret; json_t *json, *json_format; json_error_t err; diff --git a/src/villas-test-config.cpp b/src/villas-test-config.cpp index b482d67ce..5b0dc8557 100644 --- a/src/villas-test-config.cpp +++ b/src/villas-test-config.cpp @@ -42,7 +42,7 @@ class TestConfig : public Tool { bool check; bool dump; - void usage() { + void usage() override { std::cout << "Usage: villas-test-config [OPTIONS] CONFIG" << std::endl << " CONFIG is the path to an optional configuration file" << std::endl @@ -59,7 +59,7 @@ class TestConfig : public Tool { printCopyright(); } - void parse() { + void parse() override { int c; while ((c = getopt(argc, argv, "hcVD")) != -1) { switch (c) { @@ -90,7 +90,7 @@ class TestConfig : public Tool { uri = argv[optind]; } - int main() { + int main() override { SuperNode sn; sn.parse(uri); diff --git a/src/villas-zmq-keygen.cpp b/src/villas-zmq-keygen.cpp index 507840588..1aa7e281d 100644 --- a/src/villas-zmq-keygen.cpp +++ b/src/villas-zmq-keygen.cpp @@ -26,7 +26,7 @@ class ZmqKeygen : public Tool { ZmqKeygen(int argc, char *argv[]) : Tool(argc, argv, "zmq-keygen") {} protected: - int main() { + int main() override { int ret; char public_key[41]; char secret_key[41];