diff --git a/common/include/villas/memory.hpp b/common/include/villas/memory.hpp index fbd1a4ee1..526ac4ec5 100644 --- a/common/include/villas/memory.hpp +++ b/common/include/villas/memory.hpp @@ -28,7 +28,7 @@ public: // cppcheck-suppress passedByValue MemoryBlock(size_t offset, size_t size, - MemoryManager::AddressSpaceId addrSpaceId) + const MemoryManager::AddressSpaceId &addrSpaceId) : offset(offset), size(size), addrSpaceId(addrSpaceId) {} MemoryManager::AddressSpaceId getAddrSpaceId() const { return addrSpaceId; } @@ -202,7 +202,7 @@ private: // together. class LinearAllocator : public BaseAllocator { public: - LinearAllocator(MemoryManager::AddressSpaceId memoryAddrSpaceId, + LinearAllocator(const MemoryManager::AddressSpaceId &memoryAddrSpaceId, size_t memorySize, size_t internalOffset = 0); LinearAllocator(std::unique_ptr mem) diff --git a/common/include/villas/memory_manager.hpp b/common/include/villas/memory_manager.hpp index 0e514cc44..381548e54 100644 --- a/common/include/villas/memory_manager.hpp +++ b/common/include/villas/memory_manager.hpp @@ -184,7 +184,7 @@ public: // cppcheck-suppress passedByValue MemoryTranslation - getTranslationFromProcess(AddressSpaceId foreignAddrSpaceId) { + getTranslationFromProcess(const AddressSpaceId &foreignAddrSpaceId) { return getTranslation(getProcessAddressSpace(), foreignAddrSpaceId); } diff --git a/common/include/villas/utils.hpp b/common/include/villas/utils.hpp index 6ca28736d..7392c8456 100644 --- a/common/include/villas/utils.hpp +++ b/common/include/villas/utils.hpp @@ -204,9 +204,7 @@ bool isContainer(); bool isPrivileged(); // helper type for std::visit -template struct overloaded : Ts... { - using Ts::operator()...; -}; +template struct overloaded : Ts... { using Ts::operator()...; }; // explicit deduction guide (not needed as of C++20) template overloaded(Ts...) -> overloaded; diff --git a/common/lib/kernel/vfio_device.cpp b/common/lib/kernel/vfio_device.cpp index db08e0b99..8b574b55b 100644 --- a/common/lib/kernel/vfio_device.cpp +++ b/common/lib/kernel/vfio_device.cpp @@ -78,8 +78,7 @@ Device::Device(const std::string &name, int groupFileDescriptor, // device_info.num_region reports always 9 and includes a VGA region, which is only supported on // certain device IDs. So for non-VGA devices VFIO_PCI_CONFIG_REGION_INDEX will be the highest // region index. This is the config space. - info.num_regions = - pci_device != 0 ? VFIO_PCI_CONFIG_REGION_INDEX + 1 : 1; + info.num_regions = pci_device != 0 ? VFIO_PCI_CONFIG_REGION_INDEX + 1 : 1; // Reserve slots already so that we can use the []-operator for access irqs.resize(info.num_irqs); diff --git a/common/lib/memory.cpp b/common/lib/memory.cpp index 7fba6281d..bb5b23656 100644 --- a/common/lib/memory.cpp +++ b/common/lib/memory.cpp @@ -54,9 +54,8 @@ HostRam::HostRamAllocator::allocateBlock(size_t size) { return mem; } -// cppcheck-suppress passedByValue LinearAllocator::LinearAllocator( - MemoryManager::AddressSpaceId memoryAddrSpaceId, size_t memorySize, + const MemoryManager::AddressSpaceId &memoryAddrSpaceId, size_t memorySize, size_t internalOffset) : BaseAllocator(memoryAddrSpaceId), nextFreeAddress(0), memorySize(memorySize), internalOffset(internalOffset),