1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

Fix cppcheck warnings

Signed-off-by: Steffen Vogel <steffen.vogel@opal-rt.com>
This commit is contained in:
Steffen Vogel 2023-09-08 09:02:39 +00:00 committed by Steffen Vogel
parent b359c2715d
commit b195058d03
5 changed files with 6 additions and 10 deletions

View file

@ -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<LinearAllocator> {
public:
LinearAllocator(MemoryManager::AddressSpaceId memoryAddrSpaceId,
LinearAllocator(const MemoryManager::AddressSpaceId &memoryAddrSpaceId,
size_t memorySize, size_t internalOffset = 0);
LinearAllocator(std::unique_ptr<MemoryBlock, MemoryBlock::deallocator_fn> mem)

View file

@ -184,7 +184,7 @@ public:
// cppcheck-suppress passedByValue
MemoryTranslation
getTranslationFromProcess(AddressSpaceId foreignAddrSpaceId) {
getTranslationFromProcess(const AddressSpaceId &foreignAddrSpaceId) {
return getTranslation(getProcessAddressSpace(), foreignAddrSpaceId);
}

View file

@ -204,9 +204,7 @@ bool isContainer();
bool isPrivileged();
// helper type for std::visit
template <class... Ts> struct overloaded : Ts... {
using Ts::operator()...;
};
template <class... Ts> struct overloaded : Ts... { using Ts::operator()...; };
// explicit deduction guide (not needed as of C++20)
template <class... Ts> overloaded(Ts...) -> overloaded<Ts...>;

View file

@ -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);

View file

@ -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),