diff options
author | Daniel Bertalan <dani@danielbertalan.dev> | 2021-12-04 10:09:09 +0100 |
---|---|---|
committer | Brian Gianforcaro <b.gianfo@gmail.com> | 2021-12-11 13:14:15 -0800 |
commit | 4a81b33c07cbb440c7fefcc073e94e113feeac52 (patch) | |
tree | 8cad5817266b1a99a484b95338d7992f2c147e6a /Userland | |
parent | 813593a485671e78f17c4e79f1ce12c31dd35aa6 (diff) | |
download | serenity-4a81b33c07cbb440c7fefcc073e94e113feeac52.zip |
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.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Applications/SpaceAnalyzer/main.cpp | 10 | ||||
-rw-r--r-- | Userland/Applications/Terminal/main.cpp | 4 | ||||
-rw-r--r-- | Userland/DevTools/HackStudio/Git/GitFilesView.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibChess/UCICommand.h | 24 | ||||
-rw-r--r-- | Userland/Libraries/LibCrypto/Checksum/Adler32.h | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibCrypto/Checksum/CRC32.h | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Heap/Heap.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibSQL/AST/AST.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/CSSImportRule.h | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/StyleValue.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/DOM/Document.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/Box.h | 4 | ||||
-rw-r--r-- | Userland/Shell/Shell.cpp | 2 |
13 files changed, 33 insertions, 33 deletions
diff --git a/Userland/Applications/SpaceAnalyzer/main.cpp b/Userland/Applications/SpaceAnalyzer/main.cpp index ec41f9d4a5..d1b7297698 100644 --- a/Userland/Applications/SpaceAnalyzer/main.cpp +++ b/Userland/Applications/SpaceAnalyzer/main.cpp @@ -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()); diff --git a/Userland/Applications/Terminal/main.cpp b/Userland/Applications/Terminal/main.cpp index 12e9c154a1..786258d5dd 100644 --- a/Userland/Applications/Terminal/main.cpp +++ b/Userland/Applications/Terminal/main.cpp @@ -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"); diff --git a/Userland/DevTools/HackStudio/Git/GitFilesView.h b/Userland/DevTools/HackStudio/Git/GitFilesView.h index 0901e4787e..648cbfcb77 100644 --- a/Userland/DevTools/HackStudio/Git/GitFilesView.h +++ b/Userland/DevTools/HackStudio/Git/GitFilesView.h @@ -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); diff --git a/Userland/Libraries/LibChess/UCICommand.h b/Userland/Libraries/LibChess/UCICommand.h index e591906e5c..a72b78025c 100644 --- a/Userland/Libraries/LibChess/UCICommand.h +++ b/Userland/Libraries/LibChess/UCICommand.h @@ -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; diff --git a/Userland/Libraries/LibCrypto/Checksum/Adler32.h b/Userland/Libraries/LibCrypto/Checksum/Adler32.h index 97117766ab..3c4595465b 100644 --- a/Userland/Libraries/LibCrypto/Checksum/Adler32.h +++ b/Userland/Libraries/LibCrypto/Checksum/Adler32.h @@ -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 }; diff --git a/Userland/Libraries/LibCrypto/Checksum/CRC32.h b/Userland/Libraries/LibCrypto/Checksum/CRC32.h index 885cf5bde5..e2913527fd 100644 --- a/Userland/Libraries/LibCrypto/Checksum/CRC32.h +++ b/Userland/Libraries/LibCrypto/Checksum/CRC32.h @@ -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 }; diff --git a/Userland/Libraries/LibJS/Heap/Heap.cpp b/Userland/Libraries/LibJS/Heap/Heap.cpp index 023f0aaf7e..e616ecbb98 100644 --- a/Userland/Libraries/LibJS/Heap/Heap.cpp +++ b/Userland/Libraries/LibJS/Heap/Heap.cpp @@ -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; diff --git a/Userland/Libraries/LibSQL/AST/AST.h b/Userland/Libraries/LibSQL/AST/AST.h index b0ee4c7262..7dbcb7c389 100644 --- a/Userland/Libraries/LibSQL/AST/AST.h +++ b/Userland/Libraries/LibSQL/AST/AST.h @@ -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; diff --git a/Userland/Libraries/LibWeb/CSS/CSSImportRule.h b/Userland/Libraries/LibWeb/CSS/CSSImportRule.h index 3958c54708..1c6e37a55c 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSImportRule.h +++ b/Userland/Libraries/LibWeb/CSS/CSSImportRule.h @@ -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&); diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValue.h index 14f52b4a2f..7ddc949809 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValue.h @@ -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()); diff --git a/Userland/Libraries/LibWeb/DOM/Document.h b/Userland/Libraries/LibWeb/DOM/Document.h index 9f374ec385..c1d93e3bdf 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.h +++ b/Userland/Libraries/LibWeb/DOM/Document.h @@ -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)"); diff --git a/Userland/Libraries/LibWeb/Layout/Box.h b/Userland/Libraries/LibWeb/Layout/Box.h index d256ecbc73..71f2e65d85 100644 --- a/Userland/Libraries/LibWeb/Layout/Box.h +++ b/Userland/Libraries/LibWeb/Layout/Box.h @@ -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) diff --git a/Userland/Shell/Shell.cpp b/Userland/Shell/Shell.cpp index 2d24d5c811..ef4979a888 100644 --- a/Userland/Shell/Shell.cpp +++ b/Userland/Shell/Shell.cpp @@ -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); |