build: mark missing overrides and drop unused lambda captures (1,156 clang warnings) (#15334)

* chore: mark every declaration that overrides a base virtual

clang-cl reports 42 member functions across 28 files that override a
base virtual without being marked `override`, inside classes that
already mark their other overrides. That is every occurrence of
-Winconsistent-missing-override in the tree, so the category drops to
zero and -Werror=inconsistent-missing-override becomes available as a
guard against it coming back.

Behaviour is unchanged. Each keyword goes only where clang had already
resolved the declaration to a base virtual, so it records what the
compiler already worked out and cannot affect overload resolution or
dispatch. If any of these signatures had not really overridden a base
method, the build would have failed rather than warned.

Where a declaration already carried `virtual` it is left alone and the
keyword appended, matching the surrounding declarations. Plain
`override` is used rather than the wxWidgets `wxOVERRIDE` macro, which
wx/defs.h defines as `override` beneath a comment marking it obsolete,
and which the rest of src/slic3r already avoids by 1742 occurrences to
113.

A full clang-cl build takes -Winconsistent-missing-override from 1,146
warning lines to 0. Those 42 declarations produce that many lines
because a header is re-diagnosed in every translation unit that
includes it. CalibrationWizardStartPage.hpp alone accounts for 336 of
them from 4 declarations.

* chore: drop unused lambda captures in GUI/Widgets

clang-cl reports 10 lambda captures in src/slic3r/GUI/Widgets that are
never read. Removing them changes nothing at runtime.

Every capture removed is `this` or a raw pointer. clang does not report
a capture whose type has a non-trivial destructor, since such a capture
can be held purely for its effect on an object's lifetime, so nothing
that owns or extends a lifetime is touched. The std::weak_ptr captured
beside the removed `this` in MultiNozzleSync.cpp stays.

This clears the category in GUI/Widgets only. A full clang-cl build
takes -Wunused-lambda-capture from 312 warning lines to 302, leaving
235 sites in other directories for a follow-up.
This commit is contained in:
Kris Austin
2026-08-25 08:18:48 -03:00
committed by GitHub
parent 524fd5e9c0
commit 56f9edc572
32 changed files with 52 additions and 52 deletions
+7 -7
View File
@@ -630,7 +630,7 @@ NozzleListTable::NozzleListTable(wxWindow* parent) : wxPanel(parent,wxID_ANY,wxD
SetSizer(sizer);
Layout();
m_web_view->Bind(wxEVT_WEBVIEW_SCRIPT_MESSAGE_RECEIVED, [this,sizer](wxWebViewEvent& evt) {
m_web_view->Bind(wxEVT_WEBVIEW_SCRIPT_MESSAGE_RECEIVED, [this](wxWebViewEvent& evt) {
std::string message = evt.GetString().ToStdString();
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << "Received message: " << message;
try {
@@ -1168,8 +1168,8 @@ void MultiNozzleSyncDialog::UpdateButton(std::weak_ptr<DevNozzleRack> rack, bool
m_cancel_btn->SetLabel(_L("Ignore"));
m_confirm_btn->SetLabel(_L("Refresh"));
m_cancel_btn->Bind(wxEVT_LEFT_DOWN, [this, rack, ignore_opt](auto& e) {ignore_opt(); });
m_confirm_btn->Bind(wxEVT_LEFT_DOWN, [this, rack, refresh_cmd](auto& e) {refresh_cmd(); });
m_cancel_btn->Bind(wxEVT_LEFT_DOWN, [rack, ignore_opt](auto& e) {ignore_opt(); });
m_confirm_btn->Bind(wxEVT_LEFT_DOWN, [rack, refresh_cmd](auto& e) {refresh_cmd(); });
}
else if (has_unknown) {
m_cancel_btn->Show();
@@ -1178,8 +1178,8 @@ void MultiNozzleSyncDialog::UpdateButton(std::weak_ptr<DevNozzleRack> rack, bool
m_cancel_btn->SetLabel(_L("Ignore"));
m_confirm_btn->SetLabel(_L("Refresh"));
m_cancel_btn->Bind(wxEVT_LEFT_DOWN, [this, rack, ignore_opt](auto& e) {ignore_opt(); });
m_confirm_btn->Bind(wxEVT_LEFT_DOWN, [this, rack, refresh_cmd](auto& e) {refresh_cmd(); });
m_cancel_btn->Bind(wxEVT_LEFT_DOWN, [rack, ignore_opt](auto& e) {ignore_opt(); });
m_confirm_btn->Bind(wxEVT_LEFT_DOWN, [rack, refresh_cmd](auto& e) {refresh_cmd(); });
}
else if (has_unreliable) {
m_cancel_btn->Show();
@@ -1188,8 +1188,8 @@ void MultiNozzleSyncDialog::UpdateButton(std::weak_ptr<DevNozzleRack> rack, bool
m_cancel_btn->SetLabel(_L("Refresh"));
m_confirm_btn->SetLabel(_L("Confirm"));
m_cancel_btn->Bind(wxEVT_LEFT_DOWN, [this, rack, refresh_cmd](auto& e) {refresh_cmd(); });
m_confirm_btn->Bind(wxEVT_LEFT_DOWN, [this, rack, trust_cmd](auto& e) {trust_cmd(); });
m_cancel_btn->Bind(wxEVT_LEFT_DOWN, [rack, refresh_cmd](auto& e) {refresh_cmd(); });
m_confirm_btn->Bind(wxEVT_LEFT_DOWN, [rack, trust_cmd](auto& e) {trust_cmd(); });
}
else {
+1 -1
View File
@@ -167,7 +167,7 @@ class MultiNozzleSyncDialog : public DPIDialog
{
public:
MultiNozzleSyncDialog(wxWindow* parent, std::weak_ptr<DevNozzleRack> rack);
virtual void on_dpi_changed(const wxRect& suggested_rect) {};
virtual void on_dpi_changed(const wxRect& suggested_rect) override {};
std::vector<NozzleOption> GetNozzleOptions(const std::vector<MultiNozzleUtils::NozzleGroupInfo>& group_infos);
std::optional<NozzleOption> GetSelectedOption() {
+1 -1
View File
@@ -56,7 +56,7 @@ protected:
void paintEvent(wxPaintEvent &evt);
void render(wxDC &dc);
void doRender(wxDC &dc);
virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO) override;
+1 -1
View File
@@ -33,7 +33,7 @@ public:
void OnPaint(wxPaintEvent &evt);
virtual ~ProgressDialog();
virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO) override;
bool Create(const wxString &title, const wxString &message, int maximum = 100, wxWindow *parent = NULL, int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE);
virtual bool Update(int value, const wxString &newmsg = wxEmptyString, bool *skip = NULL);
+2 -2
View File
@@ -31,7 +31,7 @@ public:
void SetLayoutStyle(int style);
void SetLabel(const wxString& label);
void SetLabel(const wxString& label) override;
bool SetForegroundColour(wxColour const & colour) override;
@@ -47,7 +47,7 @@ public:
void SetBackgroundColor(StateColor const &color);
bool Enable(bool enable = true);
bool Enable(bool enable = true) override;
void Rescale();
+1 -1
View File
@@ -75,7 +75,7 @@ void SpinInput::Create(wxWindow *parent,
text_ctrl->Bind(wxEVT_KILL_FOCUS, &SpinInput::onTextLostFocus, this);
text_ctrl->Bind(wxEVT_TEXT_ENTER, &SpinInput::onTextEnter, this);
text_ctrl->Bind(wxEVT_KEY_DOWN, &SpinInput::keyPressed, this);
text_ctrl->Bind(wxEVT_RIGHT_DOWN, [this](auto &e) {}); // disable context menu
text_ctrl->Bind(wxEVT_RIGHT_DOWN, [](auto &e) {}); // disable context menu
button_inc = createButton(true);
button_dec = createButton(false);
delta = 0;
+1 -1
View File
@@ -63,7 +63,7 @@ public:
bool IsVisible(unsigned int item) const;
private:
virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO) override;
#ifdef __WIN32__
WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) override;
+1 -1
View File
@@ -134,7 +134,7 @@ void TempInput::Create(wxWindow *parent, wxString text, wxString label, wxString
}
}
});
text_ctrl->Bind(wxEVT_RIGHT_DOWN, [this](auto &e) {}); // disable context menu
text_ctrl->Bind(wxEVT_RIGHT_DOWN, [](auto &e) {}); // disable context menu
text_ctrl->Bind(wxEVT_LEFT_DOWN, [this](auto &e) {
if (m_read_only) {
return;
+2 -2
View File
@@ -107,7 +107,7 @@ public:
wxString GetTagTemp() { return text_ctrl->GetValue(); }
wxString GetCurrTemp() { return GetLabel(); }
int get_max_temp() { return max_temp; }
void SetLabel(const wxString &label);
void SetLabel(const wxString &label) override;
void SetTextColor(StateColor const &color);
@@ -128,7 +128,7 @@ public:
void ReSetOnChanging() { m_on_changing = false; }
protected:
virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO) override;
void DoSetToolTipText(wxString const &tip) override;
+1 -1
View File
@@ -85,7 +85,7 @@ void TextInput::Create(wxWindow * parent,
e.SetId(GetId());
ProcessEventLocally(e);
});
text_ctrl->Bind(wxEVT_RIGHT_DOWN, [this](auto &e) {}); // disable context menu
text_ctrl->Bind(wxEVT_RIGHT_DOWN, [](auto &e) {}); // disable context menu
if (!icon.IsEmpty()) {
this->icon = ScalableBitmap(this, icon.ToStdString(), 16);
}
+2 -2
View File
@@ -46,7 +46,7 @@ public:
// Only meant to be used by inspector, not public API
int GetCornerRadius() const { return static_cast<int>(radius); }
void SetLabel(const wxString& label);
void SetLabel(const wxString& label) override;
void SetStaticTips(const wxString& tips, const wxBitmap& bitmap);
@@ -73,7 +73,7 @@ protected:
virtual void OnEdit() {}
virtual void DoSetSize(
int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO) override;
void DoSetToolTipText(wxString const &tip) override;
+1 -1
View File
@@ -104,7 +104,7 @@ DWORD DownloadAndInstallWV2RT() {
class WebViewEdge : public wxWebViewEdge
{
public:
bool SetUserAgent(const wxString &userAgent)
bool SetUserAgent(const wxString &userAgent) override
{
bool dark = userAgent.Contains("dark");
SetColorScheme(dark ? COREWEBVIEW2_PREFERRED_COLOR_SCHEME_DARK : COREWEBVIEW2_PREFERRED_COLOR_SCHEME_LIGHT);