From f18eb21b82a5eedff91ee95aa9d6755a221f03e1 Mon Sep 17 00:00:00 2001 From: Kris Austin Date: Wed, 9 Sep 2026 10:01:19 -0500 Subject: [PATCH] build: clear 11 single-site clang-cl warning categories (#15584) build: clear eleven single-site clang-cl warning categories Each of these is the last site left in its category, and every one is the compiler saying it cannot tell what the code meant. Nothing here changes defined behavior. - OrcaSlicer_app_msvc.cpp printed a DWORD with %d - StackWalker.cpp ran delete[] through an LPVOID - ToolOrdering.cpp used a bare ; as a deliberate skip loop's body - WipeTower.cpp had finish_block_tcr = finish_block_tcr, so the branch that reached it did nothing. Folding the condition into the enclosing if leaves the other branch untouched - GCodeProcessor.cpp had an else binding to the inner if while the outer if carried no braces - AmsMappingPopupUpdate.cpp wrote >= 1 || <= 3 where its own comment says && - CalibrationWizardPresetPage.cpp left max_decimal_length unset through a pair of conditions that cover every value but not visibly so - DevManager.cpp bound map elements to pair rather than pair, copying every one - SyncAmsInfoDialog.cpp had extraneous parentheses around a comparison - Http.cpp had if (speed > 0.01) speed = speed;. speed now starts at 0 as well, because curl_easy_getinfo leaves the target untouched when it fails and the value reaches Progress either way - SnapmakerPrinterAgent.cpp truncated npos into an unsigned int, so the != npos guard was always true. A colour with no # still yields 0, because the wrap produced 0 as well Nine categories go to zero. -Wtautological-overlap-compare and -Wsometimes-uninitialized reach zero when #15583 merges their second site. --- src/OrcaSlicer_app_msvc.cpp | 2 +- src/dev-utils/StackWalker.cpp | 2 +- src/libslic3r/GCode/GCodeProcessor.cpp | 3 ++- src/libslic3r/GCode/ToolOrdering.cpp | 2 +- src/libslic3r/GCode/WipeTower.cpp | 8 ++------ src/slic3r/GUI/AmsMappingPopupUpdate.cpp | 2 +- src/slic3r/GUI/CalibrationWizardPresetPage.cpp | 2 +- src/slic3r/GUI/DeviceCore/DevManager.cpp | 2 +- src/slic3r/GUI/SyncAmsInfoDialog.cpp | 2 +- src/slic3r/Utils/Http.cpp | 4 +--- src/slic3r/Utils/SnapmakerPrinterAgent.cpp | 2 +- 11 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/OrcaSlicer_app_msvc.cpp b/src/OrcaSlicer_app_msvc.cpp index 35568a9cfa..265047fa34 100644 --- a/src/OrcaSlicer_app_msvc.cpp +++ b/src/OrcaSlicer_app_msvc.cpp @@ -297,7 +297,7 @@ int wmain(int argc, wchar_t **argv) // printf("Loading Slic3r library: %S\n", path_to_slic3r); HINSTANCE hInstance_Slic3r = LoadLibraryExW(path_to_slic3r, nullptr, 0); if (hInstance_Slic3r == nullptr) { - printf("OrcaSlicer.dll was not loaded, error=%d\n", GetLastError()); + printf("OrcaSlicer.dll was not loaded, error=%lu\n", GetLastError()); return -1; } diff --git a/src/dev-utils/StackWalker.cpp b/src/dev-utils/StackWalker.cpp index 468e8927a5..6038196cb0 100644 --- a/src/dev-utils/StackWalker.cpp +++ b/src/dev-utils/StackWalker.cpp @@ -364,7 +364,7 @@ void CStackWalker::GetModuleInformation(LPMODULE_INFO pmi) if (dwInfoSize > 0) { - LPVOID lpData = new byte[dwInfoSize]; + byte *lpData = new byte[dwInfoSize]; ZeroMemory(lpData, dwInfoSize * sizeof(byte)); if (GetFileVersionInfo(pmi->szModulePath, dwHandle, dwInfoSize, lpData) > 0 ) diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index 0b3db0323b..e4da19cd73 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -2779,7 +2779,7 @@ bool GCodeProcessor::check_multi_extruder_gcode_valid(const int std::map> gcode_path_pos; // object_id, filament_id, pos for (const GCodeProcessorResult::MoveVertex &move : m_result.moves) { // sometimes, the start line extrude was outside the edge of plate a little, this is allowed, so do not include into the gcode_path_pos - if (move.type == EMoveType::Extrude /* && move.extrusion_role != ExtrusionRole::erFlush || move.type == EMoveType::Travel*/) + if (move.type == EMoveType::Extrude /* && move.extrusion_role != ExtrusionRole::erFlush || move.type == EMoveType::Travel*/) { if (move.extrusion_role == ExtrusionRole::erCustom) { /*if (move.is_arc_move_with_interpolation_points()) { for (int i = 0; i < move.interpolation_points.size(); i++) { @@ -2801,6 +2801,7 @@ bool GCodeProcessor::check_multi_extruder_gcode_valid(const int gcode_path_pos[move.object_label_id][int(move.extruder_id)].max_print_z = std::max(gcode_path_pos[move.object_label_id][int(move.extruder_id)].max_print_z, move.print_z); } + } } bool valid = true; diff --git a/src/libslic3r/GCode/ToolOrdering.cpp b/src/libslic3r/GCode/ToolOrdering.cpp index 0a97e7ac41..c6517c6e65 100644 --- a/src/libslic3r/GCode/ToolOrdering.cpp +++ b/src/libslic3r/GCode/ToolOrdering.cpp @@ -3137,7 +3137,7 @@ void ToolOrdering::assign_custom_gcodes(const Print &print) // Skip all custom G-codes above this layer and skip all extruder switches. for (; custom_gcode_it != custom_gcode_per_print_z.gcodes.rend() && ( (print_z_above > lt.print_z && custom_gcode_it->print_z > 0.5 * (lt.print_z + print_z_above)) - || custom_gcode_it->type == CustomGCode::ToolChange); ++ custom_gcode_it); + || custom_gcode_it->type == CustomGCode::ToolChange); ++ custom_gcode_it) {} print_z_above = lt.print_z; if (custom_gcode_it == custom_gcode_per_print_z.gcodes.rend()) // Custom G-codes were processed. diff --git a/src/libslic3r/GCode/WipeTower.cpp b/src/libslic3r/GCode/WipeTower.cpp index bef3803c55..589ac14bad 100644 --- a/src/libslic3r/GCode/WipeTower.cpp +++ b/src/libslic3r/GCode/WipeTower.cpp @@ -4971,12 +4971,8 @@ void WipeTower::generate_new(std::vector= 1 || ams_type <= 3) { // 1:ams 2:ams-lite 3:n3f + if (ams_type >= 1 && ams_type <= 3) { // 1:ams 2:ams-lite 3:n3f auto sizer_mapping_list = new wxBoxSizer(wxHORIZONTAL); auto ams_mapping_item_container = new MappingContainer(nozzle_id == 0 ? m_right_marea_panel : m_left_marea_panel, "AMS-1", 4); diff --git a/src/slic3r/GUI/CalibrationWizardPresetPage.cpp b/src/slic3r/GUI/CalibrationWizardPresetPage.cpp index 5267715439..c6d491a930 100644 --- a/src/slic3r/GUI/CalibrationWizardPresetPage.cpp +++ b/src/slic3r/GUI/CalibrationWizardPresetPage.cpp @@ -360,7 +360,7 @@ void CaliPresetCustomRangePanel::create_panel(wxWindow* parent) int max_decimal_length; if (i <= 1) max_decimal_length = 3; - else if (i >= 2) + else max_decimal_length = 4; if (decimal_number > max_decimal_length) { int allowed_length = number.length() - decimal_number + max_decimal_length; diff --git a/src/slic3r/GUI/DeviceCore/DevManager.cpp b/src/slic3r/GUI/DeviceCore/DevManager.cpp index 8844303793..feb6301df3 100644 --- a/src/slic3r/GUI/DeviceCore/DevManager.cpp +++ b/src/slic3r/GUI/DeviceCore/DevManager.cpp @@ -872,7 +872,7 @@ namespace Slic3r obj->m_is_online = elem["dev_online"].get(); if (elem.contains("dev_model_name") && !elem["dev_model_name"].is_null()) { auto printer_type = elem["dev_model_name"].get(); - for (const std::pair> &pair : device_subseries) { + for (const auto &pair : device_subseries) { auto it = std::find(pair.second.begin(), pair.second.end(), printer_type); if (it != pair.second.end()) { diff --git a/src/slic3r/GUI/SyncAmsInfoDialog.cpp b/src/slic3r/GUI/SyncAmsInfoDialog.cpp index 92c3d218e5..c6973649b1 100644 --- a/src/slic3r/GUI/SyncAmsInfoDialog.cpp +++ b/src/slic3r/GUI/SyncAmsInfoDialog.cpp @@ -1547,7 +1547,7 @@ bool SyncAmsInfoDialog::is_nozzle_type_match(DevExtderSystem data, wxString &err auto sai_nz_pt = wxGetApp().preset_bundle->printers.get_edited_preset().get_printer_type(wxGetApp().preset_bundle); if (target_machine_nozzle_id == DEPUTY_EXTRUDER_ID) { pos = _L(DevPrinterConfigUtil::get_toolhead_display_name(sai_nz_pt, DEPUTY_EXTRUDER_ID, ToolHeadComponent::Nozzle, ToolHeadNameCase::LowerCase)); - } else if ((target_machine_nozzle_id == MAIN_EXTRUDER_ID)) { + } else if (target_machine_nozzle_id == MAIN_EXTRUDER_ID) { pos = _L(DevPrinterConfigUtil::get_toolhead_display_name(sai_nz_pt, MAIN_EXTRUDER_ID, ToolHeadComponent::Nozzle, ToolHeadNameCase::LowerCase)); } diff --git a/src/slic3r/Utils/Http.cpp b/src/slic3r/Utils/Http.cpp index f1ff056d10..4d34d60d04 100644 --- a/src/slic3r/Utils/Http.cpp +++ b/src/slic3r/Utils/Http.cpp @@ -254,10 +254,8 @@ int Http::priv::xfercb(void *userp, curl_off_t dltotal, curl_off_t dlnow, curl_o bool cb_cancel = false; if (self->progressfn) { - double speed; + double speed = 0.; curl_easy_getinfo(self->curl, CURLINFO_SPEED_UPLOAD, &speed); - if (speed > 0.01) - speed = speed; Progress progress(dltotal, dlnow, ultotal, ulnow, self->buffer, speed); self->progressfn(progress, cb_cancel); } diff --git a/src/slic3r/Utils/SnapmakerPrinterAgent.cpp b/src/slic3r/Utils/SnapmakerPrinterAgent.cpp index 9b9a6809fd..ab7aa9bd52 100644 --- a/src/slic3r/Utils/SnapmakerPrinterAgent.cpp +++ b/src/slic3r/Utils/SnapmakerPrinterAgent.cpp @@ -39,7 +39,7 @@ std::string find_closest_color_preset_by_vendor_and_type(const PresetCollection& std::string p_color = p.config.opt_string("default_filament_colour", 0u); unsigned int p_color_value; if (!p_color.empty()) { - unsigned int hash_pos = p_color.find("#"); + size_t hash_pos = p_color.find("#"); p_color_value = std::stoul(p_color.substr(hash_pos != std::string::npos ? hash_pos + 1 : 0), nullptr, 16); } else { // Default to black if no color specified in profile. Assume other profiles might be a closer color match.