mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 08:27:46 +00:00
Everything: Add -Wnon-virtual-dtor
flag
This flag warns on classes which have `virtual` functions but do not have a `virtual` destructor. This patch adds both the flag and missing destructors. The access level of the destructors was determined by a two rules of thumb: 1. A destructor should have a similar or lower access level to that of a constructor. 2. Having a `private` destructor implicitly deletes the default constructor, which is probably undesirable for "interface" types (classes with only virtual functions and no data). In short, most of the added destructors are `protected`, unless the compiler complained about access.
This commit is contained in:
parent
b75d2d36e1
commit
c4ede38542
21 changed files with 57 additions and 0 deletions
|
@ -35,6 +35,9 @@ class ChecksumFunction {
|
|||
public:
|
||||
virtual void update(ReadonlyBytes data) = 0;
|
||||
virtual ChecksumType digest() = 0;
|
||||
|
||||
protected:
|
||||
virtual ~ChecksumFunction() = default;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -92,6 +92,9 @@ public:
|
|||
ptr[index] = (u8)value;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual ~CipherBlock() = default;
|
||||
|
||||
private:
|
||||
virtual Bytes bytes() = 0;
|
||||
PaddingMode m_padding_mode;
|
||||
|
@ -132,6 +135,9 @@ public:
|
|||
|
||||
virtual String class_name() const = 0;
|
||||
|
||||
protected:
|
||||
virtual ~Cipher() = default;
|
||||
|
||||
private:
|
||||
PaddingMode m_padding_mode;
|
||||
};
|
||||
|
|
|
@ -57,6 +57,9 @@ public:
|
|||
virtual void reset() = 0;
|
||||
|
||||
virtual String class_name() const = 0;
|
||||
|
||||
protected:
|
||||
virtual ~HashFunction() = default;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,8 @@ public:
|
|||
HashFunction& hasher() { return m_hasher; }
|
||||
|
||||
protected:
|
||||
virtual ~Code() = default;
|
||||
|
||||
HashFunction m_hasher;
|
||||
};
|
||||
|
||||
|
|
|
@ -60,6 +60,8 @@ public:
|
|||
virtual size_t output_size() const = 0;
|
||||
|
||||
protected:
|
||||
virtual ~PKSystem() = default;
|
||||
|
||||
PublicKeyType m_public_key;
|
||||
PrivateKeyType m_private_key;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue