From c218badd5a92e9a8d6e3dac07aafa727bf978635 Mon Sep 17 00:00:00 2001 From: Maxim Poliakovski Date: Mon, 10 Jan 2022 17:40:52 +0100 Subject: [PATCH] Clean up some ctors/dtors. --- devices/common/adb/adb.cpp | 2 -- devices/common/adb/adb.h | 2 +- devices/common/hwcomponent.h | 1 + devices/common/i2c/i2c.h | 4 +--- devices/common/mmiodevice.h | 1 + 5 files changed, 4 insertions(+), 6 deletions(-) diff --git a/devices/common/adb/adb.cpp b/devices/common/adb/adb.cpp index 923ad58..858da59 100644 --- a/devices/common/adb/adb.cpp +++ b/devices/common/adb/adb.cpp @@ -55,8 +55,6 @@ ADB_Bus::ADB_Bus() { mouse_access_no = adb_relative; } -ADB_Bus::~ADB_Bus() {} - bool ADB_Bus::listen(int device, int reg) { if (device == keyboard_access_no) { if (adb_keybd_listen(reg)) { diff --git a/devices/common/adb/adb.h b/devices/common/adb/adb.h index 2538daa..36dfbe0 100644 --- a/devices/common/adb/adb.h +++ b/devices/common/adb/adb.h @@ -51,7 +51,7 @@ enum adb_default_values { class ADB_Bus { public: ADB_Bus(); - ~ADB_Bus(); + ~ADB_Bus() = default; bool listen(int device, int reg); bool talk(int device, int reg, uint16_t value); diff --git a/devices/common/hwcomponent.h b/devices/common/hwcomponent.h index c774fa8..fd805ba 100644 --- a/devices/common/hwcomponent.h +++ b/devices/common/hwcomponent.h @@ -45,6 +45,7 @@ enum HWCompType : int { /** Abstract base class for HW components. */ class HWComponent { public: + HWComponent() = default; virtual ~HWComponent() = default; virtual std::string get_name(void) { diff --git a/devices/common/i2c/i2c.h b/devices/common/i2c/i2c.h index 936944b..aa74db1 100644 --- a/devices/common/i2c/i2c.h +++ b/devices/common/i2c/i2c.h @@ -47,9 +47,7 @@ public: I2CBus() { std::memset(this->dev_list, 0, sizeof(this->dev_list)); }; - ~I2CBus() { - std::memset(this->dev_list, 0, sizeof(this->dev_list)); - }; + virtual ~I2CBus() = default; virtual void register_device(uint8_t dev_addr, I2CDevice* dev_obj) { if (this->dev_list[dev_addr]) { diff --git a/devices/common/mmiodevice.h b/devices/common/mmiodevice.h index 0cd3609..3b1d692 100644 --- a/devices/common/mmiodevice.h +++ b/devices/common/mmiodevice.h @@ -30,6 +30,7 @@ along with this program. If not, see . /** Abstract class representing a simple, memory-mapped I/O device */ class MMIODevice : public HWComponent { public: + MMIODevice() = default; virtual uint32_t read(uint32_t reg_start, uint32_t offset, int size) = 0; virtual void write(uint32_t reg_start, uint32_t offset, uint32_t value, int size) = 0; virtual ~MMIODevice() = default;