From 0ff0444dcc3975d823872f6ec841e1f26a69c3b4 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Fri, 29 Jan 2021 16:16:23 +0100 Subject: [PATCH 1/4] Fixing Clang warnings 1 --- src/libslic3r/AppConfig.cpp | 6 ++--- src/libslic3r/Config.hpp | 2 +- src/libslic3r/GCode/WipeTower.cpp | 2 +- src/libslic3r/LayerRegion.cpp | 6 ++--- src/libslic3r/TriangleMesh.hpp | 4 ++-- src/slic3r/Config/Snapshot.cpp | 4 ++-- src/slic3r/GUI/BonjourDialog.cpp | 5 ++-- src/slic3r/GUI/ConfigSnapshotDialog.cpp | 2 +- src/slic3r/GUI/ConfigWizard.cpp | 4 ++-- src/slic3r/GUI/FirmwareDialog.cpp | 12 +++++----- src/slic3r/GUI/GUI_ObjectList.cpp | 18 +++++++------- src/slic3r/GUI/MainFrame.cpp | 16 ++++++------- src/slic3r/GUI/Mouse3DController.cpp | 2 +- src/slic3r/GUI/ObjectDataViewModel.cpp | 2 +- src/slic3r/GUI/OptionsGroup.cpp | 20 ++++++++-------- src/slic3r/GUI/PhysicalPrinterDialog.cpp | 10 ++++---- src/slic3r/GUI/Plater.cpp | 12 +++++----- src/slic3r/GUI/PresetComboBoxes.cpp | 8 +++---- src/slic3r/GUI/Tab.cpp | 30 +++++++++++++----------- src/slic3r/GUI/Tab.hpp | 1 - src/slic3r/Utils/Bonjour.cpp | 2 +- src/slic3r/Utils/Http.cpp | 2 +- src/slic3r/Utils/PresetUpdater.cpp | 8 +++---- 23 files changed, 90 insertions(+), 88 deletions(-) diff --git a/src/libslic3r/AppConfig.cpp b/src/libslic3r/AppConfig.cpp index 7c940338220..4b3d33a549d 100644 --- a/src/libslic3r/AppConfig.cpp +++ b/src/libslic3r/AppConfig.cpp @@ -266,14 +266,14 @@ void AppConfig::save() else c << "# " << Slic3r::header_gcodeviewer_generated() << std::endl; // Make sure the "no" category is written first. - for (const std::pair &kvp : m_storage[""]) + for (const auto& kvp : m_storage[""]) c << kvp.first << " = " << kvp.second << std::endl; // Write the other categories. - for (const auto category : m_storage) { + for (const auto& category : m_storage) { if (category.first.empty()) continue; c << std::endl << "[" << category.first << "]" << std::endl; - for (const std::pair &kvp : category.second) + for (const auto& kvp : category.second) c << kvp.first << " = " << kvp.second << std::endl; } // Write vendor sections diff --git a/src/libslic3r/Config.hpp b/src/libslic3r/Config.hpp index 0b91648da29..4b726bea9ec 100644 --- a/src/libslic3r/Config.hpp +++ b/src/libslic3r/Config.hpp @@ -1344,7 +1344,7 @@ class ConfigOptionEnum : public ConfigOptionSingle static bool has(T value) { - for (const std::pair &kvp : ConfigOptionEnum::get_enum_values()) + for (const auto &kvp : ConfigOptionEnum::get_enum_values()) if (kvp.second == value) return true; return false; diff --git a/src/libslic3r/GCode/WipeTower.cpp b/src/libslic3r/GCode/WipeTower.cpp index 0f72dc415d7..e39b8191914 100644 --- a/src/libslic3r/GCode/WipeTower.cpp +++ b/src/libslic3r/GCode/WipeTower.cpp @@ -405,7 +405,7 @@ class WipeTowerWriter WipeTowerWriter& append(const std::string& text) { m_gcode += text; return *this; } - std::vector wipe_path() const + const std::vector& wipe_path() const { return m_wipe_path; } diff --git a/src/libslic3r/LayerRegion.cpp b/src/libslic3r/LayerRegion.cpp index b3383fcc5a1..3763f2498b4 100644 --- a/src/libslic3r/LayerRegion.cpp +++ b/src/libslic3r/LayerRegion.cpp @@ -290,7 +290,7 @@ void LayerRegion::process_external_surfaces(const Layer *lower_layer, const Poly surfaces_append(bottom, union_ex(grown, true), bridges[idx_last]); } - fill_boundaries = std::move(to_polygons(fill_boundaries_ex)); + fill_boundaries = to_polygons(fill_boundaries_ex); BOOST_LOG_TRIVIAL(trace) << "Processing external surface, detecting bridges - done"; } @@ -327,7 +327,7 @@ void LayerRegion::process_external_surfaces(const Layer *lower_layer, const Poly surfaces_append( new_surfaces, // Don't use a safety offset as fill_boundaries were already united using the safety offset. - std::move(intersection_ex(polys, fill_boundaries, false)), + intersection_ex(polys, fill_boundaries, false), s1); } } @@ -424,7 +424,7 @@ void LayerRegion::elephant_foot_compensation_step(const float elephant_foot_comp Polygons slices_polygons = to_polygons(slices_expolygons); Polygons tmp = intersection(slices_polygons, trimming_polygons, false); append(tmp, diff(slices_polygons, offset(offset_ex(slices_expolygons, -elephant_foot_compensation_perimeter_step), elephant_foot_compensation_perimeter_step))); - this->slices.set(std::move(union_ex(tmp)), stInternal); + this->slices.set(union_ex(tmp), stInternal); } void LayerRegion::export_region_slices_to_svg(const char *path) const diff --git a/src/libslic3r/TriangleMesh.hpp b/src/libslic3r/TriangleMesh.hpp index 71cd231c3f0..9625298f4ef 100644 --- a/src/libslic3r/TriangleMesh.hpp +++ b/src/libslic3r/TriangleMesh.hpp @@ -103,7 +103,7 @@ enum FacetEdgeType { class IntersectionReference { public: - IntersectionReference() : point_id(-1), edge_id(-1) {}; + IntersectionReference() : point_id(-1), edge_id(-1) {} IntersectionReference(int point_id, int edge_id) : point_id(point_id), edge_id(edge_id) {} // Where is this intersection point located? On mesh vertex or mesh edge? // Only one of the following will be set, the other will remain set to -1. @@ -116,7 +116,7 @@ class IntersectionReference class IntersectionPoint : public Point, public IntersectionReference { public: - IntersectionPoint() {}; + IntersectionPoint() {} IntersectionPoint(int point_id, int edge_id, const Point &pt) : IntersectionReference(point_id, edge_id), Point(pt) {} IntersectionPoint(const IntersectionReference &ir, const Point &pt) : IntersectionReference(ir), Point(pt) {} // Inherits coord_t x, y diff --git a/src/slic3r/Config/Snapshot.cpp b/src/slic3r/Config/Snapshot.cpp index 900172d3eb6..ecfc32b58fb 100644 --- a/src/slic3r/Config/Snapshot.cpp +++ b/src/slic3r/Config/Snapshot.cpp @@ -251,7 +251,7 @@ bool Snapshot::equal_to_active(const AppConfig &app_config) const return false; matched.insert(vc.name); } - for (const std::pair>> &v : app_config.vendors()) + for (const auto &v : app_config.vendors()) if (matched.find(v.first) == matched.end() && ! v.second.empty()) // There are more vendors currently installed than enabled in the snapshot. return false; @@ -402,7 +402,7 @@ const Snapshot& SnapshotDB::take_snapshot(const AppConfig &app_config, Snapshot: snapshot.filaments.emplace_back(app_config.get("presets", name)); } // Vendor specific config bundles and installed printers. - for (const std::pair>> &vendor : app_config.vendors()) { + for (const auto &vendor : app_config.vendors()) { Snapshot::VendorConfig cfg; cfg.name = vendor.first; cfg.models_variants_installed = vendor.second; diff --git a/src/slic3r/GUI/BonjourDialog.cpp b/src/slic3r/GUI/BonjourDialog.cpp index 51f18dce720..65d5524c2db 100644 --- a/src/slic3r/GUI/BonjourDialog.cpp +++ b/src/slic3r/GUI/BonjourDialog.cpp @@ -119,7 +119,7 @@ bool BonjourDialog::show_and_lookup() // Note: More can be done here when we support discovery of hosts other than Octoprint and SL1 Bonjour::TxtKeys txt_keys { "version", "model" }; - bonjour = std::move(Bonjour("octoprint") + bonjour = Bonjour("octoprint") .set_txt_keys(std::move(txt_keys)) .set_retries(3) .set_timeout(4) @@ -139,8 +139,7 @@ bool BonjourDialog::show_and_lookup() wxQueueEvent(dialog, evt); } }) - .lookup() - ); + .lookup(); bool res = ShowModal() == wxID_OK && list->GetFirstSelected() >= 0; { diff --git a/src/slic3r/GUI/ConfigSnapshotDialog.cpp b/src/slic3r/GUI/ConfigSnapshotDialog.cpp index 487604b1c0e..9f996d378bd 100644 --- a/src/slic3r/GUI/ConfigSnapshotDialog.cpp +++ b/src/slic3r/GUI/ConfigSnapshotDialog.cpp @@ -68,7 +68,7 @@ static wxString generate_html_row(const Config::Snapshot &snapshot, bool row_eve if (vc.version.max_slic3r_version != Semver::inf()) text += ", " + _(L("max PrusaSlicer version")) + ": " + vc.version.max_slic3r_version.to_string(); text += "
"; - for (const std::pair> &model : vc.models_variants_installed) { + for (const auto& model : vc.models_variants_installed) { text += _(L("model")) + ": " + model.first + ", " + _(L("variants")) + ": "; for (const std::string &variant : model.second) { if (&variant != &*model.second.begin()) diff --git a/src/slic3r/GUI/ConfigWizard.cpp b/src/slic3r/GUI/ConfigWizard.cpp index 568c15a1654..047a0046f40 100644 --- a/src/slic3r/GUI/ConfigWizard.cpp +++ b/src/slic3r/GUI/ConfigWizard.cpp @@ -1872,7 +1872,7 @@ void ConfigWizard::priv::load_vendors() std::map section_new; if (app_config->has_section(section_name)) { const std::map §ion_old = app_config->get_section(section_name); - for (const std::pair &material_name_and_installed : section_old) + for (const auto& material_name_and_installed : section_old) if (material_name_and_installed.second == "1") { // Material is installed. Resolve it in bundles. size_t num_found = 0; @@ -2248,7 +2248,7 @@ bool ConfigWizard::priv::check_and_install_missing_materials(Technology technolo if ((only_for_model_id.empty() || only_for_model_id == printer_model->id) && printer_models_without_material.find(printer_model) == printer_models_without_material.end()) { bool has_material = false; - for (const std::pair &preset : appconfig_presets) { + for (const auto& preset : appconfig_presets) { if (preset.second == "1") { const Preset *material = materials.find_preset(preset.first, false); if (material != nullptr && is_compatible_with_printer(PresetWithVendorProfile(*material, nullptr), PresetWithVendorProfile(printer, nullptr))) { diff --git a/src/slic3r/GUI/FirmwareDialog.cpp b/src/slic3r/GUI/FirmwareDialog.cpp index 879e7fe34ef..046d9d1386f 100644 --- a/src/slic3r/GUI/FirmwareDialog.cpp +++ b/src/slic3r/GUI/FirmwareDialog.cpp @@ -648,7 +648,7 @@ void FirmwareDialog::priv::perform_upload() } } }) - .on_message(std::move([q, extra_verbose](const char *msg, unsigned /* size */) { + .on_message([q, extra_verbose](const char *msg, unsigned /* size */) { if (extra_verbose) { BOOST_LOG_TRIVIAL(debug) << "avrdude: " << msg; } @@ -665,19 +665,19 @@ void FirmwareDialog::priv::perform_upload() evt->SetExtraLong(AE_MESSAGE); evt->SetString(std::move(wxmsg)); wxQueueEvent(q, evt); - })) - .on_progress(std::move([q](const char * /* task */, unsigned progress) { + }) + .on_progress([q](const char * /* task */, unsigned progress) { auto evt = new wxCommandEvent(EVT_AVRDUDE, q->GetId()); evt->SetExtraLong(AE_PROGRESS); evt->SetInt(progress); wxQueueEvent(q, evt); - })) - .on_complete(std::move([this]() { + }) + .on_complete([this]() { auto evt = new wxCommandEvent(EVT_AVRDUDE, this->q->GetId()); evt->SetExtraLong(AE_EXIT); evt->SetInt(this->avrdude->exit_code()); wxQueueEvent(this->q, evt); - })) + }) .run(); } diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 94e55ce5c45..87bc1090fcc 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -117,7 +117,9 @@ ObjectList::ObjectList(wxWindow* parent) : // detect the current mouse position here, to pass it to list_manipulation() method // if we detect it later, the user may have moved the mouse pointer while calculations are performed, and this would mess-up the HitTest() call performed into list_manipulation() // see: https://github.com/prusa3d/PrusaSlicer/issues/3802 +#ifndef __WXOSX__ const wxPoint mouse_pos = this->get_mouse_position_in_control(); +#endif #ifndef __APPLE__ // On Windows and Linux, forces a kill focus emulation on the object manipulator fields because this event handler is called @@ -752,7 +754,7 @@ void ObjectList::copy_layers_to_clipboard() return; } - for (const auto layer_item : sel_layers) + for (const auto& layer_item : sel_layers) if (m_objects_model->GetItemType(layer_item) & itLayer) { auto range = m_objects_model->GetLayerRangeByItem(layer_item); auto it = ranges.find(range); @@ -778,7 +780,7 @@ void ObjectList::paste_layers_into_list() t_layer_config_ranges& ranges = object(obj_idx)->layer_config_ranges; // and create Layer item(s) according to the layer_config_ranges - for (const auto range : cache_ranges) + for (const auto& range : cache_ranges) ranges.emplace(range); layers_item = add_layer_root_item(object_item); @@ -1842,7 +1844,7 @@ void ObjectList::append_menu_item_export_stl(wxMenu* menu) const void ObjectList::append_menu_item_reload_from_disk(wxMenu* menu) const { append_menu_item(menu, wxID_ANY, _(L("Reload from disk")), _(L("Reload the selected volumes from disk")), - [this](wxCommandEvent&) { wxGetApp().plater()->reload_from_disk(); }, "", menu, + [](wxCommandEvent&) { wxGetApp().plater()->reload_from_disk(); }, "", menu, []() { return wxGetApp().plater()->can_reload_from_disk(); }, wxGetApp().plater()); } @@ -2063,9 +2065,9 @@ wxMenu* ObjectList::create_settings_popupmenu(wxMenu *parent_menu) for (auto cat : settings_menu) { append_menu_item(menu, wxID_ANY, _(cat.first), "", - [menu, this](wxCommandEvent& event) { get_settings_choice(menu->GetLabel(event.GetId())); }, + [this, menu](wxCommandEvent& event) { get_settings_choice(menu->GetLabel(event.GetId())); }, CATEGORY_ICON.find(cat.first) == CATEGORY_ICON.end() ? wxNullBitmap : CATEGORY_ICON.at(cat.first), parent_menu, - [this]() { return true; }, wxGetApp().plater()); + []() { return true; }, wxGetApp().plater()); } return menu; @@ -2084,9 +2086,9 @@ void ObjectList::create_freq_settings_popupmenu(wxMenu *menu, const bool is_obje continue; append_menu_item(menu, wxID_ANY, _(it.first), "", - [menu, this](wxCommandEvent& event) { get_freq_settings_choice(menu->GetLabel(event.GetId())); }, + [this, menu](wxCommandEvent& event) { get_freq_settings_choice(menu->GetLabel(event.GetId())); }, CATEGORY_ICON.find(it.first) == CATEGORY_ICON.end() ? wxNullBitmap : CATEGORY_ICON.at(it.first), menu, - [this]() { return true; }, wxGetApp().plater()); + []() { return true; }, wxGetApp().plater()); } #if 0 // Add "Quick" settings bundles @@ -4600,7 +4602,7 @@ void ObjectList::show_multi_selection_menu() append_menu_item_change_extruder(menu); append_menu_item(menu, wxID_ANY, _(L("Reload from disk")), _(L("Reload the selected volumes from disk")), - [this](wxCommandEvent&) { wxGetApp().plater()->reload_from_disk(); }, "", menu, []() { + [](wxCommandEvent&) { wxGetApp().plater()->reload_from_disk(); }, "", menu, []() { return wxGetApp().plater()->can_reload_from_disk(); }, wxGetApp().plater()); diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 9c30ac330c5..3fccb7f8438 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -64,10 +64,10 @@ class PrusaSlicerTaskBarIcon : public wxTaskBarIcon // Only allow opening a new PrusaSlicer instance on OSX if "single_instance" is disabled, // as starting new instances would interfere with the locking mechanism of "single_instance" support. append_menu_item(menu, wxID_ANY, _L("Open new instance"), _L("Open a new PrusaSlicer instance"), - [this](wxCommandEvent&) { start_new_slicer(); }, "", nullptr); + [](wxCommandEvent&) { start_new_slicer(); }, "", nullptr); } append_menu_item(menu, wxID_ANY, _L("G-code preview") + dots, _L("Open G-code viewer"), - [this](wxCommandEvent&) { start_new_gcodeviewer_open_file(); }, "", nullptr); + [](wxCommandEvent&) { start_new_gcodeviewer_open_file(); }, "", nullptr); return menu; } }; @@ -78,9 +78,9 @@ class GCodeViewerTaskBarIcon : public wxTaskBarIcon wxMenu *CreatePopupMenu() override { wxMenu *menu = new wxMenu; append_menu_item(menu, wxID_ANY, _L("Open PrusaSlicer"), _L("Open a new PrusaSlicer instance"), - [this](wxCommandEvent&) { start_new_slicer(nullptr, true); }, "", nullptr); + [](wxCommandEvent&) { start_new_slicer(nullptr, true); }, "", nullptr); append_menu_item(menu, wxID_ANY, _L("G-code preview") + dots, _L("Open new G-code viewer"), - [this](wxCommandEvent&) { start_new_gcodeviewer_open_file(); }, "", nullptr); + [](wxCommandEvent&) { start_new_gcodeviewer_open_file(); }, "", nullptr); return menu; } }; @@ -231,7 +231,7 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S // So, redraw explicitly canvas, when application is moved //FIXME maybe this is useful for __WXGTK3__ as well? #if __APPLE__ - Bind(wxEVT_MOVE, [this](wxMoveEvent& event) { + Bind(wxEVT_MOVE, [](wxMoveEvent& event) { wxGetApp().plater()->get_current_canvas3D()->set_as_dirty(); wxGetApp().plater()->get_current_canvas3D()->request_extra_frame(); event.Skip(); @@ -1190,7 +1190,7 @@ void MainFrame::init_menubar_as_editor() windowMenu->AppendSeparator(); append_menu_item(windowMenu, wxID_ANY, _L("Open new instance") + "\tCtrl+Shift+I", _L("Open a new PrusaSlicer instance"), - [this](wxCommandEvent&) { start_new_slicer(); }, "", nullptr, [this]() {return m_plater != nullptr && wxGetApp().app_config->get("single_instance") != "1"; }, this); + [](wxCommandEvent&) { start_new_slicer(); }, "", nullptr, [this]() {return m_plater != nullptr && wxGetApp().app_config->get("single_instance") != "1"; }, this); windowMenu->AppendSeparator(); append_menu_item(windowMenu, wxID_ANY, _L("Compare presets")/* + "\tCtrl+F"*/, _L("Compare presets"), @@ -1263,8 +1263,8 @@ void MainFrame::init_menubar_as_gcodeviewer() [this](wxCommandEvent&) { if (m_plater != nullptr) m_plater->export_toolpaths_to_obj(); }, "export_plater", nullptr, [this]() {return can_export_toolpaths(); }, this); append_menu_item(fileMenu, wxID_ANY, _L("Open &PrusaSlicer") + dots, _L("Open PrusaSlicer"), - [this](wxCommandEvent&) { start_new_slicer(); }, "", nullptr, - [this]() {return true; }, this); + [](wxCommandEvent&) { start_new_slicer(); }, "", nullptr, + []() {return true; }, this); fileMenu->AppendSeparator(); append_menu_item(fileMenu, wxID_EXIT, _L("&Quit"), wxString::Format(_L("Quit %s"), SLIC3R_APP_NAME), [this](wxCommandEvent&) { Close(false); }); diff --git a/src/slic3r/GUI/Mouse3DController.cpp b/src/slic3r/GUI/Mouse3DController.cpp index 692ae7f1bab..9ff5688be25 100644 --- a/src/slic3r/GUI/Mouse3DController.cpp +++ b/src/slic3r/GUI/Mouse3DController.cpp @@ -397,7 +397,7 @@ void Mouse3DController::save_config(AppConfig &appconfig) const // We do not synchronize m_params_by_device with the background thread explicitely // as there should be a full memory barrier executed once the background thread is stopped. - for (const std::pair &key_value_pair : m_params_by_device) { + for (const auto &key_value_pair : m_params_by_device) { const std::string &device_name = key_value_pair.first; const Params ¶ms = key_value_pair.second; // Store current device parameters into the config diff --git a/src/slic3r/GUI/ObjectDataViewModel.cpp b/src/slic3r/GUI/ObjectDataViewModel.cpp index ef65f59748f..d69f2d07739 100644 --- a/src/slic3r/GUI/ObjectDataViewModel.cpp +++ b/src/slic3r/GUI/ObjectDataViewModel.cpp @@ -1362,7 +1362,7 @@ void ObjectDataViewModel::GetAllChildren(const wxDataViewItem &parent, wxDataVie } wxDataViewItemArray new_array = array; - for (const auto item : new_array) + for (const auto& item : new_array) { wxDataViewItemArray children; GetAllChildren(item, children); diff --git a/src/slic3r/GUI/OptionsGroup.cpp b/src/slic3r/GUI/OptionsGroup.cpp index dafce5efc65..953275be7e9 100644 --- a/src/slic3r/GUI/OptionsGroup.cpp +++ b/src/slic3r/GUI/OptionsGroup.cpp @@ -27,20 +27,20 @@ const t_field& OptionsGroup::build_field(const t_config_option_key& id, const Co // is the normal type. if (opt.gui_type == "select") { } else if (opt.gui_type == "select_open") { - m_fields.emplace(id, std::move(Choice::Create(this->ctrl_parent(), opt, id))); + m_fields.emplace(id, Choice::Create(this->ctrl_parent(), opt, id)); } else if (opt.gui_type == "color") { - m_fields.emplace(id, std::move(ColourPicker::Create(this->ctrl_parent(), opt, id))); + m_fields.emplace(id, ColourPicker::Create(this->ctrl_parent(), opt, id)); } else if (opt.gui_type == "f_enum_open" || opt.gui_type == "i_enum_open" || opt.gui_type == "i_enum_closed") { - m_fields.emplace(id, std::move(Choice::Create(this->ctrl_parent(), opt, id))); + m_fields.emplace(id, Choice::Create(this->ctrl_parent(), opt, id)); } else if (opt.gui_type == "slider") { - m_fields.emplace(id, std::move(SliderCtrl::Create(this->ctrl_parent(), opt, id))); + m_fields.emplace(id, SliderCtrl::Create(this->ctrl_parent(), opt, id)); } else if (opt.gui_type == "i_spin") { // Spinctrl } else if (opt.gui_type == "legend") { // StaticText - m_fields.emplace(id, std::move(StaticText::Create(this->ctrl_parent(), opt, id))); + m_fields.emplace(id, StaticText::Create(this->ctrl_parent(), opt, id)); } else if (opt.gui_type == "one_string") { - m_fields.emplace(id, std::move(TextCtrl::Create(this->ctrl_parent(), opt, id))); + m_fields.emplace(id, TextCtrl::Create(this->ctrl_parent(), opt, id)); } else { switch (opt.type) { case coFloatOrPercent: @@ -50,18 +50,18 @@ const t_field& OptionsGroup::build_field(const t_config_option_key& id, const Co case coPercents: case coString: case coStrings: - m_fields.emplace(id, std::move(TextCtrl::Create(this->ctrl_parent(), opt, id))); + m_fields.emplace(id, TextCtrl::Create(this->ctrl_parent(), opt, id)); break; case coBool: case coBools: - m_fields.emplace(id, std::move(CheckBox::Create(this->ctrl_parent(), opt, id))); + m_fields.emplace(id, CheckBox::Create(this->ctrl_parent(), opt, id)); break; case coInt: case coInts: - m_fields.emplace(id, std::move(SpinCtrl::Create(this->ctrl_parent(), opt, id))); + m_fields.emplace(id, SpinCtrl::Create(this->ctrl_parent(), opt, id)); break; case coEnum: - m_fields.emplace(id, std::move(Choice::Create(this->ctrl_parent(), opt, id))); + m_fields.emplace(id, Choice::Create(this->ctrl_parent(), opt, id)); break; case coPoints: m_fields.emplace(id, std::move(PointCtrl::Create(this->ctrl_parent(), opt, id))); diff --git a/src/slic3r/GUI/PhysicalPrinterDialog.cpp b/src/slic3r/GUI/PhysicalPrinterDialog.cpp index b80d8514ff7..8b16575ba85 100644 --- a/src/slic3r/GUI/PhysicalPrinterDialog.cpp +++ b/src/slic3r/GUI/PhysicalPrinterDialog.cpp @@ -275,7 +275,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr m_optgroup->append_single_option_line("host_type"); - auto create_sizer_with_btn = [this](wxWindow* parent, ScalableButton** btn, const std::string& icon_name, const wxString& label) { + auto create_sizer_with_btn = [](wxWindow* parent, ScalableButton** btn, const std::string& icon_name, const wxString& label) { *btn = new ScalableButton(parent, wxID_ANY, icon_name, label, wxDefaultSize, wxDefaultPosition, wxBU_LEFT | wxBU_EXACTFIT); (*btn)->SetFont(wxGetApp().normal_font()); @@ -290,7 +290,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr m_printhost_browse_btn->Bind(wxEVT_BUTTON, [=](wxCommandEvent& e) { BonjourDialog dialog(this, Preset::printer_technology(m_printer.config)); if (dialog.show_and_lookup()) { - m_optgroup->set_value("print_host", std::move(dialog.get_selected()), true); + m_optgroup->set_value("print_host", dialog.get_selected(), true); m_optgroup->get_field("print_host")->field_changed(); } }); @@ -366,7 +366,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr static const auto filemasks = _L("Certificate files (*.crt, *.pem)|*.crt;*.pem|All files|*.*"); wxFileDialog openFileDialog(this, _L("Open CA certificate file"), "", "", filemasks, wxFD_OPEN | wxFD_FILE_MUST_EXIST); if (openFileDialog.ShowModal() != wxID_CANCEL) { - m_optgroup->set_value("printhost_cafile", std::move(openFileDialog.GetPath()), true); + m_optgroup->set_value("printhost_cafile", openFileDialog.GetPath(), true); m_optgroup->get_field("printhost_cafile")->field_changed(); } }); @@ -379,7 +379,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr Line cafile_hint{ "", "" }; cafile_hint.full_width = 1; - cafile_hint.widget = [this, ca_file_hint](wxWindow* parent) { + cafile_hint.widget = [ca_file_hint](wxWindow* parent) { auto txt = new wxStaticText(parent, wxID_ANY, ca_file_hint); auto sizer = new wxBoxSizer(wxHORIZONTAL); sizer->Add(txt); @@ -420,7 +420,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr { wxTextCtrl* temp = dynamic_cast(printhost_field->getWindow()); if (temp) - temp->Bind(wxEVT_TEXT, ([this, printhost_field, temp](wxEvent& e) + temp->Bind(wxEVT_TEXT, ([printhost_field, temp](wxEvent& e) { #ifndef __WXGTK__ e.Skip(); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 3722c55455f..8ca335fa869 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -274,7 +274,7 @@ class FreqChangedParams : public OG_Settings wxButton* get_wiping_dialog_button() { return m_wiping_dialog_button; } wxSizer* get_sizer() override; ConfigOptionsGroup* get_og(const bool is_fff); - void Show(const bool is_fff); + void Show(const bool is_fff) override; void msw_rescale(); }; @@ -2065,7 +2065,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) view3D_canvas->Bind(EVT_GLCANVAS_UPDATE_BED_SHAPE, [q](SimpleEvent&) { q->set_bed_shape(); }); // Preview events: - preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_QUESTION_MARK, [this](SimpleEvent&) { wxGetApp().keyboard_shortcuts(); }); + preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_QUESTION_MARK, [](SimpleEvent&) { wxGetApp().keyboard_shortcuts(); }); preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_UPDATE_BED_SHAPE, [q](SimpleEvent&) { q->set_bed_shape(); }); if (wxGetApp().is_editor()) { preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_TAB, [this](SimpleEvent&) { select_next_view_3D(); }); @@ -2127,8 +2127,8 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) if (wxGetApp().is_editor()) { this->q->Bind(EVT_EJECT_DRIVE_NOTIFICAION_CLICKED, [this](EjectDriveNotificationClickedEvent&) { this->q->eject_drive(); }); this->q->Bind(EVT_EXPORT_GCODE_NOTIFICAION_CLICKED, [this](ExportGcodeNotificationClickedEvent&) { this->q->export_gcode(true); }); - this->q->Bind(EVT_PRESET_UPDATE_AVAILABLE_CLICKED, [this](PresetUpdateAvailableClickedEvent&) { wxGetApp().get_preset_updater()->on_update_notification_confirm(); }); - this->q->Bind(EVT_REMOVABLE_DRIVE_EJECTED, [this, q](RemovableDriveEjectEvent &evt) { + this->q->Bind(EVT_PRESET_UPDATE_AVAILABLE_CLICKED, [](PresetUpdateAvailableClickedEvent&) { wxGetApp().get_preset_updater()->on_update_notification_confirm(); }); + this->q->Bind(EVT_REMOVABLE_DRIVE_EJECTED, [this](RemovableDriveEjectEvent &evt) { if (evt.data.second) { this->show_action_buttons(this->ready_to_slice); notification_manager->close_notification_of_type(NotificationType::ExportFinished); @@ -2143,7 +2143,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) ); } }); - this->q->Bind(EVT_REMOVABLE_DRIVES_CHANGED, [this, q](RemovableDrivesChangedEvent &) { + this->q->Bind(EVT_REMOVABLE_DRIVES_CHANGED, [this](RemovableDrivesChangedEvent &) { this->show_action_buttons(this->ready_to_slice); // Close notification ExportingFinished but only if last export was to removable notification_manager->device_ejected(); @@ -4963,7 +4963,7 @@ ProjectDropDialog::ProjectDropDialog(const std::string& filename) wxBoxSizer* bottom_sizer = new wxBoxSizer(wxHORIZONTAL); wxCheckBox* check = new wxCheckBox(this, wxID_ANY, _L("Don't show again")); - check->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent& evt) { + check->Bind(wxEVT_CHECKBOX, [](wxCommandEvent& evt) { wxGetApp().app_config->set("show_drop_project_dialog", evt.IsChecked() ? "0" : "1"); }); diff --git a/src/slic3r/GUI/PresetComboBoxes.cpp b/src/slic3r/GUI/PresetComboBoxes.cpp index 86c643c049f..569cb9a2936 100644 --- a/src/slic3r/GUI/PresetComboBoxes.cpp +++ b/src/slic3r/GUI/PresetComboBoxes.cpp @@ -738,7 +738,7 @@ void PlaterPresetComboBox::show_add_menu() wxMenu* menu = new wxMenu(); append_menu_item(menu, wxID_ANY, _L("Add/Remove presets"), "", - [this](wxCommandEvent&) { + [](wxCommandEvent&) { wxTheApp->CallAfter([]() { wxGetApp().run_wizard(ConfigWizard::RR_USER, ConfigWizard::SP_PRINTERS); }); }, "edit_uni", menu, []() { return true; }, wxGetApp().plater()); @@ -768,7 +768,7 @@ void PlaterPresetComboBox::show_edit_menu() } else append_menu_item(menu, wxID_ANY, _L("Add/Remove presets"), "", - [this](wxCommandEvent&) { + [](wxCommandEvent&) { wxTheApp->CallAfter([]() { wxGetApp().run_wizard(ConfigWizard::RR_USER, ConfigWizard::SP_PRINTERS); }); }, "edit_uni", menu, []() { return true; }, wxGetApp().plater()); @@ -893,7 +893,7 @@ void PlaterPresetComboBox::update() const PhysicalPrinterCollection& ph_printers = m_preset_bundle->physical_printers; for (PhysicalPrinterCollection::ConstIterator it = ph_printers.begin(); it != ph_printers.end(); ++it) { - for (const std::string preset_name : it->get_preset_names()) { + for (const std::string& preset_name : it->get_preset_names()) { Preset* preset = m_collection->find_preset(preset_name); if (!preset) continue; @@ -1078,7 +1078,7 @@ void TabPresetComboBox::update() const PhysicalPrinterCollection& ph_printers = m_preset_bundle->physical_printers; for (PhysicalPrinterCollection::ConstIterator it = ph_printers.begin(); it != ph_printers.end(); ++it) { - for (const std::string preset_name : it->get_preset_names()) { + for (const std::string& preset_name : it->get_preset_names()) { Preset* preset = m_collection->find_preset(preset_name); if (!preset) continue; diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 00e386c1d01..6f371d17521 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -121,7 +121,7 @@ Tab::Tab(wxNotebook* parent, const wxString& title, Preset::Type type) : m_config_manipulation = get_config_manipulation(); - Bind(wxEVT_SIZE, ([this](wxSizeEvent &evt) { + Bind(wxEVT_SIZE, ([](wxSizeEvent &evt) { //for (auto page : m_pages) // if (! page.get()->IsShown()) // page->layout_valid = false; @@ -242,7 +242,7 @@ void Tab::create_preset_tab() if (dlg.ShowModal() == wxID_OK) wxGetApp().update_label_colours(); }); - m_search_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent) { wxGetApp().plater()->search(false); }); + m_search_btn->Bind(wxEVT_BUTTON, [](wxCommandEvent) { wxGetApp().plater()->search(false); }); // Colors for ui "decoration" m_sys_label_clr = wxGetApp().get_label_clr_sys(); @@ -491,7 +491,7 @@ void Tab::update_label_colours() m_modified_label_clr = wxGetApp().get_label_clr_modified(); //update options "decoration" - for (const auto opt : m_options_list) + for (const auto& opt : m_options_list) { const wxColour *color = &m_sys_label_clr; @@ -541,7 +541,7 @@ void Tab::update_label_colours() void Tab::decorate() { - for (const auto opt : m_options_list) + for (const auto& opt : m_options_list) { Field* field = nullptr; wxColour* colored_label_clr = nullptr; @@ -639,7 +639,7 @@ void Tab::init_options_list() if (!m_options_list.empty()) m_options_list.clear(); - for (const auto opt_key : m_config->keys()) + for (const std::string& opt_key : m_config->keys()) m_options_list.emplace(opt_key, m_opt_status_value); } @@ -656,7 +656,7 @@ void TabPrinter::init_options_list() if (!m_options_list.empty()) m_options_list.clear(); - for (const auto opt_key : m_config->keys()) + for (const std::string& opt_key : m_config->keys()) { if (opt_key == "bed_shape" || opt_key == "thumbnails") { m_options_list.emplace(opt_key, m_opt_status_value); @@ -709,7 +709,7 @@ void TabSLAMaterial::init_options_list() if (!m_options_list.empty()) m_options_list.clear(); - for (const auto opt_key : m_config->keys()) + for (const std::string& opt_key : m_config->keys()) { if (opt_key == "compatible_prints" || opt_key == "compatible_printers") { m_options_list.emplace(opt_key, m_opt_status_value); @@ -1728,7 +1728,7 @@ void TabFilament::add_filament_overrides_page() line.near_label_widget = [this, optgroup, opt_key, opt_index](wxWindow* parent) { wxCheckBox* check_box = new wxCheckBox(parent, wxID_ANY, ""); - check_box->Bind(wxEVT_CHECKBOX, [this, optgroup, opt_key, opt_index](wxCommandEvent& evt) { + check_box->Bind(wxEVT_CHECKBOX, [optgroup, opt_key, opt_index](wxCommandEvent& evt) { const bool is_checked = evt.IsChecked(); Field* field = optgroup->get_fieldc(opt_key, opt_index); if (field != nullptr) { @@ -3352,7 +3352,9 @@ bool Tab::tree_sel_change_delayed() wxCheckForInterrupt(m_treectrl); if (m_page_switch_planned) throw UIBuildCanceled(); -#endif // WIN32 +#else // WIN32 + (void)this; // silence warning +#endif }); try { @@ -3924,7 +3926,7 @@ ConfigOptionsGroupShp Page::new_optgroup(const wxString& title, int noncommon_la #else auto tab = parent()->GetParent();// GetParent(); #endif - optgroup->m_on_change = [this, tab](t_config_option_key opt_key, boost::any value) { + optgroup->m_on_change = [tab](t_config_option_key opt_key, boost::any value) { //! This function will be called from OptionGroup. //! Using of CallAfter is redundant. //! And in some cases it causes update() function to be recalled again @@ -3934,21 +3936,21 @@ ConfigOptionsGroupShp Page::new_optgroup(const wxString& title, int noncommon_la //! }); }; - optgroup->m_get_initial_config = [this, tab]() { + optgroup->m_get_initial_config = [tab]() { DynamicPrintConfig config = static_cast(tab)->m_presets->get_selected_preset().config; return config; }; - optgroup->m_get_sys_config = [this, tab]() { + optgroup->m_get_sys_config = [tab]() { DynamicPrintConfig config = static_cast(tab)->m_presets->get_selected_preset_parent()->config; return config; }; - optgroup->have_sys_config = [this, tab]() { + optgroup->have_sys_config = [tab]() { return static_cast(tab)->m_presets->get_selected_preset_parent() != nullptr; }; - optgroup->rescale_extra_column_item = [this](wxWindow* win) { + optgroup->rescale_extra_column_item = [](wxWindow* win) { auto *ctrl = dynamic_cast(win); if (ctrl == nullptr) return; diff --git a/src/slic3r/GUI/Tab.hpp b/src/slic3r/GUI/Tab.hpp index 0358fd3150f..d341b7360cf 100644 --- a/src/slic3r/GUI/Tab.hpp +++ b/src/slic3r/GUI/Tab.hpp @@ -383,7 +383,6 @@ class TabPrint : public Tab private: ogStaticText* m_recommended_thin_wall_thickness_description_line = nullptr; ogStaticText* m_top_bottom_shell_thickness_explanation = nullptr; - bool m_support_material_overhangs_queried = false; }; class TabFilament : public Tab diff --git a/src/slic3r/Utils/Bonjour.cpp b/src/slic3r/Utils/Bonjour.cpp index 28b3b2228a8..f121e6e87ab 100644 --- a/src/slic3r/Utils/Bonjour.cpp +++ b/src/slic3r/Utils/Bonjour.cpp @@ -226,7 +226,7 @@ struct DnsResource } dataoffset = offset; - res.data = std::move(std::vector(buffer.begin() + offset, buffer.begin() + offset + rdlength)); + res.data = std::vector(buffer.begin() + offset, buffer.begin() + offset + rdlength); offset += rdlength; return std::move(res); diff --git a/src/slic3r/Utils/Http.cpp b/src/slic3r/Utils/Http.cpp index 94a8c9a56d5..2afb7ed5046 100644 --- a/src/slic3r/Utils/Http.cpp +++ b/src/slic3r/Utils/Http.cpp @@ -553,7 +553,7 @@ void Http::cancel() Http Http::get(std::string url) { - return std::move(Http{std::move(url)}); + return Http{std::move(url)}; } Http Http::post(std::string url) diff --git a/src/slic3r/Utils/PresetUpdater.cpp b/src/slic3r/Utils/PresetUpdater.cpp index 60dfe05c78e..f0310073fdd 100644 --- a/src/slic3r/Utils/PresetUpdater.cpp +++ b/src/slic3r/Utils/PresetUpdater.cpp @@ -206,7 +206,7 @@ bool PresetUpdater::priv::get_file(const std::string &url, const fs::path &targe tmp_path.string()); Http::get(url) - .on_progress([this](Http::Progress, bool &cancel) { + .on_progress([](Http::Progress, bool &cancel) { if (cancel) { cancel = true; } }) .on_error([&](std::string body, std::string error, unsigned http_status) { @@ -406,7 +406,7 @@ Updates PresetUpdater::priv::get_config_updates(const Semver &old_slic3r_version BOOST_LOG_TRIVIAL(info) << "Checking for cached configuration updates..."; // Over all indices from the cache directory: - for (const auto idx : index_db) { + for (const Index& idx : index_db) { auto bundle_path = vendor_path / (idx.vendor() + ".ini"); auto bundle_path_idx = vendor_path / idx.path().filename(); @@ -679,11 +679,11 @@ void PresetUpdater::sync(PresetBundle *preset_bundle) // into the closure (but perhaps the compiler can elide this). VendorMap vendors = preset_bundle->vendors; - p->thread = std::move(std::thread([this, vendors]() { + p->thread = std::thread([this, vendors]() { this->p->prune_tmps(); this->p->sync_version(); this->p->sync_config(std::move(vendors)); - })); + }); } void PresetUpdater::slic3r_update_notify() From b85de89751c5589b982eb928a49ac05e3242382e Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Fri, 29 Jan 2021 17:12:06 +0100 Subject: [PATCH 2/4] Fixing Clang warnings 2 --- src/libslic3r/AABBTreeIndirect.hpp | 2 +- src/libslic3r/Fill/FillRectilinear.hpp | 18 +++++------ src/libslic3r/Geometry.hpp | 2 +- src/libslic3r/MarchingSquares.hpp | 2 +- src/libslic3r/SLA/Concurrency.hpp | 2 +- src/libslic3r/SLAPrint.hpp | 2 +- src/libslic3r/SupportMaterial.cpp | 32 ++------------------ src/libslic3r/SupportMaterial.hpp | 2 +- src/slic3r/GUI/Camera.cpp | 9 ------ src/slic3r/GUI/Field.hpp | 18 +++++------ src/slic3r/GUI/GCodeViewer.cpp | 18 +++++------ src/slic3r/GUI/GLCanvas3D.hpp | 1 - src/slic3r/GUI/GUI.cpp | 4 +-- src/slic3r/GUI/Gizmos/GLGizmoCut.hpp | 22 +++++++------- src/slic3r/GUI/Gizmos/GLGizmoMove.hpp | 16 +++++----- src/slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp | 4 +-- src/slic3r/GUI/Gizmos/GLGizmoScale.hpp | 14 ++++----- src/slic3r/GUI/Gizmos/GLGizmosCommon.hpp | 2 +- src/slic3r/GUI/MainFrame.hpp | 2 +- src/slic3r/GUI/OptionsGroup.hpp | 1 - src/slic3r/Utils/OctoPrint.hpp | 2 +- src/slic3r/Utils/Repetier.hpp | 2 +- 22 files changed, 70 insertions(+), 107 deletions(-) diff --git a/src/libslic3r/AABBTreeIndirect.hpp b/src/libslic3r/AABBTreeIndirect.hpp index 87d1ee9dba4..70096b557bc 100644 --- a/src/libslic3r/AABBTreeIndirect.hpp +++ b/src/libslic3r/AABBTreeIndirect.hpp @@ -653,7 +653,7 @@ inline bool intersect_ray_all_hits( std::vector &hits) { auto ray_intersector = detail::RayIntersectorHits { - vertices, faces, tree, + vertices, faces, {tree}, origin, dir, VectorType(dir.cwiseInverse()) }; if (! tree.empty()) { diff --git a/src/libslic3r/Fill/FillRectilinear.hpp b/src/libslic3r/Fill/FillRectilinear.hpp index 0686fa166a5..692fba2bd1f 100644 --- a/src/libslic3r/Fill/FillRectilinear.hpp +++ b/src/libslic3r/Fill/FillRectilinear.hpp @@ -12,7 +12,7 @@ class Surface; class FillRectilinear : public Fill { public: - Fill* clone() const override { return new FillRectilinear(*this); }; + Fill* clone() const override { return new FillRectilinear(*this); } ~FillRectilinear() override = default; Polylines fill_surface(const Surface *surface, const FillParams ¶ms) override; @@ -32,18 +32,18 @@ class FillRectilinear : public Fill class FillAlignedRectilinear : public FillRectilinear { public: - Fill* clone() const override { return new FillAlignedRectilinear(*this); }; + Fill* clone() const override { return new FillAlignedRectilinear(*this); } ~FillAlignedRectilinear() override = default; protected: // Always generate infill at the same angle. - virtual float _layer_angle(size_t idx) const { return 0.f; } + virtual float _layer_angle(size_t idx) const override { return 0.f; } }; class FillMonotonic : public FillRectilinear { public: - Fill* clone() const override { return new FillMonotonic(*this); }; + Fill* clone() const override { return new FillMonotonic(*this); } ~FillMonotonic() override = default; Polylines fill_surface(const Surface *surface, const FillParams ¶ms) override; bool no_sort() const override { return true; } @@ -52,7 +52,7 @@ class FillMonotonic : public FillRectilinear class FillGrid : public FillRectilinear { public: - Fill* clone() const override { return new FillGrid(*this); }; + Fill* clone() const override { return new FillGrid(*this); } ~FillGrid() override = default; Polylines fill_surface(const Surface *surface, const FillParams ¶ms) override; @@ -64,7 +64,7 @@ class FillGrid : public FillRectilinear class FillTriangles : public FillRectilinear { public: - Fill* clone() const override { return new FillTriangles(*this); }; + Fill* clone() const override { return new FillTriangles(*this); } ~FillTriangles() override = default; Polylines fill_surface(const Surface *surface, const FillParams ¶ms) override; @@ -76,7 +76,7 @@ class FillTriangles : public FillRectilinear class FillStars : public FillRectilinear { public: - Fill* clone() const override { return new FillStars(*this); }; + Fill* clone() const override { return new FillStars(*this); } ~FillStars() override = default; Polylines fill_surface(const Surface *surface, const FillParams ¶ms) override; @@ -88,7 +88,7 @@ class FillStars : public FillRectilinear class FillCubic : public FillRectilinear { public: - Fill* clone() const override { return new FillCubic(*this); }; + Fill* clone() const override { return new FillCubic(*this); } ~FillCubic() override = default; Polylines fill_surface(const Surface *surface, const FillParams ¶ms) override; @@ -98,6 +98,6 @@ class FillCubic : public FillRectilinear }; -}; // namespace Slic3r +} // namespace Slic3r #endif // slic3r_FillRectilinear_hpp_ diff --git a/src/libslic3r/Geometry.hpp b/src/libslic3r/Geometry.hpp index f8d3b0a5c9f..85f181b92fd 100644 --- a/src/libslic3r/Geometry.hpp +++ b/src/libslic3r/Geometry.hpp @@ -213,7 +213,7 @@ inline bool liang_barsky_line_clipping_interval( double t0 = 0.0; double t1 = 1.0; // Traverse through left, right, bottom, top edges. - auto clip_side = [&x0, &v, &bbox, &t0, &t1](double p, double q) -> bool { + auto clip_side = [&t0, &t1](double p, double q) -> bool { if (p == 0) { if (q < 0) // Line parallel to the bounding box edge is fully outside of the bounding box. diff --git a/src/libslic3r/MarchingSquares.hpp b/src/libslic3r/MarchingSquares.hpp index d5f07fbde6d..8370c8cef9a 100644 --- a/src/libslic3r/MarchingSquares.hpp +++ b/src/libslic3r/MarchingSquares.hpp @@ -297,7 +297,7 @@ template class Grid { case SquareTag::full: case SquareTag::none: { Coord crd{tl(cell) + Coord{m_cellsize.r / 2, m_cellsize.c / 2}}; - return {{crd, Dir::none, m_rst}, crd}; + return {{crd, Dir::none, m_rst}, {crd}}; } } diff --git a/src/libslic3r/SLA/Concurrency.hpp b/src/libslic3r/SLA/Concurrency.hpp index 300024c76dd..b692914aca9 100644 --- a/src/libslic3r/SLA/Concurrency.hpp +++ b/src/libslic3r/SLA/Concurrency.hpp @@ -41,7 +41,7 @@ template<> struct _ccr static void for_each(It from, It to, Fn &&fn, size_t granularity = 1) { tbb::parallel_for(tbb::blocked_range{from, to, granularity}, - [&fn, from](const auto &range) { + [&fn](const auto &range) { loop_(range, std::forward(fn)); }); } diff --git a/src/libslic3r/SLAPrint.hpp b/src/libslic3r/SLAPrint.hpp index f69ed7b8e94..742670e2cb9 100644 --- a/src/libslic3r/SLAPrint.hpp +++ b/src/libslic3r/SLAPrint.hpp @@ -424,7 +424,7 @@ class SLAPrint : public PrintBaseWithState void clear() override; bool empty() const override { return m_objects.empty(); } // List of existing PrintObject IDs, to remove notifications for non-existent IDs. - std::vector print_object_ids() const; + std::vector print_object_ids() const override; ApplyStatus apply(const Model &model, DynamicPrintConfig config) override; void set_task(const TaskParams ¶ms) override; void process() override; diff --git a/src/libslic3r/SupportMaterial.cpp b/src/libslic3r/SupportMaterial.cpp index 33e74254ee5..a2d25b51c62 100644 --- a/src/libslic3r/SupportMaterial.cpp +++ b/src/libslic3r/SupportMaterial.cpp @@ -1582,7 +1582,7 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::bottom_conta }); Polygons &layer_support_area = layer_support_areas[layer_id]; - task_group.run([this, &projection, &projection_raw, &layer, &layer_support_area, layer_id] { + task_group.run([this, &projection, &projection_raw, &layer, &layer_support_area] { // Remove the areas that touched from the projection that will continue on next, lower, top surfaces. // Polygons trimming = union_(to_polygons(layer.slices), touching, true); Polygons trimming = offset(layer.lslices, float(SCALED_EPSILON)); @@ -1736,7 +1736,7 @@ void PrintObjectSupportMaterial::trim_top_contacts_by_bottom_contacts( const PrintObject &object, const MyLayersPtr &bottom_contacts, MyLayersPtr &top_contacts) const { tbb::parallel_for(tbb::blocked_range(0, int(top_contacts.size())), - [this, &object, &bottom_contacts, &top_contacts](const tbb::blocked_range& range) { + [&bottom_contacts, &top_contacts](const tbb::blocked_range& range) { int idx_bottom_overlapping_first = -2; // For all top contact layers, counting downwards due to the way idx_higher_or_equal caches the last index to avoid repeated binary search. for (int idx_top = range.end() - 1; idx_top >= range.begin(); -- idx_top) { @@ -1965,7 +1965,7 @@ void PrintObjectSupportMaterial::generate_base_layers( BOOST_LOG_TRIVIAL(debug) << "PrintObjectSupportMaterial::generate_base_layers() in parallel - start"; tbb::parallel_for( tbb::blocked_range(0, intermediate_layers.size()), - [this, &object, &bottom_contacts, &top_contacts, &intermediate_layers, &layer_support_areas](const tbb::blocked_range& range) { + [&object, &bottom_contacts, &top_contacts, &intermediate_layers, &layer_support_areas](const tbb::blocked_range& range) { // index -2 means not initialized yet, -1 means intialized and decremented to 0 and then -1. int idx_top_contact_above = -2; int idx_bottom_contact_overlapping = -2; @@ -2328,32 +2328,6 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::generate_int return interface_layers; } -static inline void fill_expolygons_generate_paths( - ExtrusionEntitiesPtr &dst, - const ExPolygons &expolygons, - Fill *filler, - float density, - ExtrusionRole role, - const Flow &flow) -{ - FillParams fill_params; - fill_params.density = density; - fill_params.dont_adjust = true; - for (const ExPolygon &expoly : expolygons) { - Surface surface(stInternal, expoly); - Polylines polylines; - try { - polylines = filler->fill_surface(&surface, fill_params); - } catch (InfillFailedException &) { - } - extrusion_entities_append_paths( - dst, - std::move(polylines), - role, - flow.mm3_per_mm(), flow.width, flow.height); - } -} - static inline void fill_expolygons_generate_paths( ExtrusionEntitiesPtr &dst, ExPolygons &&expolygons, diff --git a/src/libslic3r/SupportMaterial.hpp b/src/libslic3r/SupportMaterial.hpp index 72d487949f4..e579fd66fbe 100644 --- a/src/libslic3r/SupportMaterial.hpp +++ b/src/libslic3r/SupportMaterial.hpp @@ -246,7 +246,7 @@ class PrintObjectSupportMaterial bool m_can_merge_support_regions; coordf_t m_support_layer_height_min; - coordf_t m_support_layer_height_max; + // coordf_t m_support_layer_height_max; coordf_t m_gap_xy; }; diff --git a/src/slic3r/GUI/Camera.cpp b/src/slic3r/GUI/Camera.cpp index 1e589f1a15e..ade1d404370 100644 --- a/src/slic3r/GUI/Camera.cpp +++ b/src/slic3r/GUI/Camera.cpp @@ -10,15 +10,6 @@ #include -// phi / theta angles to orient the camera. -static const float VIEW_DEFAULT[2] = { 45.0f, 45.0f }; -static const float VIEW_LEFT[2] = { 90.0f, 90.0f }; -static const float VIEW_RIGHT[2] = { -90.0f, 90.0f }; -static const float VIEW_TOP[2] = { 0.0f, 0.0f }; -static const float VIEW_BOTTOM[2] = { 0.0f, 180.0f }; -static const float VIEW_FRONT[2] = { 0.0f, 90.0f }; -static const float VIEW_REAR[2] = { 180.0f, 90.0f }; - namespace Slic3r { namespace GUI { diff --git a/src/slic3r/GUI/Field.hpp b/src/slic3r/GUI/Field.hpp index 5b01c92c954..1b350324129 100644 --- a/src/slic3r/GUI/Field.hpp +++ b/src/slic3r/GUI/Field.hpp @@ -113,8 +113,8 @@ class Field { void field_changed() { on_change_field(); } - Field(const ConfigOptionDef& opt, const t_config_option_key& id) : m_opt(opt), m_opt_id(id) {}; - Field(wxWindow* parent, const ConfigOptionDef& opt, const t_config_option_key& id) : m_parent(parent), m_opt(opt), m_opt_id(id) {}; + Field(const ConfigOptionDef& opt, const t_config_option_key& id) : m_opt(opt), m_opt_id(id) {} + Field(wxWindow* parent, const ConfigOptionDef& opt, const t_config_option_key& id) : m_parent(parent), m_opt(opt), m_opt_id(id) {} virtual ~Field(); /// If you don't know what you are getting back, check both methods for nullptr. @@ -315,12 +315,12 @@ class SpinCtrl : public Field { /// Propagate value from field to the OptionGroupe and Config after kill_focus/ENTER void propagate_value() ; - void set_value(const std::string& value, bool change_event = false) { + void set_value(const std::string& value, bool change_event = false) { m_disable_change_event = !change_event; dynamic_cast(window)->SetValue(value); m_disable_change_event = false; - } - void set_value(const boost::any& value, bool change_event = false) { + } + void set_value(const boost::any& value, bool change_event = false) override { m_disable_change_event = !change_event; tmp_value = boost::any_cast(value); m_value = value; @@ -395,8 +395,8 @@ class ColourPicker : public Field { boost::any& get_value() override; void msw_rescale() override; - void enable() override { dynamic_cast(window)->Enable(); }; - void disable() override{ dynamic_cast(window)->Disable(); }; + void enable() override { dynamic_cast(window)->Enable(); } + void disable() override{ dynamic_cast(window)->Disable(); } wxWindow* getWindow() override { return window; } }; @@ -456,8 +456,8 @@ class StaticText : public Field { void msw_rescale() override; - void enable() override { dynamic_cast(window)->Enable(); }; - void disable() override{ dynamic_cast(window)->Disable(); }; + void enable() override { dynamic_cast(window)->Enable(); } + void disable() override{ dynamic_cast(window)->Disable(); } wxWindow* getWindow() override { return window; } }; diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index e6c5f21de67..48428b4eee7 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -2771,7 +2771,7 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool return color; }; - auto travel_color = [this](const Path& path) { + auto travel_color = [](const Path& path) { return (path.delta_extruder < 0.0f) ? Travel_Colors[2] /* Retract */ : ((path.delta_extruder > 0.0f) ? Travel_Colors[1] /* Extrude */ : Travel_Colors[0] /* Move */); @@ -3436,7 +3436,7 @@ void GCodeViewer::render_toolpaths() const shader.set_uniform("uniform_color", color4); }; - auto render_as_points = [this, zoom, point_size, near_plane_height, set_uniform_color] + auto render_as_points = [zoom, point_size, near_plane_height, set_uniform_color] (const TBuffer& buffer, unsigned int ibuffer_id, GLShaderProgram& shader) { #if ENABLE_FIXED_SCREEN_SIZE_POINT_MARKERS shader.set_uniform("use_fixed_screen_size", 1); @@ -3466,7 +3466,7 @@ void GCodeViewer::render_toolpaths() const glsafe(::glDisable(GL_VERTEX_PROGRAM_POINT_SIZE)); }; - auto render_as_lines = [this, light_intensity, set_uniform_color](const TBuffer& buffer, unsigned int ibuffer_id, GLShaderProgram& shader) { + auto render_as_lines = [light_intensity, set_uniform_color](const TBuffer& buffer, unsigned int ibuffer_id, GLShaderProgram& shader) { shader.set_uniform("light_intensity", light_intensity); for (const RenderPath& path : buffer.render_paths) { if (path.index_buffer_id == ibuffer_id) { @@ -3479,7 +3479,7 @@ void GCodeViewer::render_toolpaths() const } }; - auto render_as_triangles = [this, set_uniform_color](const TBuffer& buffer, unsigned int ibuffer_id, GLShaderProgram& shader) { + auto render_as_triangles = [set_uniform_color](const TBuffer& buffer, unsigned int ibuffer_id, GLShaderProgram& shader) { for (const RenderPath& path : buffer.render_paths) { if (path.index_buffer_id == ibuffer_id) { set_uniform_color(path.color, shader); @@ -3874,8 +3874,8 @@ void GCodeViewer::render_legend() const ImGui::PopStyleVar(); }; - auto append_range = [this, draw_list, &imgui, append_item](const Extrusions::Range& range, unsigned int decimals) { - auto append_range_item = [this, draw_list, &imgui, append_item](int i, float value, unsigned int decimals) { + auto append_range = [append_item](const Extrusions::Range& range, unsigned int decimals) { + auto append_range_item = [append_item](int i, float value, unsigned int decimals) { char buf[1024]; ::sprintf(buf, "%.*f", decimals, value); append_item(EItemType::Rect, Range_Colors[i], buf); @@ -3969,7 +3969,7 @@ void GCodeViewer::render_legend() const return _u8L("from") + " " + std::string(buf1) + " " + _u8L("to") + " " + std::string(buf2) + " " + _u8L("mm"); }; - auto role_time_and_percent = [this, time_mode](ExtrusionRole role) { + auto role_time_and_percent = [ time_mode](ExtrusionRole role) { auto it = std::find_if(time_mode.roles_times.begin(), time_mode.roles_times.end(), [role](const std::pair& item) { return role == item.first; }); return (it != time_mode.roles_times.end()) ? std::make_pair(it->second, it->second / time_mode.time) : std::make_pair(0.0f, 0.0f); }; @@ -4177,7 +4177,7 @@ void GCodeViewer::render_legend() const return items; }; - auto append_color_change = [this, &imgui](const Color& color1, const Color& color2, const std::array& offsets, const Times& times) { + auto append_color_change = [&imgui](const Color& color1, const Color& color2, const std::array& offsets, const Times& times) { imgui.text(_u8L("Color change")); ImGui::SameLine(); @@ -4196,7 +4196,7 @@ void GCodeViewer::render_legend() const imgui.text(short_time(get_time_dhms(times.second - times.first))); }; - auto append_print = [this, &imgui](const Color& color, const std::array& offsets, const Times& times) { + auto append_print = [&imgui](const Color& color, const std::array& offsets, const Times& times) { imgui.text(_u8L("Print")); ImGui::SameLine(); diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index 8e31addaabd..d3b4e17483e 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -394,7 +394,6 @@ class GLCanvas3D class Slope { bool m_enabled{ false }; - bool m_dialog_shown{ false }; GLCanvas3D& m_canvas; GLVolumeCollection& m_volumes; static float s_window_width; diff --git a/src/slic3r/GUI/GUI.cpp b/src/slic3r/GUI/GUI.cpp index 58149181d9e..3b44f20696d 100644 --- a/src/slic3r/GUI/GUI.cpp +++ b/src/slic3r/GUI/GUI.cpp @@ -35,7 +35,7 @@ void disable_screensaver() { #if __APPLE__ CFStringRef reasonForActivity = CFSTR("Slic3r"); - IOReturn success = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep, + [[maybe_unused]]IOReturn success = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, reasonForActivity, &assertionID); // ignore result: success == kIOReturnSuccess #elif _WIN32 @@ -46,7 +46,7 @@ void disable_screensaver() void enable_screensaver() { #if __APPLE__ - IOReturn success = IOPMAssertionRelease(assertionID); + IOPMAssertionRelease(assertionID); #elif _WIN32 SetThreadExecutionState(ES_CONTINUOUS); #endif diff --git a/src/slic3r/GUI/Gizmos/GLGizmoCut.hpp b/src/slic3r/GUI/Gizmos/GLGizmoCut.hpp index c0f33978f61..1bd917c8627 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoCut.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoCut.hpp @@ -31,17 +31,17 @@ class GLGizmoCut : public GLGizmoBase std::string get_tooltip() const override; protected: - virtual bool on_init(); - virtual void on_load(cereal::BinaryInputArchive& ar) { ar(m_cut_z, m_keep_upper, m_keep_lower, m_rotate_lower); } - virtual void on_save(cereal::BinaryOutputArchive& ar) const { ar(m_cut_z, m_keep_upper, m_keep_lower, m_rotate_lower); } - virtual std::string on_get_name() const; - virtual void on_set_state(); - virtual bool on_is_activable() const; - virtual void on_start_dragging(); - virtual void on_update(const UpdateData& data); - virtual void on_render() const; - virtual void on_render_for_picking() const; - virtual void on_render_input_window(float x, float y, float bottom_limit); + virtual bool on_init() override; + virtual void on_load(cereal::BinaryInputArchive& ar) override{ ar(m_cut_z, m_keep_upper, m_keep_lower, m_rotate_lower); } + virtual void on_save(cereal::BinaryOutputArchive& ar) const override { ar(m_cut_z, m_keep_upper, m_keep_lower, m_rotate_lower); } + virtual std::string on_get_name() const override; + virtual void on_set_state() override; + virtual bool on_is_activable() const override; + virtual void on_start_dragging() override; + virtual void on_update(const UpdateData& data) override; + virtual void on_render() const override; + virtual void on_render_for_picking() const override; + virtual void on_render_input_window(float x, float y, float bottom_limit) override; private: void update_max_z(const Selection& selection) const; diff --git a/src/slic3r/GUI/Gizmos/GLGizmoMove.hpp b/src/slic3r/GUI/Gizmos/GLGizmoMove.hpp index 5a4275b7fcc..20aa9f56cce 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoMove.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoMove.hpp @@ -33,14 +33,14 @@ class GLGizmoMove3D : public GLGizmoBase std::string get_tooltip() const override; protected: - virtual bool on_init(); - virtual std::string on_get_name() const; - virtual bool on_is_activable() const; - virtual void on_start_dragging(); - virtual void on_stop_dragging(); - virtual void on_update(const UpdateData& data); - virtual void on_render() const; - virtual void on_render_for_picking() const; + virtual bool on_init() override; + virtual std::string on_get_name() const override; + virtual bool on_is_activable() const override; + virtual void on_start_dragging() override; + virtual void on_stop_dragging() override; + virtual void on_update(const UpdateData& data) override; + virtual void on_render() const override; + virtual void on_render_for_picking() const override; private: double calc_projection(const UpdateData& data) const; diff --git a/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp index 6f8cbec603d..da415ce09aa 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp @@ -59,8 +59,8 @@ class GLGizmoPainterBase : public GLGizmoBase private: ObjectID m_old_mo_id; size_t m_old_volumes_size = 0; - virtual void on_render() const {} - virtual void on_render_for_picking() const {} + virtual void on_render() const override {} + virtual void on_render_for_picking() const override {} public: GLGizmoPainterBase(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoScale.hpp b/src/slic3r/GUI/Gizmos/GLGizmoScale.hpp index 0d8f3f7fa79..39021640ad0 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoScale.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoScale.hpp @@ -47,13 +47,13 @@ class GLGizmoScale3D : public GLGizmoBase std::string get_tooltip() const override; protected: - virtual bool on_init(); - virtual std::string on_get_name() const; - virtual bool on_is_activable() const; - virtual void on_start_dragging(); - virtual void on_update(const UpdateData& data); - virtual void on_render() const; - virtual void on_render_for_picking() const; + virtual bool on_init() override; + virtual std::string on_get_name() const override; + virtual bool on_is_activable() const override; + virtual void on_start_dragging() override; + virtual void on_update(const UpdateData& data) override; + virtual void on_render() const override; + virtual void on_render_for_picking() const override; private: void render_grabbers_connection(unsigned int id_1, unsigned int id_2) const; diff --git a/src/slic3r/GUI/Gizmos/GLGizmosCommon.hpp b/src/slic3r/GUI/Gizmos/GLGizmosCommon.hpp index aedf782e89f..61c27329766 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosCommon.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosCommon.hpp @@ -161,7 +161,7 @@ class SelectionInfo : public CommonGizmosDataBase private: ModelObject* m_model_object = nullptr; - int m_active_inst = -1; + // int m_active_inst = -1; float m_z_shift = 0.f; }; diff --git a/src/slic3r/GUI/MainFrame.hpp b/src/slic3r/GUI/MainFrame.hpp index c39527409c6..0971fdc77a7 100644 --- a/src/slic3r/GUI/MainFrame.hpp +++ b/src/slic3r/GUI/MainFrame.hpp @@ -133,7 +133,7 @@ class MainFrame : public DPIFrame ESettingsLayout m_layout{ ESettingsLayout::Unknown }; protected: - virtual void on_dpi_changed(const wxRect &suggested_rect); + virtual void on_dpi_changed(const wxRect &suggested_rect) override; virtual void on_sys_color_changed() override; public: diff --git a/src/slic3r/GUI/OptionsGroup.hpp b/src/slic3r/GUI/OptionsGroup.hpp index 5bc2d45959d..f19a3e0336a 100644 --- a/src/slic3r/GUI/OptionsGroup.hpp +++ b/src/slic3r/GUI/OptionsGroup.hpp @@ -273,7 +273,6 @@ class ConfigOptionsGroup: public OptionsGroup { const DynamicPrintConfig* m_config {nullptr}; // If the config is modelconfig, then ModelConfig::touch() has to be called after value change. ModelConfig* m_modelconfig { nullptr }; - bool m_full_labels{ 0 }; t_opt_map m_opt_map; std::string m_config_category; diff --git a/src/slic3r/Utils/OctoPrint.hpp b/src/slic3r/Utils/OctoPrint.hpp index ed1c61bd607..f1b36096c65 100644 --- a/src/slic3r/Utils/OctoPrint.hpp +++ b/src/slic3r/Utils/OctoPrint.hpp @@ -20,7 +20,7 @@ class OctoPrint : public PrintHost OctoPrint(DynamicPrintConfig *config); ~OctoPrint() override = default; - const char* get_name() const; + const char* get_name() const override; bool test(wxString &curl_msg) const override; wxString get_test_ok_msg () const override; diff --git a/src/slic3r/Utils/Repetier.hpp b/src/slic3r/Utils/Repetier.hpp index d94d7ec56ab..5141dc040bb 100644 --- a/src/slic3r/Utils/Repetier.hpp +++ b/src/slic3r/Utils/Repetier.hpp @@ -19,7 +19,7 @@ class Repetier : public PrintHost Repetier(DynamicPrintConfig *config); ~Repetier() override = default; - const char* get_name() const; + const char* get_name() const override; bool test(wxString &curl_msg) const override; wxString get_test_ok_msg () const override; From 1834ebe9815fa58fb6376cbe269d8c1f44aa6d9f Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Fri, 29 Jan 2021 18:08:04 +0100 Subject: [PATCH 3/4] Fixing Clang warnings 3 --- src/libslic3r/AppConfig.cpp | 2 +- src/libslic3r/Config.hpp | 4 ++-- src/libslic3r/Format/3mf.cpp | 1 - src/libslic3r/GCode.cpp | 2 +- src/libslic3r/GCode/SeamPlacer.cpp | 2 +- src/libslic3r/PresetBundle.cpp | 2 +- src/libslic3r/Print.cpp | 2 +- src/libslic3r/PrintObject.cpp | 2 +- src/libslic3r/SLA/IndexedMesh.cpp | 2 -- src/libslic3r/ShortestPath.cpp | 4 ++-- src/slic3r/GUI/DoubleSlider.cpp | 2 +- src/slic3r/GUI/FirmwareDialog.cpp | 2 +- src/slic3r/GUI/GLCanvas3D.cpp | 9 ++++----- src/slic3r/GUI/GUI_ObjectLayers.cpp | 2 +- src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp | 2 +- src/slic3r/GUI/ImGuiWrapper.cpp | 2 +- src/slic3r/GUI/ObjectDataViewModel.cpp | 2 +- src/slic3r/GUI/OptionsGroup.cpp | 2 +- src/slic3r/Utils/FlashAir.cpp | 2 +- src/slic3r/Utils/Repetier.cpp | 4 ++-- src/slic3r/Utils/UndoRedo.cpp | 2 +- 21 files changed, 25 insertions(+), 29 deletions(-) diff --git a/src/libslic3r/AppConfig.cpp b/src/libslic3r/AppConfig.cpp index 4b3d33a549d..79b9a025a65 100644 --- a/src/libslic3r/AppConfig.cpp +++ b/src/libslic3r/AppConfig.cpp @@ -395,7 +395,7 @@ std::vector AppConfig::get_mouse_device_names() const static constexpr const char *prefix = "mouse_device:"; static const size_t prefix_len = strlen(prefix); std::vector out; - for (const std::pair>& key_value_pair : m_storage) + for (const auto& key_value_pair : m_storage) if (boost::starts_with(key_value_pair.first, prefix) && key_value_pair.first.size() > prefix_len) out.emplace_back(key_value_pair.first.substr(prefix_len)); return out; diff --git a/src/libslic3r/Config.hpp b/src/libslic3r/Config.hpp index 4b726bea9ec..5e4b2ed6a08 100644 --- a/src/libslic3r/Config.hpp +++ b/src/libslic3r/Config.hpp @@ -1358,11 +1358,11 @@ class ConfigOptionEnum : public ConfigOptionSingle // Initialize the map. const t_config_enum_values &enum_keys_map = ConfigOptionEnum::get_enum_values(); int cnt = 0; - for (const std::pair &kvp : enum_keys_map) + for (const auto& kvp : enum_keys_map) cnt = std::max(cnt, kvp.second); cnt += 1; names.assign(cnt, ""); - for (const std::pair &kvp : enum_keys_map) + for (const auto& kvp : enum_keys_map) names[kvp.second] = kvp.first; } return names; diff --git a/src/libslic3r/Format/3mf.cpp b/src/libslic3r/Format/3mf.cpp index ba477be8e5b..c9f11086442 100644 --- a/src/libslic3r/Format/3mf.cpp +++ b/src/libslic3r/Format/3mf.cpp @@ -124,7 +124,6 @@ const char* VALID_OBJECT_TYPES[] = "model" }; -const unsigned int INVALID_OBJECT_TYPES_COUNT = 4; const char* INVALID_OBJECT_TYPES[] = { "solidsupport", diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 261487cc163..f076a74ca0d 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -851,7 +851,7 @@ namespace DoExport { double extruded_volume = extruder.extruded_volume() + (has_wipe_tower ? wipe_tower_data.used_filament[extruder.id()] * 2.4052f : 0.f); // assumes 1.75mm filament diameter double filament_weight = extruded_volume * extruder.filament_density() * 0.001; double filament_cost = filament_weight * extruder.filament_cost() * 0.001; - auto append = [&extruder, &extruders](std::pair &dst, const char *tmpl, double value) { + auto append = [&extruder](std::pair &dst, const char *tmpl, double value) { while (dst.second < extruder.id()) { // Fill in the non-printing extruders with zeros. dst.first += (dst.second > 0) ? ", 0" : "0"; diff --git a/src/libslic3r/GCode/SeamPlacer.cpp b/src/libslic3r/GCode/SeamPlacer.cpp index 1acc160f0f8..1778e06892a 100644 --- a/src/libslic3r/GCode/SeamPlacer.cpp +++ b/src/libslic3r/GCode/SeamPlacer.cpp @@ -664,7 +664,7 @@ static std::vector find_enforcer_centers(const Polygon& polygon, if (polygon.size() < 2 || enforcers_idxs.empty()) return out; - auto get_center_idx = [&polygon, &lengths](size_t start_idx, size_t end_idx) -> size_t { + auto get_center_idx = [&lengths](size_t start_idx, size_t end_idx) -> size_t { assert(end_idx >= start_idx); if (start_idx == end_idx) return start_idx; diff --git a/src/libslic3r/PresetBundle.cpp b/src/libslic3r/PresetBundle.cpp index 8fc8e92899b..7d08c93592e 100644 --- a/src/libslic3r/PresetBundle.cpp +++ b/src/libslic3r/PresetBundle.cpp @@ -915,7 +915,7 @@ void PresetBundle::load_config_file_config_bundle(const std::string &path, const std::string bundle_name = std::string(" - ") + boost::filesystem::path(path).filename().string(); // 2) Extract active configs from the config bundle, copy them and activate them in this bundle. - auto load_one = [this, &path, &bundle_name](PresetCollection &collection_dst, PresetCollection &collection_src, const std::string &preset_name_src, bool activate) -> std::string { + auto load_one = [&path, &bundle_name](PresetCollection &collection_dst, PresetCollection &collection_src, const std::string &preset_name_src, bool activate) -> std::string { Preset *preset_src = collection_src.find_preset(preset_name_src, false); Preset *preset_dst = collection_dst.find_preset(preset_name_src, false); assert(preset_src != nullptr); diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 61a5ae99c3b..b96768904d8 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -1405,7 +1405,7 @@ std::string Print::validate() const return L("One or more object were assigned an extruder that the printer does not have."); #endif - auto validate_extrusion_width = [min_nozzle_diameter, max_nozzle_diameter](const ConfigBase &config, const char *opt_key, double layer_height, std::string &err_msg) -> bool { + auto validate_extrusion_width = [/*min_nozzle_diameter,*/ max_nozzle_diameter](const ConfigBase &config, const char *opt_key, double layer_height, std::string &err_msg) -> bool { // This may change in the future, if we switch to "extrusion width wrt. nozzle diameter" // instead of currently used logic "extrusion width wrt. layer height", see GH issues #1923 #2829. // double extrusion_width_min = config.get_abs_value(opt_key, min_nozzle_diameter); diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index 3595f68388c..ee2e645695a 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -908,7 +908,7 @@ void PrintObject::detect_surfaces_type() // Fill in layerm->fill_surfaces by trimming the layerm->slices by the cummulative layerm->fill_surfaces. tbb::parallel_for( tbb::blocked_range(0, m_layers.size()), - [this, idx_region, interface_shells](const tbb::blocked_range& range) { + [this, idx_region](const tbb::blocked_range& range) { for (size_t idx_layer = range.begin(); idx_layer < range.end(); ++ idx_layer) { m_print->throw_if_canceled(); LayerRegion *layerm = m_layers[idx_layer]->m_regions[idx_region]; diff --git a/src/libslic3r/SLA/IndexedMesh.cpp b/src/libslic3r/SLA/IndexedMesh.cpp index efcf09873eb..485fa98ed83 100644 --- a/src/libslic3r/SLA/IndexedMesh.cpp +++ b/src/libslic3r/SLA/IndexedMesh.cpp @@ -55,8 +55,6 @@ class IndexedMesh::AABBImpl { } }; -static const constexpr double MESH_EPS = 1e-6; - IndexedMesh::IndexedMesh(const TriangleMesh& tmesh) : m_aabb(new AABBImpl()), m_tm(&tmesh) { diff --git a/src/libslic3r/ShortestPath.cpp b/src/libslic3r/ShortestPath.cpp index 9565b1874e5..60f8feaa636 100644 --- a/src/libslic3r/ShortestPath.cpp +++ b/src/libslic3r/ShortestPath.cpp @@ -1423,7 +1423,7 @@ static inline void do_crossover(const std::vector &edges_in, std::vect const std::pair &span2, bool reversed2, bool flipped2, const std::pair &span3, bool reversed3, bool flipped3) { auto it_edges_out = edges_out.begin(); - auto copy_span = [&edges_in, &edges_out, &it_edges_out](std::pair span, bool reversed, bool flipped) { + auto copy_span = [&edges_in, &it_edges_out](std::pair span, bool reversed, bool flipped) { assert(span.first < span.second); auto it = it_edges_out; if (reversed) @@ -1466,7 +1466,7 @@ static inline void do_crossover(const std::vector &edges_in, std::vect const std::pair &span3, bool reversed3, bool flipped3, const std::pair &span4, bool reversed4, bool flipped4) { auto it_edges_out = edges_out.begin(); - auto copy_span = [&edges_in, &edges_out, &it_edges_out](std::pair span, bool reversed, bool flipped) { + auto copy_span = [&edges_in, &it_edges_out](std::pair span, bool reversed, bool flipped) { assert(span.first < span.second); auto it = it_edges_out; if (reversed) diff --git a/src/slic3r/GUI/DoubleSlider.cpp b/src/slic3r/GUI/DoubleSlider.cpp index 1e4eed1e8c6..fddb63e3e4b 100644 --- a/src/slic3r/GUI/DoubleSlider.cpp +++ b/src/slic3r/GUI/DoubleSlider.cpp @@ -1889,7 +1889,7 @@ void Control::show_cog_icon_context_menu() []() { return true; }, [this]() { return m_extra_style & wxSL_VALUE_LABEL; }, GUI::wxGetApp().plater()); append_submenu(&menu, ruler_mode_menu, wxID_ANY, _L("Ruler mode"), _L("Set ruler mode"), "", - [this]() { return true; }, this); + []() { return true; }, this); } if (m_mode == MultiAsSingle && m_draw_mode == dmRegular) diff --git a/src/slic3r/GUI/FirmwareDialog.cpp b/src/slic3r/GUI/FirmwareDialog.cpp index 046d9d1386f..6927a03302a 100644 --- a/src/slic3r/GUI/FirmwareDialog.cpp +++ b/src/slic3r/GUI/FirmwareDialog.cpp @@ -648,7 +648,7 @@ void FirmwareDialog::priv::perform_upload() } } }) - .on_message([q, extra_verbose](const char *msg, unsigned /* size */) { + .on_message([q](const char *msg, unsigned /* size */) { if (extra_verbose) { BOOST_LOG_TRIVIAL(debug) << "avrdude: " << msg; } diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 917e11d0fdd..b97c51d1b0a 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -4582,9 +4582,9 @@ bool GLCanvas3D::_init_main_toolbar() "\n" + "[" + GUI::shortkey_ctrl_prefix() + "4] - " + _u8L("Printer Settings Tab") ; item.sprite_id = 10; item.enabling_callback = GLToolbarItem::Default_Enabling_Callback; - item.visibility_callback = [this]() { return (wxGetApp().app_config->get("new_settings_layout_mode") == "1" || - wxGetApp().app_config->get("dlg_settings_layout_mode") == "1"); }; - item.left.action_callback = [this]() { wxGetApp().mainframe->select_tab(); }; + item.visibility_callback = []() { return (wxGetApp().app_config->get("new_settings_layout_mode") == "1" || + wxGetApp().app_config->get("dlg_settings_layout_mode") == "1"); }; + item.left.action_callback = []() { wxGetApp().mainframe->select_tab(); }; if (!m_main_toolbar.add_item(item)) return false; @@ -5910,8 +5910,7 @@ void GLCanvas3D::_load_print_object_toolpaths(const PrintObject& print_object, c tbb::blocked_range(0, ctxt.layers.size(), grain_size), [&ctxt, &new_volume, is_selected_separate_extruder, this](const tbb::blocked_range& range) { GLVolumePtrs vols; - std::vector color_print_layer_to_glvolume; - auto volume = [&ctxt, &vols, &color_print_layer_to_glvolume, &range](size_t layer_idx, int extruder, int feature) -> GLVolume& { + auto volume = [&ctxt, &vols](size_t layer_idx, int extruder, int feature) -> GLVolume& { return *vols[ctxt.color_by_color_print()? ctxt.color_print_color_idx_by_layer_idx_and_extruder(layer_idx, extruder) : ctxt.color_by_tool() ? diff --git a/src/slic3r/GUI/GUI_ObjectLayers.cpp b/src/slic3r/GUI/GUI_ObjectLayers.cpp index 7d8643c7f84..8768f39ff71 100644 --- a/src/slic3r/GUI/GUI_ObjectLayers.cpp +++ b/src/slic3r/GUI/GUI_ObjectLayers.cpp @@ -132,7 +132,7 @@ wxSizer* ObjectLayers::create_layer(const t_layer_height_range& range, PlusMinus // Add control for the "Layer height" editor = new LayerRangeEditor(this, double_to_string(m_object->layer_config_ranges[range].option("layer_height")->getFloat()), etLayerHeight, set_focus_data, - [range, this](coordf_t layer_height, bool, bool) + [range](coordf_t layer_height, bool, bool) { return wxGetApp().obj_list()->edit_layer_range(range, layer_height); }); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp index e626aa7f866..2f7fa4638b5 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp @@ -893,7 +893,7 @@ void GLGizmoSlaSupports::on_set_state() // Only take the snapshot when the USER opens the gizmo. Common gizmos // data are not yet available, the CallAfter will postpone taking the // snapshot until they are. No, it does not feel right. - wxGetApp().CallAfter([this]() { + wxGetApp().CallAfter([]() { Plater::TakeSnapshot snapshot(wxGetApp().plater(), _(L("SLA gizmo turned on"))); }); } diff --git a/src/slic3r/GUI/ImGuiWrapper.cpp b/src/slic3r/GUI/ImGuiWrapper.cpp index ff8ba8f48ab..1ed4b492fd2 100644 --- a/src/slic3r/GUI/ImGuiWrapper.cpp +++ b/src/slic3r/GUI/ImGuiWrapper.cpp @@ -940,7 +940,7 @@ void ImGuiWrapper::init_font(bool compress) config.MergeMode = true; if (! m_font_cjk) { // Apple keyboard shortcuts are only contained in the CJK fonts. - ImFont *font_cjk = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/NotoSansCJK-Regular.ttc").c_str(), m_font_size, &config, ranges_keyboard_shortcuts); + [[maybe_unused]]ImFont *font_cjk = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/NotoSansCJK-Regular.ttc").c_str(), m_font_size, &config, ranges_keyboard_shortcuts); assert(font_cjk != nullptr); } #endif diff --git a/src/slic3r/GUI/ObjectDataViewModel.cpp b/src/slic3r/GUI/ObjectDataViewModel.cpp index d69f2d07739..7de37fb48c4 100644 --- a/src/slic3r/GUI/ObjectDataViewModel.cpp +++ b/src/slic3r/GUI/ObjectDataViewModel.cpp @@ -1208,7 +1208,7 @@ void ObjectDataViewModel::AddAllChildren(const wxDataViewItem& parent) ItemAdded(parent, wxDataViewItem((void*)child)); } - for (const auto item : array) + for (const auto& item : array) AddAllChildren(item); m_ctrl->Expand(parent); diff --git a/src/slic3r/GUI/OptionsGroup.cpp b/src/slic3r/GUI/OptionsGroup.cpp index 953275be7e9..d077c81f601 100644 --- a/src/slic3r/GUI/OptionsGroup.cpp +++ b/src/slic3r/GUI/OptionsGroup.cpp @@ -64,7 +64,7 @@ const t_field& OptionsGroup::build_field(const t_config_option_key& id, const Co m_fields.emplace(id, Choice::Create(this->ctrl_parent(), opt, id)); break; case coPoints: - m_fields.emplace(id, std::move(PointCtrl::Create(this->ctrl_parent(), opt, id))); + m_fields.emplace(id, PointCtrl::Create(this->ctrl_parent(), opt, id)); break; case coNone: break; default: diff --git a/src/slic3r/Utils/FlashAir.cpp b/src/slic3r/Utils/FlashAir.cpp index 22eaddecef5..2337ac29043 100644 --- a/src/slic3r/Utils/FlashAir.cpp +++ b/src/slic3r/Utils/FlashAir.cpp @@ -50,7 +50,7 @@ bool FlashAir::test(wxString &msg) const res = false; msg = format_error(body, error, status); }) - .on_complete([&, this](std::string body, unsigned) { + .on_complete([&](std::string body, unsigned) { BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: Got upload enabled: %2%") % name % body; res = boost::starts_with(body, "1"); diff --git a/src/slic3r/Utils/Repetier.cpp b/src/slic3r/Utils/Repetier.cpp index 115ea010ef9..7b66922d708 100644 --- a/src/slic3r/Utils/Repetier.cpp +++ b/src/slic3r/Utils/Repetier.cpp @@ -190,7 +190,7 @@ bool Repetier::get_groups(wxArrayString& groups) const http.on_error([&](std::string body, std::string error, unsigned status) { BOOST_LOG_TRIVIAL(error) << boost::format("%1%: Error getting version: %2%, HTTP %3%, body: `%4%`") % name % error % status % body; }) - .on_complete([&, this](std::string body, unsigned) { + .on_complete([&](std::string body, unsigned) { BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: Got groups: %2%") % name % body; try { @@ -233,7 +233,7 @@ bool Repetier::get_printers(wxArrayString& printers) const BOOST_LOG_TRIVIAL(error) << boost::format("%1%: Error listing printers: %2%, HTTP %3%, body: `%4%`") % name % error % status % body; res = false; }) - .on_complete([&, this](std::string body, unsigned http_status) { + .on_complete([&](std::string body, unsigned http_status) { BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: Got printers: %2%, HTTP status: %3%") % name % body % http_status; if (http_status != 200) diff --git a/src/slic3r/Utils/UndoRedo.cpp b/src/slic3r/Utils/UndoRedo.cpp index d82d9e31db8..697c1209dee 100644 --- a/src/slic3r/Utils/UndoRedo.cpp +++ b/src/slic3r/Utils/UndoRedo.cpp @@ -209,7 +209,7 @@ class ImmutableObjectHistory : public ObjectHistory bool is_immutable() const override { return true; } bool is_optional() const override { return m_optional; } // If it is an immutable object, return its pointer. There is a map assigning a temporary ObjectID to the immutable object pointer. - const void* immutable_object_ptr() const { return (const void*)m_shared_object.get(); } + const void* immutable_object_ptr() const override { return (const void*)m_shared_object.get(); } // Estimated size in memory, to be used to drop least recently used snapshots. size_t memsize() const override { From a7728634f0a641672747c578f83a1245881d54a4 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Mon, 8 Feb 2021 17:50:29 +0100 Subject: [PATCH 4/4] Clang: silence -Wdeprecated-declarations for now RPi: hopefully silence a warning --- CMakeLists.txt | 7 +++++++ src/libslic3r/SLA/Rotfinder.cpp | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c32fc6b7b0e..1a751eafe66 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -202,6 +202,13 @@ if (NOT MSVC AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMP add_compile_options(-Wno-ignored-attributes) # Tamas: Eigen include dirs are marked as SYSTEM endif() + # Clang reports legacy OpenGL calls as deprecated. Turn off the warning for now + # to reduce the clutter, we know about this one. It should be reenabled after + # we finally get rid of the deprecated code. + if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") + add_compile_options(-Wno-deprecated-declarations) + endif() + #GCC generates loads of -Wunknown-pragmas when compiling igl. The fix is not easy due to a bug in gcc, see # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66943 or # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431 diff --git a/src/libslic3r/SLA/Rotfinder.cpp b/src/libslic3r/SLA/Rotfinder.cpp index 9378977663b..702690c196d 100644 --- a/src/libslic3r/SLA/Rotfinder.cpp +++ b/src/libslic3r/SLA/Rotfinder.cpp @@ -165,7 +165,7 @@ XYRotation from_transform3d(const Transform3d &tr) template std::array find_min_score(Fn &&fn, It from, It to, StopCond &&stopfn) { - std::array ret; + std::array ret = {}; double score = std::numeric_limits::max();