mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-17 14:02:35 +00:00
build: clear 237 warnings - unused lambda captures (#15417)
* build: enable /Zc:lambda for MSVC MSVC keeps its legacy lambda processor under /std:c++17, which rejects reading a constexpr constant inside a lambda that does not capture it (C3493). No other compiler requires that capture, and clang reports it as an unused one, so the two cannot both be satisfied without the flag. /Zc:lambda selects the conforming lambda parser that clang and GCC already use. It is implied by /std:c++20 and /permissive-, so it is only needed while we are on C++17. clang-cl is conforming already and does not take the flag. It requires VS2019 16.8, so build_release_vs.bat now says 16.8+. * build: clear 237 unused lambda capture warnings 236 captures across 81 files, 142 of them `this`. Removing an unused capture changes no behavior; clang does not report a capture whose type has a non-trivial destructor, so nothing held only to extend an object's lifetime is in this set. Nine of them are the second half of the warning, "is not required to be captured for this use", where the capture is a const or constexpr value the body does read. Those depend on the /Zc:lambda change in the previous commit. One of them, in FillRectilinear.cpp, had been worked around with an #ifndef __APPLE__ guard around the capture list, which is now gone. GUI_ObjectTableSettings.cpp captured its reset button only to read it inside #ifdef __WXOSX_MAC__. That branch now takes the button from the event it is already handling. * build: fail configure on MSVC older than 19.28 instead of dropping /Zc:lambda cl.exe answers an unrecognized /Zc: sub-option with warning D9002 and keeps going, so on VS2019 before 16.8 the flag is silently ignored and the build instead dies with C3493 in FillRectilinear.cpp, nowhere near the cause. * fix: delete three locals that are now unused Their only remaining use was the lambda capture this branch removed. The Clang builds set -Wno-unused-variable, so the build never flagged them. --------- Co-authored-by: Rodrigo Faselli <162915171+RF47@users.noreply.github.com>
This commit is contained in:
co-authored by
Rodrigo Faselli
parent
e523acc164
commit
1749c293a6
@@ -2324,7 +2324,7 @@ void ObjectList::load_modifier(const wxArrayString& input_files, ModelObject& mo
|
||||
bool split_compound = wxGetApp().app_config->get_bool("is_split_compound");
|
||||
model = Model::read_from_step(
|
||||
input_file, LoadStrategy::LoadModel, nullptr, nullptr,
|
||||
[this, &is_user_cancel, &linear, &angle, &split_compound](Slic3r::Step& file, double& linear_value,
|
||||
[&is_user_cancel, &linear, &angle, &split_compound](Slic3r::Step& file, double& linear_value,
|
||||
double& angle_value, bool& is_split) -> int {
|
||||
if (wxGetApp().app_config->get_bool("enable_step_mesh_setting")) {
|
||||
StepMeshDialog mesh_dlg(nullptr, file, linear, angle);
|
||||
@@ -3317,7 +3317,7 @@ void ObjectList::boolean()
|
||||
}
|
||||
}
|
||||
|
||||
TriangleMesh mesh = Plater::combine_mesh_fff(*object, -1, [this](const std::string& msg) {return wxGetApp().notification_manager()->push_plater_error_notification(msg); });
|
||||
TriangleMesh mesh = Plater::combine_mesh_fff(*object, -1, [](const std::string& msg) {return wxGetApp().notification_manager()->push_plater_error_notification(msg); });
|
||||
|
||||
// add mesh to model as a new object, keep the original object's name and config
|
||||
Model* model = object->get_model();
|
||||
@@ -6267,7 +6267,7 @@ void GUI::ObjectList::smooth_mesh()
|
||||
get_selection_indexes(obj_idxs, vol_idxs);
|
||||
auto object_idx = obj_idxs.front();
|
||||
ModelObject *obj{nullptr};
|
||||
auto show_warning_dlg = [this](int cur_face_count,std::string name,bool is_part) {
|
||||
auto show_warning_dlg = [](int cur_face_count,std::string name,bool is_part) {
|
||||
int limit_face_count = 1000000;
|
||||
if (cur_face_count > limit_face_count) {
|
||||
auto name_str = wxString::FromUTF8(name);
|
||||
@@ -6280,7 +6280,7 @@ void GUI::ObjectList::smooth_mesh()
|
||||
}
|
||||
return false;
|
||||
};
|
||||
auto show_smooth_mesh_error_dlg = [this](std::string name) {
|
||||
auto show_smooth_mesh_error_dlg = [](std::string name) {
|
||||
auto name_str = wxString::FromUTF8(name);
|
||||
auto content = wxString::Format(_L("\"%s\" part's mesh contains errors. Please repair it first."), name_str);
|
||||
WarningDialog dlg(static_cast<wxWindow *>(wxGetApp().mainframe), content, wxEmptyString, wxOK);
|
||||
|
||||
Reference in New Issue
Block a user