mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 13:36:13 +03:00
Everywhere: Fix -Winconsistent-missing-override warnings from Clang
This option is already enabled when building Lagom, so let's enable it for the main build too. We will no longer be surprised by Lagom Clang CI builds failing while everything compiles locally. Furthermore, the stronger `-Wsuggest-override` warning is enabled in this commit, which enforces the use of the `override` keyword in all classes, not just those which already have some methods marked as `override`. This works with both GCC and Clang.
This commit is contained in:
parent
813593a485
commit
4a81b33c07
Notes:
sideshowbarker
2024-07-17 22:58:50 +09:00
Author: https://github.com/BertalanD Commit: https://github.com/SerenityOS/serenity/commit/4a81b33c07c Pull-request: https://github.com/SerenityOS/serenity/pull/11206
@ -157,6 +157,7 @@ add_compile_options(-Wlogical-op)
|
||||
add_compile_options(-Wmisleading-indentation)
|
||||
add_compile_options(-Wmissing-declarations)
|
||||
add_compile_options(-Wnon-virtual-dtor)
|
||||
add_compile_options(-Wsuggest-override)
|
||||
add_compile_options(-Wno-unknown-warning-option)
|
||||
add_compile_options(-Wundef)
|
||||
add_compile_options(-Wunused)
|
||||
@ -186,7 +187,6 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang$")
|
||||
add_compile_options(-Wno-atomic-alignment)
|
||||
add_compile_options(-Wno-c99-designator)
|
||||
add_compile_options(-Wno-implicit-const-int-float-conversion)
|
||||
add_compile_options(-Wno-inconsistent-missing-override)
|
||||
add_compile_options(-Wno-null-pointer-subtraction)
|
||||
add_compile_options(-Wno-tautological-constant-out-of-range-compare)
|
||||
add_compile_options(-Wno-unneeded-internal-declaration)
|
||||
|
@ -24,7 +24,7 @@ public:
|
||||
|
||||
private:
|
||||
virtual StringView class_name() const override { return "AnonymousFile"sv; }
|
||||
virtual ErrorOr<NonnullOwnPtr<KString>> pseudo_path(const OpenFileDescription&) const;
|
||||
virtual ErrorOr<NonnullOwnPtr<KString>> pseudo_path(const OpenFileDescription&) const override;
|
||||
virtual bool can_read(const OpenFileDescription&, size_t) const override { return false; }
|
||||
virtual bool can_write(const OpenFileDescription&, size_t) const override { return false; }
|
||||
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override { return ENOTSUP; }
|
||||
|
@ -54,8 +54,8 @@ protected:
|
||||
ProcFS const& procfs() const { return static_cast<ProcFS const&>(Inode::fs()); }
|
||||
|
||||
// ^Inode
|
||||
virtual ErrorOr<void> attach(OpenFileDescription& description) = 0;
|
||||
virtual void did_seek(OpenFileDescription&, off_t) = 0;
|
||||
virtual ErrorOr<void> attach(OpenFileDescription& description) override = 0;
|
||||
virtual void did_seek(OpenFileDescription&, off_t) override = 0;
|
||||
virtual ErrorOr<void> flush_metadata() override final;
|
||||
virtual ErrorOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override final;
|
||||
virtual ErrorOr<void> add_child(Inode&, StringView name, mode_t) override final;
|
||||
|
@ -146,7 +146,7 @@ protected:
|
||||
virtual ErrorOr<void> chmod(mode_t) override;
|
||||
virtual ErrorOr<void> chown(UserID, GroupID) override;
|
||||
virtual ErrorOr<void> truncate(u64) override;
|
||||
virtual ErrorOr<void> set_mtime(time_t);
|
||||
virtual ErrorOr<void> set_mtime(time_t) override;
|
||||
|
||||
virtual ErrorOr<void> attach(OpenFileDescription& description) override final;
|
||||
virtual void did_seek(OpenFileDescription&, off_t) override final;
|
||||
|
@ -26,7 +26,7 @@ public:
|
||||
virtual mode_t permissions() const override;
|
||||
virtual ErrorOr<size_t> write_bytes(off_t, size_t, UserOrKernelBuffer const&, OpenFileDescription*) override;
|
||||
virtual ErrorOr<void> truncate(u64) override;
|
||||
virtual ErrorOr<void> set_mtime(time_t) { return {}; }
|
||||
virtual ErrorOr<void> set_mtime(time_t) override { return {}; }
|
||||
|
||||
private:
|
||||
PowerStateSwitchNode(FirmwareSysFSDirectory&);
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
virtual ~GenericFramebufferDevice() = default;
|
||||
|
||||
// ^File
|
||||
virtual ErrorOr<Memory::Region*> mmap(Process&, OpenFileDescription&, Memory::VirtualRange const&, u64 offset, int prot, bool shared) = 0;
|
||||
virtual ErrorOr<Memory::Region*> mmap(Process&, OpenFileDescription&, Memory::VirtualRange const&, u64 offset, int prot, bool shared) override = 0;
|
||||
virtual ErrorOr<void> ioctl(OpenFileDescription&, unsigned request, Userspace<void*> arg) override final;
|
||||
virtual StringView class_name() const override final { return "FramebufferDevice"sv; }
|
||||
|
||||
|
@ -30,8 +30,8 @@ public:
|
||||
|
||||
virtual ErrorOr<void> try_to_initialize() override { return {}; }
|
||||
|
||||
virtual void deactivate_writes();
|
||||
virtual void activate_writes();
|
||||
virtual void deactivate_writes() override;
|
||||
virtual void activate_writes() override;
|
||||
|
||||
size_t width() const { return display_info().rect.width; }
|
||||
size_t height() const { return display_info().rect.height; }
|
||||
|
@ -31,12 +31,12 @@ public:
|
||||
// just assume that it's up.
|
||||
return true;
|
||||
}
|
||||
virtual i32 link_speed()
|
||||
virtual i32 link_speed() override
|
||||
{
|
||||
// Can only do 10mbit..
|
||||
return 10;
|
||||
}
|
||||
virtual bool link_full_duplex() { return true; }
|
||||
virtual bool link_full_duplex() override { return true; }
|
||||
|
||||
virtual StringView purpose() const override { return class_name(); }
|
||||
|
||||
|
@ -416,7 +416,7 @@ public:
|
||||
)~~~");
|
||||
|
||||
message_generator.append(R"~~~(
|
||||
virtual bool valid() const { return m_ipc_message_valid; }
|
||||
virtual bool valid() const override { return m_ipc_message_valid; }
|
||||
|
||||
virtual IPC::MessageBuffer encode() const override
|
||||
{
|
||||
|
@ -35,17 +35,17 @@ struct TreeNode : public SpaceAnalyzer::TreeMapNode {
|
||||
TreeNode(String name)
|
||||
: m_name(move(name)) {};
|
||||
|
||||
virtual String name() const { return m_name; }
|
||||
virtual i64 area() const { return m_area; }
|
||||
virtual size_t num_children() const
|
||||
virtual String name() const override { return m_name; }
|
||||
virtual i64 area() const override { return m_area; }
|
||||
virtual size_t num_children() const override
|
||||
{
|
||||
if (m_children) {
|
||||
return m_children->size();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
virtual const TreeNode& child_at(size_t i) const { return m_children->at(i); }
|
||||
virtual void sort_children_by_area() const
|
||||
virtual const TreeNode& child_at(size_t i) const override { return m_children->at(i); }
|
||||
virtual void sort_children_by_area() const override
|
||||
{
|
||||
if (m_children) {
|
||||
Vector<TreeNode>* children = const_cast<Vector<TreeNode>*>(m_children.ptr());
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual void config_string_did_change(String const& domain, String const& group, String const& key, String const& value)
|
||||
virtual void config_string_did_change(String const& domain, String const& group, String const& key, String const& value) override
|
||||
{
|
||||
VERIFY(domain == "Terminal");
|
||||
|
||||
@ -77,7 +77,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual void config_i32_did_change(String const& domain, String const& group, String const& key, i32 value)
|
||||
virtual void config_i32_did_change(String const& domain, String const& group, String const& key, i32 value) override
|
||||
{
|
||||
VERIFY(domain == "Terminal");
|
||||
|
||||
|
@ -24,7 +24,7 @@ protected:
|
||||
GitFilesView(GitFileActionCallback, NonnullRefPtr<Gfx::Bitmap> action_icon);
|
||||
|
||||
private:
|
||||
virtual void paint_list_item(GUI::Painter& painter, int row_index, int painted_item_index);
|
||||
virtual void paint_list_item(GUI::Painter& painter, int row_index, int painted_item_index) override;
|
||||
|
||||
virtual void mousedown_event(GUI::MouseEvent&) override;
|
||||
virtual Gfx::IntRect action_icon_rect(size_t painted_item_index);
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
|
||||
static UCICommand from_string(StringView command);
|
||||
|
||||
virtual String to_string() const;
|
||||
virtual String to_string() const override;
|
||||
};
|
||||
|
||||
class DebugCommand : public Command {
|
||||
@ -76,7 +76,7 @@ public:
|
||||
|
||||
static DebugCommand from_string(StringView command);
|
||||
|
||||
virtual String to_string() const;
|
||||
virtual String to_string() const override;
|
||||
|
||||
Flag flag() const { return m_flag; }
|
||||
|
||||
@ -93,7 +93,7 @@ public:
|
||||
|
||||
static IsReadyCommand from_string(StringView command);
|
||||
|
||||
virtual String to_string() const;
|
||||
virtual String to_string() const override;
|
||||
};
|
||||
|
||||
class SetOptionCommand : public Command {
|
||||
@ -107,7 +107,7 @@ public:
|
||||
|
||||
static SetOptionCommand from_string(StringView command);
|
||||
|
||||
virtual String to_string() const;
|
||||
virtual String to_string() const override;
|
||||
|
||||
const String& name() const { return m_name; }
|
||||
const Optional<String>& value() const { return m_value; }
|
||||
@ -128,7 +128,7 @@ public:
|
||||
|
||||
static PositionCommand from_string(StringView command);
|
||||
|
||||
virtual String to_string() const;
|
||||
virtual String to_string() const override;
|
||||
|
||||
const Optional<String>& fen() const { return m_fen; }
|
||||
const Vector<Chess::Move>& moves() const { return m_moves; }
|
||||
@ -147,7 +147,7 @@ public:
|
||||
|
||||
static GoCommand from_string(StringView command);
|
||||
|
||||
virtual String to_string() const;
|
||||
virtual String to_string() const override;
|
||||
|
||||
Optional<Vector<Chess::Move>> searchmoves;
|
||||
bool ponder { false };
|
||||
@ -172,7 +172,7 @@ public:
|
||||
|
||||
static StopCommand from_string(StringView command);
|
||||
|
||||
virtual String to_string() const;
|
||||
virtual String to_string() const override;
|
||||
};
|
||||
|
||||
class IdCommand : public Command {
|
||||
@ -191,7 +191,7 @@ public:
|
||||
|
||||
static IdCommand from_string(StringView command);
|
||||
|
||||
virtual String to_string() const;
|
||||
virtual String to_string() const override;
|
||||
|
||||
Type field_type() const { return m_field_type; }
|
||||
const String& value() const { return m_value; }
|
||||
@ -210,7 +210,7 @@ public:
|
||||
|
||||
static UCIOkCommand from_string(StringView command);
|
||||
|
||||
virtual String to_string() const;
|
||||
virtual String to_string() const override;
|
||||
};
|
||||
|
||||
class ReadyOkCommand : public Command {
|
||||
@ -222,7 +222,7 @@ public:
|
||||
|
||||
static ReadyOkCommand from_string(StringView command);
|
||||
|
||||
virtual String to_string() const;
|
||||
virtual String to_string() const override;
|
||||
};
|
||||
|
||||
class BestMoveCommand : public Command {
|
||||
@ -235,7 +235,7 @@ public:
|
||||
|
||||
static BestMoveCommand from_string(StringView command);
|
||||
|
||||
virtual String to_string() const;
|
||||
virtual String to_string() const override;
|
||||
|
||||
Chess::Move move() const { return m_move; }
|
||||
|
||||
@ -252,7 +252,7 @@ public:
|
||||
|
||||
static InfoCommand from_string(StringView command);
|
||||
|
||||
virtual String to_string() const;
|
||||
virtual String to_string() const override;
|
||||
|
||||
Optional<int> depth;
|
||||
Optional<int> seldepth;
|
||||
|
@ -27,8 +27,8 @@ public:
|
||||
update(data);
|
||||
}
|
||||
|
||||
void update(ReadonlyBytes data);
|
||||
u32 digest();
|
||||
virtual void update(ReadonlyBytes data) override;
|
||||
virtual u32 digest() override;
|
||||
|
||||
private:
|
||||
u32 m_state_a { 1 };
|
||||
|
@ -55,8 +55,8 @@ public:
|
||||
update(data);
|
||||
}
|
||||
|
||||
void update(ReadonlyBytes data);
|
||||
u32 digest();
|
||||
virtual void update(ReadonlyBytes data) override;
|
||||
virtual u32 digest() override;
|
||||
|
||||
private:
|
||||
u32 m_state { ~0u };
|
||||
|
@ -178,7 +178,7 @@ class MarkingVisitor final : public Cell::Visitor {
|
||||
public:
|
||||
MarkingVisitor() { }
|
||||
|
||||
virtual void visit_impl(Cell& cell)
|
||||
virtual void visit_impl(Cell& cell) override
|
||||
{
|
||||
if (cell.is_marked())
|
||||
return;
|
||||
|
@ -943,7 +943,7 @@ public:
|
||||
bool has_selection() const { return !m_select_statement.is_null(); }
|
||||
const RefPtr<Select>& select_statement() const { return m_select_statement; }
|
||||
|
||||
RefPtr<SQLResult> execute(ExecutionContext&) const;
|
||||
virtual RefPtr<SQLResult> execute(ExecutionContext&) const override;
|
||||
|
||||
private:
|
||||
RefPtr<CommonTableExpressionList> m_common_table_expression_list;
|
||||
|
@ -35,8 +35,8 @@ public:
|
||||
const RefPtr<CSSStyleSheet> loaded_style_sheet() const { return m_style_sheet; }
|
||||
void set_style_sheet(const RefPtr<CSSStyleSheet>& style_sheet) { m_style_sheet = style_sheet; }
|
||||
|
||||
virtual StringView class_name() const { return "CSSImportRule"; };
|
||||
virtual Type type() const { return Type::Import; };
|
||||
virtual StringView class_name() const override { return "CSSImportRule"; };
|
||||
virtual Type type() const override { return Type::Import; };
|
||||
|
||||
private:
|
||||
explicit CSSImportRule(AK::URL, DOM::Document&);
|
||||
|
@ -1345,7 +1345,7 @@ public:
|
||||
return m_values[i];
|
||||
}
|
||||
|
||||
virtual String to_string() const
|
||||
virtual String to_string() const override
|
||||
{
|
||||
StringBuilder builder;
|
||||
builder.appendff("List[{}](", m_values.size());
|
||||
|
@ -171,7 +171,7 @@ public:
|
||||
const String& source() const { return m_source; }
|
||||
void set_source(const String& source) { m_source = source; }
|
||||
|
||||
JS::Realm& realm();
|
||||
virtual JS::Realm& realm() override;
|
||||
JS::Interpreter& interpreter();
|
||||
|
||||
JS::Value run_javascript(StringView source, StringView filename = "(unknown)");
|
||||
|
@ -161,8 +161,8 @@ public:
|
||||
|
||||
void clear_overflow_data() { m_overflow_data = nullptr; }
|
||||
|
||||
virtual void before_children_paint(PaintContext&, PaintPhase);
|
||||
virtual void after_children_paint(PaintContext&, PaintPhase);
|
||||
virtual void before_children_paint(PaintContext&, PaintPhase) override;
|
||||
virtual void after_children_paint(PaintContext&, PaintPhase) override;
|
||||
|
||||
protected:
|
||||
Box(DOM::Document& document, DOM::Node* node, NonnullRefPtr<CSS::StyleProperties> style)
|
||||
|
@ -1671,7 +1671,7 @@ void Shell::bring_cursor_to_beginning_of_a_line() const
|
||||
bool Shell::has_history_event(StringView source)
|
||||
{
|
||||
struct : public AST::NodeVisitor {
|
||||
virtual void visit(const AST::HistoryEvent* node)
|
||||
virtual void visit(const AST::HistoryEvent* node) override
|
||||
{
|
||||
has_history_event = true;
|
||||
AST::NodeVisitor::visit(node);
|
||||
|
Loading…
Reference in New Issue
Block a user