mirror of
https://github.com/RGBCube/serenity
synced 2025-07-02 23:42:13 +00:00
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.
This commit is contained in:
parent
2dea887e8f
commit
860a3bbce3
28 changed files with 33 additions and 38 deletions
|
@ -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)
|
RefPtr<FileDescription> CoreDump::create_target_file(const Process& process, const String& output_path)
|
||||||
{
|
{
|
||||||
LexicalPath lexical_path(output_path);
|
LexicalPath lexical_path(output_path);
|
||||||
|
|
|
@ -41,7 +41,7 @@ class CoreDump {
|
||||||
public:
|
public:
|
||||||
static OwnPtr<CoreDump> create(NonnullRefPtr<Process>, const String& output_path);
|
static OwnPtr<CoreDump> create(NonnullRefPtr<Process>, const String& output_path);
|
||||||
|
|
||||||
~CoreDump();
|
~CoreDump() = default;
|
||||||
[[nodiscard]] KResult write();
|
[[nodiscard]] KResult write();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace Kernel {
|
||||||
|
|
||||||
class I8042Device {
|
class I8042Device {
|
||||||
public:
|
public:
|
||||||
virtual ~I8042Device() { }
|
virtual ~I8042Device() = default;
|
||||||
|
|
||||||
virtual void irq_handle_byte_read(u8 byte) = 0;
|
virtual void irq_handle_byte_read(u8 byte) = 0;
|
||||||
virtual void enable_interrupts() = 0;
|
virtual void enable_interrupts() = 0;
|
||||||
|
|
|
@ -51,7 +51,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
~DiskCache() { }
|
~DiskCache() = default;
|
||||||
|
|
||||||
bool is_dirty() const { return m_dirty; }
|
bool is_dirty() const { return m_dirty; }
|
||||||
void set_dirty(bool b) { m_dirty = b; }
|
void set_dirty(bool b) { m_dirty = b; }
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace Kernel {
|
||||||
|
|
||||||
class FileDescriptionData {
|
class FileDescriptionData {
|
||||||
public:
|
public:
|
||||||
virtual ~FileDescriptionData() { }
|
virtual ~FileDescriptionData() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FileDescription : public RefCounted<FileDescription> {
|
class FileDescription : public RefCounted<FileDescription> {
|
||||||
|
|
|
@ -40,7 +40,7 @@ TYPEDEF_DISTINCT_ORDERED_ID(unsigned, InodeIndex);
|
||||||
|
|
||||||
class InodeIdentifier {
|
class InodeIdentifier {
|
||||||
public:
|
public:
|
||||||
InodeIdentifier() { }
|
InodeIdentifier() = default;
|
||||||
InodeIdentifier(u32 fsid, InodeIndex inode)
|
InodeIdentifier(u32 fsid, InodeIndex inode)
|
||||||
: m_fsid(fsid)
|
: m_fsid(fsid)
|
||||||
, m_index(inode)
|
, m_index(inode)
|
||||||
|
|
|
@ -58,7 +58,7 @@ private:
|
||||||
ProcFS();
|
ProcFS();
|
||||||
|
|
||||||
struct ProcFSDirectoryEntry {
|
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)
|
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)
|
: name(a_name)
|
||||||
, proc_file_type(a_proc_file_type)
|
, proc_file_type(a_proc_file_type)
|
||||||
|
|
|
@ -58,9 +58,7 @@ public:
|
||||||
// at the end of the memory block.
|
// at the end of the memory block.
|
||||||
VERIFY(m_total_chunks * CHUNK_SIZE + (m_total_chunks + 7) / 8 <= memory_size);
|
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)
|
static size_t calculate_memory_for_bytes(size_t bytes)
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace Kernel {
|
||||||
template<size_t templated_slab_size>
|
template<size_t templated_slab_size>
|
||||||
class SlabAllocator {
|
class SlabAllocator {
|
||||||
public:
|
public:
|
||||||
SlabAllocator() { }
|
SlabAllocator() = default;
|
||||||
|
|
||||||
void init(size_t size)
|
void init(size_t size)
|
||||||
{
|
{
|
||||||
|
|
|
@ -101,7 +101,7 @@ inline void delay(size_t microseconds)
|
||||||
|
|
||||||
class IOAddress {
|
class IOAddress {
|
||||||
public:
|
public:
|
||||||
IOAddress() { }
|
IOAddress() = default;
|
||||||
explicit IOAddress(u16 address)
|
explicit IOAddress(u16 address)
|
||||||
: m_address(address)
|
: m_address(address)
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,7 +39,7 @@ enum class IRQControllerType {
|
||||||
|
|
||||||
class IRQController : public RefCounted<IRQController> {
|
class IRQController : public RefCounted<IRQController> {
|
||||||
public:
|
public:
|
||||||
virtual ~IRQController() { }
|
virtual ~IRQController() = default;
|
||||||
|
|
||||||
virtual void enable(const GenericInterruptHandler&) = 0;
|
virtual void enable(const GenericInterruptHandler&) = 0;
|
||||||
virtual void disable(const GenericInterruptHandler&) = 0;
|
virtual void disable(const GenericInterruptHandler&) = 0;
|
||||||
|
@ -57,7 +57,7 @@ public:
|
||||||
virtual IRQControllerType type() const = 0;
|
virtual IRQControllerType type() const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
IRQController() { }
|
IRQController() = default;
|
||||||
virtual void initialize() = 0;
|
virtual void initialize() = 0;
|
||||||
bool m_hard_disabled { false };
|
bool m_hard_disabled { false };
|
||||||
};
|
};
|
||||||
|
|
|
@ -39,7 +39,7 @@ public:
|
||||||
explicit KBufferBuilder(bool can_expand = false);
|
explicit KBufferBuilder(bool can_expand = false);
|
||||||
explicit KBufferBuilder(RefPtr<KBufferImpl>&, bool can_expand = false);
|
explicit KBufferBuilder(RefPtr<KBufferImpl>&, bool can_expand = false);
|
||||||
KBufferBuilder(KBufferBuilder&&) = default;
|
KBufferBuilder(KBufferBuilder&&) = default;
|
||||||
~KBufferBuilder() { }
|
~KBufferBuilder() = default;
|
||||||
|
|
||||||
void append(const StringView&);
|
void append(const StringView&);
|
||||||
void append(char);
|
void append(char);
|
||||||
|
|
|
@ -56,7 +56,7 @@ public:
|
||||||
private:
|
private:
|
||||||
template<typename T>
|
template<typename T>
|
||||||
friend class KResultOr;
|
friend class KResultOr;
|
||||||
KResult() { }
|
KResult() = default;
|
||||||
|
|
||||||
int m_error { 0 };
|
int m_error { 0 };
|
||||||
};
|
};
|
||||||
|
|
|
@ -48,7 +48,7 @@ public:
|
||||||
: m_name(name)
|
: m_name(name)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
~Lock() { }
|
~Lock() = default;
|
||||||
|
|
||||||
void lock(Mode = Mode::Exclusive);
|
void lock(Mode = Mode::Exclusive);
|
||||||
#if LOCK_DEBUG
|
#if LOCK_DEBUG
|
||||||
|
@ -144,7 +144,7 @@ private:
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class Lockable {
|
class Lockable {
|
||||||
public:
|
public:
|
||||||
Lockable() { }
|
Lockable() = default;
|
||||||
Lockable(T&& resource)
|
Lockable(T&& resource)
|
||||||
: m_resource(move(resource))
|
: m_resource(move(resource))
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,8 +33,8 @@
|
||||||
|
|
||||||
class [[gnu::packed]] EthernetFrameHeader {
|
class [[gnu::packed]] EthernetFrameHeader {
|
||||||
public:
|
public:
|
||||||
EthernetFrameHeader() { }
|
EthernetFrameHeader() = default;
|
||||||
~EthernetFrameHeader() { }
|
~EthernetFrameHeader() = default;
|
||||||
|
|
||||||
MACAddress destination() const { return m_destination; }
|
MACAddress destination() const { return m_destination; }
|
||||||
void set_destination(const MACAddress& address) { m_destination = address; }
|
void set_destination(const MACAddress& address) { m_destination = address; }
|
||||||
|
|
|
@ -38,8 +38,8 @@ struct ICMPType {
|
||||||
|
|
||||||
class [[gnu::packed]] ICMPHeader {
|
class [[gnu::packed]] ICMPHeader {
|
||||||
public:
|
public:
|
||||||
ICMPHeader() { }
|
ICMPHeader() = default;
|
||||||
~ICMPHeader() { }
|
~ICMPHeader() = default;
|
||||||
|
|
||||||
u8 type() const { return m_type; }
|
u8 type() const { return m_type; }
|
||||||
void set_type(u8 b) { m_type = b; }
|
void set_type(u8 b) { m_type = b; }
|
||||||
|
|
|
@ -180,7 +180,7 @@ private:
|
||||||
template<typename SocketType>
|
template<typename SocketType>
|
||||||
class SocketHandle {
|
class SocketHandle {
|
||||||
public:
|
public:
|
||||||
SocketHandle() { }
|
SocketHandle() = default;
|
||||||
|
|
||||||
SocketHandle(NonnullRefPtr<SocketType>&& socket)
|
SocketHandle(NonnullRefPtr<SocketType>&& socket)
|
||||||
: m_socket(move(socket))
|
: m_socket(move(socket))
|
||||||
|
|
|
@ -32,8 +32,8 @@ namespace Kernel {
|
||||||
|
|
||||||
class [[gnu::packed]] UDPPacket {
|
class [[gnu::packed]] UDPPacket {
|
||||||
public:
|
public:
|
||||||
UDPPacket() { }
|
UDPPacket() = default;
|
||||||
~UDPPacket() { }
|
~UDPPacket() = default;
|
||||||
|
|
||||||
u16 source_port() const { return m_source_port; }
|
u16 source_port() const { return m_source_port; }
|
||||||
void set_source_port(u16 port) { m_source_port = port; }
|
void set_source_port(u16 port) { m_source_port = port; }
|
||||||
|
|
|
@ -92,7 +92,7 @@ inline const LogStream& operator<<(const LogStream& stream, const ID value)
|
||||||
}
|
}
|
||||||
struct Address {
|
struct Address {
|
||||||
public:
|
public:
|
||||||
Address() { }
|
Address() = default;
|
||||||
Address(u16 seg)
|
Address(u16 seg)
|
||||||
: m_seg(seg)
|
: m_seg(seg)
|
||||||
, m_bus(0)
|
, m_bus(0)
|
||||||
|
|
|
@ -34,7 +34,7 @@ class PCI::DeviceController {
|
||||||
public:
|
public:
|
||||||
Address pci_address() const { return m_pci_address; };
|
Address pci_address() const { return m_pci_address; };
|
||||||
|
|
||||||
virtual ~DeviceController() { }
|
virtual ~DeviceController() = default;
|
||||||
void enable_pin_based_interrupts() const;
|
void enable_pin_based_interrupts() const;
|
||||||
void disable_pin_based_interrupts() const;
|
void disable_pin_based_interrupts() const;
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
class PhysicalAddress {
|
class PhysicalAddress {
|
||||||
public:
|
public:
|
||||||
PhysicalAddress() { }
|
PhysicalAddress() = default;
|
||||||
explicit PhysicalAddress(FlatPtr address)
|
explicit PhysicalAddress(FlatPtr address)
|
||||||
: m_address(address)
|
: m_address(address)
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,7 +37,8 @@ namespace Kernel {
|
||||||
struct GUIDPartitionHeader;
|
struct GUIDPartitionHeader;
|
||||||
class GUIDPartitionTable final : public MBRPartitionTable {
|
class GUIDPartitionTable final : public MBRPartitionTable {
|
||||||
public:
|
public:
|
||||||
virtual ~GUIDPartitionTable() {};
|
virtual ~GUIDPartitionTable() = default;
|
||||||
|
;
|
||||||
|
|
||||||
static Result<NonnullOwnPtr<GUIDPartitionTable>, PartitionTable::Error> try_to_initialize(const StorageDevice&);
|
static Result<NonnullOwnPtr<GUIDPartitionTable>, PartitionTable::Error> try_to_initialize(const StorageDevice&);
|
||||||
explicit GUIDPartitionTable(const StorageDevice&);
|
explicit GUIDPartitionTable(const StorageDevice&);
|
||||||
|
|
|
@ -52,7 +52,7 @@ public:
|
||||||
Optional<DiskPartitionMetadata> partition(unsigned index);
|
Optional<DiskPartitionMetadata> partition(unsigned index);
|
||||||
size_t partitions_count() const { return m_partitions.size(); }
|
size_t partitions_count() const { return m_partitions.size(); }
|
||||||
virtual Type type() const = 0;
|
virtual Type type() const = 0;
|
||||||
virtual ~PartitionTable() { }
|
virtual ~PartitionTable() = default;
|
||||||
virtual bool is_valid() const = 0;
|
virtual bool is_valid() const = 0;
|
||||||
|
|
||||||
Vector<DiskPartitionMetadata> partitions() const { return m_partitions; }
|
Vector<DiskPartitionMetadata> partitions() const { return m_partitions; }
|
||||||
|
|
|
@ -47,7 +47,7 @@ class HardwareTimer;
|
||||||
class HardwareTimerBase
|
class HardwareTimerBase
|
||||||
: public RefCounted<HardwareTimerBase> {
|
: public RefCounted<HardwareTimerBase> {
|
||||||
public:
|
public:
|
||||||
virtual ~HardwareTimerBase() { }
|
virtual ~HardwareTimerBase() = default;
|
||||||
|
|
||||||
// We need to create a virtual will_be_destroyed here because we derive
|
// We need to create a virtual will_be_destroyed here because we derive
|
||||||
// from RefCounted<HardwareTimerBase> here, which means that RefCounted<>
|
// from RefCounted<HardwareTimerBase> here, which means that RefCounted<>
|
||||||
|
|
|
@ -68,7 +68,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PhysicalPage(PhysicalAddress paddr, bool supervisor, bool may_return_to_freelist = true);
|
PhysicalPage(PhysicalAddress paddr, bool supervisor, bool may_return_to_freelist = true);
|
||||||
~PhysicalPage() { }
|
~PhysicalPage() = default;
|
||||||
|
|
||||||
void return_to_freelist() const;
|
void return_to_freelist() const;
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ class PhysicalRegion : public RefCounted<PhysicalRegion> {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static NonnullRefPtr<PhysicalRegion> create(PhysicalAddress lower, PhysicalAddress upper);
|
static NonnullRefPtr<PhysicalRegion> create(PhysicalAddress lower, PhysicalAddress upper);
|
||||||
~PhysicalRegion() { }
|
~PhysicalRegion() = default;
|
||||||
|
|
||||||
void expand(PhysicalAddress lower, PhysicalAddress upper);
|
void expand(PhysicalAddress lower, PhysicalAddress upper);
|
||||||
unsigned finalize_capacity();
|
unsigned finalize_capacity();
|
||||||
|
|
|
@ -41,7 +41,7 @@ class PhysicalPage;
|
||||||
|
|
||||||
class VMObjectDeletedHandler {
|
class VMObjectDeletedHandler {
|
||||||
public:
|
public:
|
||||||
virtual ~VMObjectDeletedHandler() { }
|
virtual ~VMObjectDeletedHandler() = default;
|
||||||
virtual void vmobject_deleted(VMObject&) = 0;
|
virtual void vmobject_deleted(VMObject&) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
class VirtualAddress {
|
class VirtualAddress {
|
||||||
public:
|
public:
|
||||||
VirtualAddress() { }
|
VirtualAddress() = default;
|
||||||
explicit VirtualAddress(FlatPtr address)
|
explicit VirtualAddress(FlatPtr address)
|
||||||
: m_address(address)
|
: m_address(address)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue