summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Wiederhake <BenWiederhake.GitHub@gmx.de>2021-02-28 14:42:08 +0100
committerAndreas Kling <kling@serenityos.org>2021-02-28 18:09:12 +0100
commit860a3bbce342067069d4c7d2e4396a667ff324fe (patch)
tree8110f5d9a7293a4371205ffffd7c8717b8a29471
parent2dea887e8fe43438cd5005820515fc21a1e4521c (diff)
downloadserenity-860a3bbce342067069d4c7d2e4396a667ff324fe.zip
Kernel: Use default con/de-structors
This may seem like a no-op change, however it shrinks down the Kernel by a bit: .text -432 .unmap_after_init -60 .data -480 .debug_info -673 .debug_aranges 8 .debug_ranges -232 .debug_line -558 .debug_str -308 .debug_frame -40 With '= default', the compiler can do more inlining, hence the savings. I intentionally omitted some opportunities for '= default', because they would increase the Kernel size.
-rw-r--r--Kernel/CoreDump.cpp4
-rw-r--r--Kernel/CoreDump.h2
-rw-r--r--Kernel/Devices/I8042Controller.h2
-rw-r--r--Kernel/FileSystem/BlockBasedFileSystem.cpp2
-rw-r--r--Kernel/FileSystem/FileDescription.h2
-rw-r--r--Kernel/FileSystem/InodeIdentifier.h2
-rw-r--r--Kernel/FileSystem/ProcFS.h2
-rw-r--r--Kernel/Heap/Heap.h4
-rw-r--r--Kernel/Heap/SlabAllocator.cpp2
-rw-r--r--Kernel/IO.h2
-rw-r--r--Kernel/Interrupts/IRQController.h4
-rw-r--r--Kernel/KBufferBuilder.h2
-rw-r--r--Kernel/KResult.h2
-rw-r--r--Kernel/Lock.h4
-rw-r--r--Kernel/Net/EthernetFrameHeader.h4
-rw-r--r--Kernel/Net/ICMP.h4
-rw-r--r--Kernel/Net/Socket.h2
-rw-r--r--Kernel/Net/UDP.h4
-rw-r--r--Kernel/PCI/Definitions.h2
-rw-r--r--Kernel/PCI/DeviceController.h2
-rw-r--r--Kernel/PhysicalAddress.h2
-rw-r--r--Kernel/Storage/Partition/GUIDPartitionTable.h3
-rw-r--r--Kernel/Storage/Partition/PartitionTable.h2
-rw-r--r--Kernel/Time/HardwareTimer.h2
-rw-r--r--Kernel/VM/PhysicalPage.h2
-rw-r--r--Kernel/VM/PhysicalRegion.h2
-rw-r--r--Kernel/VM/VMObject.h2
-rw-r--r--Kernel/VirtualAddress.h2
28 files changed, 33 insertions, 38 deletions
diff --git a/Kernel/CoreDump.cpp b/Kernel/CoreDump.cpp
index 56312a1bc0..706f2997ab 100644
--- a/Kernel/CoreDump.cpp
+++ b/Kernel/CoreDump.cpp
@@ -62,10 +62,6 @@ CoreDump::CoreDump(NonnullRefPtr<Process> process, NonnullRefPtr<FileDescription
{
}
-CoreDump::~CoreDump()
-{
-}
-
RefPtr<FileDescription> CoreDump::create_target_file(const Process& process, const String& output_path)
{
LexicalPath lexical_path(output_path);
diff --git a/Kernel/CoreDump.h b/Kernel/CoreDump.h
index b353277821..aeccc93dc6 100644
--- a/Kernel/CoreDump.h
+++ b/Kernel/CoreDump.h
@@ -41,7 +41,7 @@ class CoreDump {
public:
static OwnPtr<CoreDump> create(NonnullRefPtr<Process>, const String& output_path);
- ~CoreDump();
+ ~CoreDump() = default;
[[nodiscard]] KResult write();
private:
diff --git a/Kernel/Devices/I8042Controller.h b/Kernel/Devices/I8042Controller.h
index d4c728f05f..944be124c0 100644
--- a/Kernel/Devices/I8042Controller.h
+++ b/Kernel/Devices/I8042Controller.h
@@ -43,7 +43,7 @@ namespace Kernel {
class I8042Device {
public:
- virtual ~I8042Device() { }
+ virtual ~I8042Device() = default;
virtual void irq_handle_byte_read(u8 byte) = 0;
virtual void enable_interrupts() = 0;
diff --git a/Kernel/FileSystem/BlockBasedFileSystem.cpp b/Kernel/FileSystem/BlockBasedFileSystem.cpp
index 334cd40abd..2fd6db61cc 100644
--- a/Kernel/FileSystem/BlockBasedFileSystem.cpp
+++ b/Kernel/FileSystem/BlockBasedFileSystem.cpp
@@ -51,7 +51,7 @@ public:
}
}
- ~DiskCache() { }
+ ~DiskCache() = default;
bool is_dirty() const { return m_dirty; }
void set_dirty(bool b) { m_dirty = b; }
diff --git a/Kernel/FileSystem/FileDescription.h b/Kernel/FileSystem/FileDescription.h
index 6dc0e9a4b6..2b340b11d3 100644
--- a/Kernel/FileSystem/FileDescription.h
+++ b/Kernel/FileSystem/FileDescription.h
@@ -40,7 +40,7 @@ namespace Kernel {
class FileDescriptionData {
public:
- virtual ~FileDescriptionData() { }
+ virtual ~FileDescriptionData() = default;
};
class FileDescription : public RefCounted<FileDescription> {
diff --git a/Kernel/FileSystem/InodeIdentifier.h b/Kernel/FileSystem/InodeIdentifier.h
index b28216e64b..b869be5469 100644
--- a/Kernel/FileSystem/InodeIdentifier.h
+++ b/Kernel/FileSystem/InodeIdentifier.h
@@ -40,7 +40,7 @@ TYPEDEF_DISTINCT_ORDERED_ID(unsigned, InodeIndex);
class InodeIdentifier {
public:
- InodeIdentifier() { }
+ InodeIdentifier() = default;
InodeIdentifier(u32 fsid, InodeIndex inode)
: m_fsid(fsid)
, m_index(inode)
diff --git a/Kernel/FileSystem/ProcFS.h b/Kernel/FileSystem/ProcFS.h
index cff537b692..1909f6e378 100644
--- a/Kernel/FileSystem/ProcFS.h
+++ b/Kernel/FileSystem/ProcFS.h
@@ -58,7 +58,7 @@ private:
ProcFS();
struct ProcFSDirectoryEntry {
- ProcFSDirectoryEntry() { }
+ ProcFSDirectoryEntry() = default;
ProcFSDirectoryEntry(const char* a_name, unsigned a_proc_file_type, bool a_supervisor_only, bool (*read_callback)(InodeIdentifier, KBufferBuilder&) = nullptr, ssize_t (*write_callback)(InodeIdentifier, const UserOrKernelBuffer&, size_t) = nullptr, RefPtr<ProcFSInode>&& a_inode = nullptr)
: name(a_name)
, proc_file_type(a_proc_file_type)
diff --git a/Kernel/Heap/Heap.h b/Kernel/Heap/Heap.h
index dc53364113..2bf8bf9980 100644
--- a/Kernel/Heap/Heap.h
+++ b/Kernel/Heap/Heap.h
@@ -58,9 +58,7 @@ public:
// at the end of the memory block.
VERIFY(m_total_chunks * CHUNK_SIZE + (m_total_chunks + 7) / 8 <= memory_size);
}
- ~Heap()
- {
- }
+ ~Heap() = default;
static size_t calculate_memory_for_bytes(size_t bytes)
{
diff --git a/Kernel/Heap/SlabAllocator.cpp b/Kernel/Heap/SlabAllocator.cpp
index 7b12b3fa71..ccba520bed 100644
--- a/Kernel/Heap/SlabAllocator.cpp
+++ b/Kernel/Heap/SlabAllocator.cpp
@@ -38,7 +38,7 @@ namespace Kernel {
template<size_t templated_slab_size>
class SlabAllocator {
public:
- SlabAllocator() { }
+ SlabAllocator() = default;
void init(size_t size)
{
diff --git a/Kernel/IO.h b/Kernel/IO.h
index e2110b513f..4427cc75db 100644
--- a/Kernel/IO.h
+++ b/Kernel/IO.h
@@ -101,7 +101,7 @@ inline void delay(size_t microseconds)
class IOAddress {
public:
- IOAddress() { }
+ IOAddress() = default;
explicit IOAddress(u16 address)
: m_address(address)
{
diff --git a/Kernel/Interrupts/IRQController.h b/Kernel/Interrupts/IRQController.h
index 35e0fd5276..fe4f5bbf35 100644
--- a/Kernel/Interrupts/IRQController.h
+++ b/Kernel/Interrupts/IRQController.h
@@ -39,7 +39,7 @@ enum class IRQControllerType {
class IRQController : public RefCounted<IRQController> {
public:
- virtual ~IRQController() { }
+ virtual ~IRQController() = default;
virtual void enable(const GenericInterruptHandler&) = 0;
virtual void disable(const GenericInterruptHandler&) = 0;
@@ -57,7 +57,7 @@ public:
virtual IRQControllerType type() const = 0;
protected:
- IRQController() { }
+ IRQController() = default;
virtual void initialize() = 0;
bool m_hard_disabled { false };
};
diff --git a/Kernel/KBufferBuilder.h b/Kernel/KBufferBuilder.h
index b51f350b9a..fb56ddd715 100644
--- a/Kernel/KBufferBuilder.h
+++ b/Kernel/KBufferBuilder.h
@@ -39,7 +39,7 @@ public:
explicit KBufferBuilder(bool can_expand = false);
explicit KBufferBuilder(RefPtr<KBufferImpl>&, bool can_expand = false);
KBufferBuilder(KBufferBuilder&&) = default;
- ~KBufferBuilder() { }
+ ~KBufferBuilder() = default;
void append(const StringView&);
void append(char);
diff --git a/Kernel/KResult.h b/Kernel/KResult.h
index 341df32baa..134064d9c4 100644
--- a/Kernel/KResult.h
+++ b/Kernel/KResult.h
@@ -56,7 +56,7 @@ public:
private:
template<typename T>
friend class KResultOr;
- KResult() { }
+ KResult() = default;
int m_error { 0 };
};
diff --git a/Kernel/Lock.h b/Kernel/Lock.h
index d92d082aa2..de193e18e7 100644
--- a/Kernel/Lock.h
+++ b/Kernel/Lock.h
@@ -48,7 +48,7 @@ public:
: m_name(name)
{
}
- ~Lock() { }
+ ~Lock() = default;
void lock(Mode = Mode::Exclusive);
#if LOCK_DEBUG
@@ -144,7 +144,7 @@ private:
template<typename T>
class Lockable {
public:
- Lockable() { }
+ Lockable() = default;
Lockable(T&& resource)
: m_resource(move(resource))
{
diff --git a/Kernel/Net/EthernetFrameHeader.h b/Kernel/Net/EthernetFrameHeader.h
index 2fb8611f6f..6ce72978c0 100644
--- a/Kernel/Net/EthernetFrameHeader.h
+++ b/Kernel/Net/EthernetFrameHeader.h
@@ -33,8 +33,8 @@
class [[gnu::packed]] EthernetFrameHeader {
public:
- EthernetFrameHeader() { }
- ~EthernetFrameHeader() { }
+ EthernetFrameHeader() = default;
+ ~EthernetFrameHeader() = default;
MACAddress destination() const { return m_destination; }
void set_destination(const MACAddress& address) { m_destination = address; }
diff --git a/Kernel/Net/ICMP.h b/Kernel/Net/ICMP.h
index bd598bd23d..a1de0c43c2 100644
--- a/Kernel/Net/ICMP.h
+++ b/Kernel/Net/ICMP.h
@@ -38,8 +38,8 @@ struct ICMPType {
class [[gnu::packed]] ICMPHeader {
public:
- ICMPHeader() { }
- ~ICMPHeader() { }
+ ICMPHeader() = default;
+ ~ICMPHeader() = default;
u8 type() const { return m_type; }
void set_type(u8 b) { m_type = b; }
diff --git a/Kernel/Net/Socket.h b/Kernel/Net/Socket.h
index a4dfaa6d78..e0a53a6f99 100644
--- a/Kernel/Net/Socket.h
+++ b/Kernel/Net/Socket.h
@@ -180,7 +180,7 @@ private:
template<typename SocketType>
class SocketHandle {
public:
- SocketHandle() { }
+ SocketHandle() = default;
SocketHandle(NonnullRefPtr<SocketType>&& socket)
: m_socket(move(socket))
diff --git a/Kernel/Net/UDP.h b/Kernel/Net/UDP.h
index abf1a6d40f..effe9a603b 100644
--- a/Kernel/Net/UDP.h
+++ b/Kernel/Net/UDP.h
@@ -32,8 +32,8 @@ namespace Kernel {
class [[gnu::packed]] UDPPacket {
public:
- UDPPacket() { }
- ~UDPPacket() { }
+ UDPPacket() = default;
+ ~UDPPacket() = default;
u16 source_port() const { return m_source_port; }
void set_source_port(u16 port) { m_source_port = port; }
diff --git a/Kernel/PCI/Definitions.h b/Kernel/PCI/Definitions.h
index 859eeb565a..c57c71f78a 100644
--- a/Kernel/PCI/Definitions.h
+++ b/Kernel/PCI/Definitions.h
@@ -92,7 +92,7 @@ inline const LogStream& operator<<(const LogStream& stream, const ID value)
}
struct Address {
public:
- Address() { }
+ Address() = default;
Address(u16 seg)
: m_seg(seg)
, m_bus(0)
diff --git a/Kernel/PCI/DeviceController.h b/Kernel/PCI/DeviceController.h
index 39935bc9a9..68302da2ee 100644
--- a/Kernel/PCI/DeviceController.h
+++ b/Kernel/PCI/DeviceController.h
@@ -34,7 +34,7 @@ class PCI::DeviceController {
public:
Address pci_address() const { return m_pci_address; };
- virtual ~DeviceController() { }
+ virtual ~DeviceController() = default;
void enable_pin_based_interrupts() const;
void disable_pin_based_interrupts() const;
diff --git a/Kernel/PhysicalAddress.h b/Kernel/PhysicalAddress.h
index 3c1bf0d9ef..f68cbffc53 100644
--- a/Kernel/PhysicalAddress.h
+++ b/Kernel/PhysicalAddress.h
@@ -31,7 +31,7 @@
class PhysicalAddress {
public:
- PhysicalAddress() { }
+ PhysicalAddress() = default;
explicit PhysicalAddress(FlatPtr address)
: m_address(address)
{
diff --git a/Kernel/Storage/Partition/GUIDPartitionTable.h b/Kernel/Storage/Partition/GUIDPartitionTable.h
index 3988324e04..5fbfe3d976 100644
--- a/Kernel/Storage/Partition/GUIDPartitionTable.h
+++ b/Kernel/Storage/Partition/GUIDPartitionTable.h
@@ -37,7 +37,8 @@ namespace Kernel {
struct GUIDPartitionHeader;
class GUIDPartitionTable final : public MBRPartitionTable {
public:
- virtual ~GUIDPartitionTable() {};
+ virtual ~GUIDPartitionTable() = default;
+ ;
static Result<NonnullOwnPtr<GUIDPartitionTable>, PartitionTable::Error> try_to_initialize(const StorageDevice&);
explicit GUIDPartitionTable(const StorageDevice&);
diff --git a/Kernel/Storage/Partition/PartitionTable.h b/Kernel/Storage/Partition/PartitionTable.h
index 324284492e..8c7ece095b 100644
--- a/Kernel/Storage/Partition/PartitionTable.h
+++ b/Kernel/Storage/Partition/PartitionTable.h
@@ -52,7 +52,7 @@ public:
Optional<DiskPartitionMetadata> partition(unsigned index);
size_t partitions_count() const { return m_partitions.size(); }
virtual Type type() const = 0;
- virtual ~PartitionTable() { }
+ virtual ~PartitionTable() = default;
virtual bool is_valid() const = 0;
Vector<DiskPartitionMetadata> partitions() const { return m_partitions; }
diff --git a/Kernel/Time/HardwareTimer.h b/Kernel/Time/HardwareTimer.h
index 5790cf97ab..71f5f13799 100644
--- a/Kernel/Time/HardwareTimer.h
+++ b/Kernel/Time/HardwareTimer.h
@@ -47,7 +47,7 @@ class HardwareTimer;
class HardwareTimerBase
: public RefCounted<HardwareTimerBase> {
public:
- virtual ~HardwareTimerBase() { }
+ virtual ~HardwareTimerBase() = default;
// We need to create a virtual will_be_destroyed here because we derive
// from RefCounted<HardwareTimerBase> here, which means that RefCounted<>
diff --git a/Kernel/VM/PhysicalPage.h b/Kernel/VM/PhysicalPage.h
index c0cf46ac62..19d2306057 100644
--- a/Kernel/VM/PhysicalPage.h
+++ b/Kernel/VM/PhysicalPage.h
@@ -68,7 +68,7 @@ public:
private:
PhysicalPage(PhysicalAddress paddr, bool supervisor, bool may_return_to_freelist = true);
- ~PhysicalPage() { }
+ ~PhysicalPage() = default;
void return_to_freelist() const;
diff --git a/Kernel/VM/PhysicalRegion.h b/Kernel/VM/PhysicalRegion.h
index 436ee6cce3..ebf968518c 100644
--- a/Kernel/VM/PhysicalRegion.h
+++ b/Kernel/VM/PhysicalRegion.h
@@ -39,7 +39,7 @@ class PhysicalRegion : public RefCounted<PhysicalRegion> {
public:
static NonnullRefPtr<PhysicalRegion> create(PhysicalAddress lower, PhysicalAddress upper);
- ~PhysicalRegion() { }
+ ~PhysicalRegion() = default;
void expand(PhysicalAddress lower, PhysicalAddress upper);
unsigned finalize_capacity();
diff --git a/Kernel/VM/VMObject.h b/Kernel/VM/VMObject.h
index a362663dfb..2c5fa709cb 100644
--- a/Kernel/VM/VMObject.h
+++ b/Kernel/VM/VMObject.h
@@ -41,7 +41,7 @@ class PhysicalPage;
class VMObjectDeletedHandler {
public:
- virtual ~VMObjectDeletedHandler() { }
+ virtual ~VMObjectDeletedHandler() = default;
virtual void vmobject_deleted(VMObject&) = 0;
};
diff --git a/Kernel/VirtualAddress.h b/Kernel/VirtualAddress.h
index e05738bec5..4917e8c7d8 100644
--- a/Kernel/VirtualAddress.h
+++ b/Kernel/VirtualAddress.h
@@ -31,7 +31,7 @@
class VirtualAddress {
public:
- VirtualAddress() { }
+ VirtualAddress() = default;
explicit VirtualAddress(FlatPtr address)
: m_address(address)
{