mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02: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:
committed by
Andreas Kling
parent
b75d2d36e1
commit
c4ede38542
Notes:
sideshowbarker
2024-07-18 20:17:38 +09:00
Author: https://github.com/Nicholas-Baron Commit: https://github.com/SerenityOS/serenity/commit/c4ede385423 Pull-request: https://github.com/SerenityOS/serenity/pull/6351
@@ -48,6 +48,8 @@ public:
|
||||
HashFunction& hasher() { return m_hasher; }
|
||||
|
||||
protected:
|
||||
virtual ~Code() = default;
|
||||
|
||||
HashFunction m_hasher;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user