build: clear 50 warnings - pessimizing moves and null checks that cannot fail (#15408)

* build: remove std::move that blocks copy elision

std::move wrapped around a temporary, or around a local being returned,
stops the compiler constructing it in place. Each edit is the fix clang
suggests, which is to delete the std::move call and keep its argument.

Three of the 39 sites save a move, the two return std::move(local) in
Print.cpp and TreeSupport.cpp:2749. The rest are equivalent either way
and match how the codebase already writes this elsewhere.

Clears 39 -Wpessimizing-move warnings.

* build: drop null checks on references and this

A reference cannot be bound to null and this cannot be null, so the
compiler folds these conditions to true and drops the guard. Seven are
if (&bitmap && bitmap.IsOk()), where IsOk() already does the work; two
test this directly. The guarded code runs either way, so removing the
dead operand changes nothing.

Clears 11 -Wundefined-bool-conversion warnings.
This commit is contained in:
Kris Austin
2026-08-28 08:05:59 -03:00
committed by GitHub
parent cc390f11ee
commit db29f570bd
20 changed files with 59 additions and 61 deletions
+9 -11
View File
@@ -978,18 +978,16 @@ void SendToPrinterDialog::on_ok(wxCommandEvent &event)
m_send_job->on_check_ip_address_fail([this, token = std::weak_ptr(m_token)](int result) {
CallAfter([token, this] {
if (token.expired()) { return; }
if (this) {
SendFailedConfirm sfcDlg;
auto res = sfcDlg.ShowModal();
m_status_bar->cancel();
SendFailedConfirm sfcDlg;
auto res = sfcDlg.ShowModal();
m_status_bar->cancel();
if (res == wxYES) {
wxQueueEvent(m_button_ensure, new wxCommandEvent(wxEVT_BUTTON));
} else if (res == wxAPPLY) {
wxCommandEvent *evt = new wxCommandEvent(EVT_CLEAR_IPADDRESS);
wxQueueEvent(this, evt);
wxGetApp().show_ip_address_enter_dialog();
}
if (res == wxYES) {
wxQueueEvent(m_button_ensure, new wxCommandEvent(wxEVT_BUTTON));
} else if (res == wxAPPLY) {
wxCommandEvent *evt = new wxCommandEvent(EVT_CLEAR_IPADDRESS);
wxQueueEvent(this, evt);
wxGetApp().show_ip_address_enter_dialog();
}
});
});