From c70a6135483f2e54826dbc4f2bb64b2b40a868c7 Mon Sep 17 00:00:00 2001 From: Kris Austin Date: Wed, 9 Sep 2026 05:43:08 -0500 Subject: [PATCH] build: clear 8 warnings - && inside || without parentheses (#15587) Every edit makes the precedence the compiler already applies explicit. None of them regroups an expression, so behavior is unchanged at all eight sites. Strip parentheses and whitespace from the diff and the token stream matches. GCodeProcessor.cpp:1472 tests == where the symmetric clause below tests !=, which reads like a typo and is not one. A comment now explains why. OrcaSlicer.cpp:4760 was the only judgment call. Its leading !is_seq_print is bare while both operands are parenthesized, so the written form matches what the compiler does. Kept rather than guessed at. --- src/OrcaSlicer.cpp | 2 +- src/libslic3r/GCode/GCodeProcessor.cpp | 8 +++++--- src/slic3r/GUI/GLCanvas3D.cpp | 2 +- src/slic3r/GUI/Plater.cpp | 4 ++-- src/slic3r/GUI/SelectMachine.cpp | 2 +- src/slic3r/GUI/UnsavedChangesDialog.cpp | 4 ++-- 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/OrcaSlicer.cpp b/src/OrcaSlicer.cpp index 1f85cf7358..15e7f85c46 100644 --- a/src/OrcaSlicer.cpp +++ b/src/OrcaSlicer.cpp @@ -4826,7 +4826,7 @@ int CLI::run(int argc, char **argv) } } - if (!arrange_cfg.is_seq_print && (assemble_plate.filaments_count > 1)||(enable_wrapping_detect && !current_wrapping_exclude_area.empty())) + if ((!arrange_cfg.is_seq_print && (assemble_plate.filaments_count > 1))||(enable_wrapping_detect && !current_wrapping_exclude_area.empty())) { //prepare the wipe tower int plate_count = partplate_list.get_plate_count(); diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index cd6c494f33..0b3db0323b 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -1468,9 +1468,11 @@ void GCodeProcessor::run_post_process() // Append a per-filament usage block at a filament change. auto handle_filament_change = [&](int filament_id, int cur_line_id, int nozzle_id) { - // skip filament changes emitted inside the machine start / end gcode - if (m_machine_start_gcode_end_line_id == (unsigned int) (-1) && (unsigned int) (cur_line_id) < m_machine_start_gcode_end_line_id || - m_machine_end_gcode_start_line_id != (unsigned int) (-1) && (unsigned int) (cur_line_id) > m_machine_end_gcode_start_line_id) + // Skip filament changes emitted inside the machine start / end gcode. One forward pass assigns + // the tag ids and tests them in the same loop, so inside the start gcode the end tag is unseen + // and the id still holds the sentinel. That is why the first clause tests == and the second !=. + if ((m_machine_start_gcode_end_line_id == (unsigned int) (-1) && (unsigned int) (cur_line_id) < m_machine_start_gcode_end_line_id) || + (m_machine_end_gcode_start_line_id != (unsigned int) (-1) && (unsigned int) (cur_line_id) > m_machine_end_gcode_start_line_id)) return; if (!m_filament_blocks.empty()) m_filament_blocks.back().upper_gcode_id = cur_line_id; diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 6921a72271..556faaa763 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -2191,7 +2191,7 @@ void GLCanvas3D::render(bool only_init) // Negative coordinate means out of the window, likely because the window was deactivated. // In that case the tooltip should be hidden. - if (m_mouse.position.x() >= 0. && m_mouse.position.y() >= 0. || has_mouse_capture()) { // ORCA continue to capture mouse pos mid drag + if ((m_mouse.position.x() >= 0. && m_mouse.position.y() >= 0.) || has_mouse_capture()) { // ORCA continue to capture mouse pos mid drag if (tooltip.empty()) tooltip = m_layers_editing.get_tooltip(*this); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 2d8816960b..109d7b3c10 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -3667,8 +3667,8 @@ void Sidebar::update_presets(Preset::Type preset_type) // so extruders without an explicit sub-nozzle count never offer Hybrid. A nullable-int // nil is INT_MAX (> 1) and would otherwise falsely pass the gate, so exclude it too. if (boost::algorithm::contains(extruder_variants->values[index], type + " " + nozzle_volumes_def->enum_labels[i]) || - extruder_max_nozzle_count->get_at(index) > 1 && extruder_max_nozzle_count->get_at(index) != ConfigOptionIntsNullable::nil_value() && - nozzle_volumes_def->enum_keys_map->at(nozzle_volumes_def->enum_values[i]) == nvtHybrid) { + (extruder_max_nozzle_count->get_at(index) > 1 && extruder_max_nozzle_count->get_at(index) != ConfigOptionIntsNullable::nil_value() && + nozzle_volumes_def->enum_keys_map->at(nozzle_volumes_def->enum_values[i]) == nvtHybrid)) { if (nozzle_volumes_def->enum_keys_map->at(nozzle_volumes_def->enum_values[i]) == NozzleVolumeType::nvtHighFlow &&(diameter == "0.2" || is_skip_high_flow_printer(printer_model))) continue; diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index 41ee523fbe..629aef7296 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -3073,7 +3073,7 @@ static bool _HasExt(const std::vector &ams_mapping_result) { }; for (const auto &info : ams_mapping_result) { - if (info.ams_id == VIRTUAL_AMS_MAIN_ID_STR || info.ams_id == VIRTUAL_AMS_DEPUTY_ID_STR && !info.ams_id.empty()) { + if (info.ams_id == VIRTUAL_AMS_MAIN_ID_STR || (info.ams_id == VIRTUAL_AMS_DEPUTY_ID_STR && !info.ams_id.empty())) { return true; } } diff --git a/src/slic3r/GUI/UnsavedChangesDialog.cpp b/src/slic3r/GUI/UnsavedChangesDialog.cpp index 5c69466cfa..0cb35fb139 100644 --- a/src/slic3r/GUI/UnsavedChangesDialog.cpp +++ b/src/slic3r/GUI/UnsavedChangesDialog.cpp @@ -1281,8 +1281,8 @@ static wxString get_string_value(std::string opt_key, const DynamicPrintConfig& } auto opt_vector = dynamic_cast(option); - if (option->is_scalar() && config.option(opt_key)->is_nil() || - option->is_vector() && opt_vector && opt_idx >= 0 && opt_idx < opt_vector->size() && opt_vector->is_nil(opt_idx)) + if ((option->is_scalar() && config.option(opt_key)->is_nil()) || + (option->is_vector() && opt_vector && opt_idx >= 0 && opt_idx < opt_vector->size() && opt_vector->is_nil(opt_idx))) return _L("N/A"); wxString out;