Fixed some compilation warnings.

This commit is contained in:
Vojtech Bubnik 2023-08-30 12:51:35 +02:00
parent 2f94681dd2
commit 015a24133a
9 changed files with 95 additions and 67 deletions

View File

@ -1025,6 +1025,10 @@ void GCodeGenerator::_do_export(Print& print, GCodeOutputStream &file, Thumbnail
this->placeholder_parser().set("total_toolchanges", std::max(0, print.wipe_tower_data().number_of_toolchanges)); // Check for negative toolchanges (single extruder mode) and set to 0 (no tool change). this->placeholder_parser().set("total_toolchanges", std::max(0, print.wipe_tower_data().number_of_toolchanges)); // Check for negative toolchanges (single extruder mode) and set to 0 (no tool change).
{ {
BoundingBoxf bbox(print.config().bed_shape.values); BoundingBoxf bbox(print.config().bed_shape.values);
assert(bbox.defined);
if (! bbox.defined)
// This should not happen, but let's make the compiler happy.
bbox.min = bbox.max = Vec2d::Zero();
this->placeholder_parser().set("print_bed_min", new ConfigOptionFloats({ bbox.min.x(), bbox.min.y() })); this->placeholder_parser().set("print_bed_min", new ConfigOptionFloats({ bbox.min.x(), bbox.min.y() }));
this->placeholder_parser().set("print_bed_max", new ConfigOptionFloats({ bbox.max.x(), bbox.max.y() })); this->placeholder_parser().set("print_bed_max", new ConfigOptionFloats({ bbox.max.x(), bbox.max.y() }));
this->placeholder_parser().set("print_bed_size", new ConfigOptionFloats({ bbox.size().x(), bbox.size().y() })); this->placeholder_parser().set("print_bed_size", new ConfigOptionFloats({ bbox.size().x(), bbox.size().y() }));

View File

@ -2711,16 +2711,16 @@ void GCodeProcessor::process_G2_G3(const GCodeReader::GCodeLine& line, bool cloc
// relative center // relative center
Vec3f rel_center = Vec3f::Zero(); Vec3f rel_center = Vec3f::Zero();
#ifndef _NDEBUG #ifndef NDEBUG
double radius = 0.0; double radius = 0.0;
#endif // _NDEBUG #endif // NDEBUG
if (fitting == EFitting::R) { if (fitting == EFitting::R) {
float r; float r;
if (!line.has_value('R', r) || r == 0.0f) if (!line.has_value('R', r) || r == 0.0f)
return; return;
#ifndef _NDEBUG #ifndef NDEBUG
radius = (double)std::abs(r); radius = (double)std::abs(r);
#endif // _NDEBUG #endif // NDEBUG
const Vec2f start_pos((float)m_start_position[X], (float)m_start_position[Y]); const Vec2f start_pos((float)m_start_position[X], (float)m_start_position[Y]);
const Vec2f end_pos((float)end_position[X], (float)end_position[Y]); const Vec2f end_pos((float)end_position[X], (float)end_position[Y]);
const Vec2f c = Geometry::ArcWelder::arc_center(start_pos, end_pos, r, !clockwise); const Vec2f c = Geometry::ArcWelder::arc_center(start_pos, end_pos, r, !clockwise);

View File

@ -2098,7 +2098,7 @@ namespace client
multiplicative_expression.name("multiplicative_expression"); multiplicative_expression.name("multiplicative_expression");
assignment_statement = assignment_statement =
variable_reference(_r1)[_a = _1] >> '=' > (variable_reference(_r1)[_a = _1] >> '=') >
( // Consumes also '(' conditional_expression ')', that means enclosing an expression into braces makes it a single value vector initializer. ( // Consumes also '(' conditional_expression ')', that means enclosing an expression into braces makes it a single value vector initializer.
initializer_list(_r1)[px::bind(&MyContext::vector_variable_assign_initializer_list, _r1, _a, _1)] initializer_list(_r1)[px::bind(&MyContext::vector_variable_assign_initializer_list, _r1, _a, _1)]
// Process it before conditional_expression, as conditional_expression requires a vector reference to be augmented with an index. // Process it before conditional_expression, as conditional_expression requires a vector reference to be augmented with an index.

View File

@ -101,6 +101,7 @@ static inline void validate_range(const LineInformations &lines)
validate_range(l); validate_range(l);
} }
/*
static inline void check_self_intersections(const Polygons &polygons, const std::string_view message) static inline void check_self_intersections(const Polygons &polygons, const std::string_view message)
{ {
#ifdef TREE_SUPPORT_SHOW_ERRORS_WIN32 #ifdef TREE_SUPPORT_SHOW_ERRORS_WIN32
@ -108,6 +109,7 @@ static inline void check_self_intersections(const Polygons &polygons, const std:
::MessageBoxA(nullptr, (std::string("TreeSupport infill self intersections: ") + std::string(message)).c_str(), "Bug detected!", MB_OK | MB_SYSTEMMODAL | MB_SETFOREGROUND | MB_ICONWARNING); ::MessageBoxA(nullptr, (std::string("TreeSupport infill self intersections: ") + std::string(message)).c_str(), "Bug detected!", MB_OK | MB_SYSTEMMODAL | MB_SETFOREGROUND | MB_ICONWARNING);
#endif // TREE_SUPPORT_SHOW_ERRORS_WIN32 #endif // TREE_SUPPORT_SHOW_ERRORS_WIN32
} }
*/
static inline void check_self_intersections(const ExPolygon &expoly, const std::string_view message) static inline void check_self_intersections(const ExPolygon &expoly, const std::string_view message)
{ {
#ifdef TREE_SUPPORT_SHOW_ERRORS_WIN32 #ifdef TREE_SUPPORT_SHOW_ERRORS_WIN32

View File

@ -1939,7 +1939,7 @@ std::vector<ExPolygons> slice_mesh_ex(
&expolygons); &expolygons);
#if 0 #if 0
//#ifndef _NDEBUG //#ifndef NDEBUG
// Test whether the expolygons in a single layer overlap. // Test whether the expolygons in a single layer overlap.
for (size_t i = 0; i < expolygons.size(); ++ i) for (size_t i = 0; i < expolygons.size(); ++ i)
for (size_t j = i + 1; j < expolygons.size(); ++ j) { for (size_t j = i + 1; j < expolygons.size(); ++ j) {
@ -1948,7 +1948,7 @@ std::vector<ExPolygons> slice_mesh_ex(
} }
#endif #endif
#if 0 #if 0
//#ifndef _NDEBUG //#ifndef NDEBUG
for (const ExPolygon &ex : expolygons) { for (const ExPolygon &ex : expolygons) {
assert(! has_duplicate_points(ex.contour)); assert(! has_duplicate_points(ex.contour));
for (const Polygon &hole : ex.holes) for (const Polygon &hole : ex.holes)
@ -1956,7 +1956,7 @@ std::vector<ExPolygons> slice_mesh_ex(
assert(! has_duplicate_points(ex)); assert(! has_duplicate_points(ex));
} }
assert(!has_duplicate_points(expolygons)); assert(!has_duplicate_points(expolygons));
#endif // _NDEBUG #endif // NDEBUG
//FIXME simplify //FIXME simplify
if (this_mode == MeshSlicingParams::SlicingMode::PositiveLargestContour) if (this_mode == MeshSlicingParams::SlicingMode::PositiveLargestContour)
keep_largest_contour_only(expolygons); keep_largest_contour_only(expolygons);
@ -1968,7 +1968,7 @@ std::vector<ExPolygons> slice_mesh_ex(
expolygons = std::move(simplified); expolygons = std::move(simplified);
} }
#if 0 #if 0
//#ifndef _NDEBUG //#ifndef NDEBUG
for (const ExPolygon &ex : expolygons) { for (const ExPolygon &ex : expolygons) {
assert(! has_duplicate_points(ex.contour)); assert(! has_duplicate_points(ex.contour));
for (const Polygon &hole : ex.holes) for (const Polygon &hole : ex.holes)
@ -1976,7 +1976,7 @@ std::vector<ExPolygons> slice_mesh_ex(
assert(! has_duplicate_points(ex)); assert(! has_duplicate_points(ex));
} }
assert(! has_duplicate_points(expolygons)); assert(! has_duplicate_points(expolygons));
#endif // _NDEBUG #endif // NDEBUG
} }
}); });
// BOOST_LOG_TRIVIAL(debug) << "slice_mesh make_expolygons in parallel - end"; // BOOST_LOG_TRIVIAL(debug) << "slice_mesh make_expolygons in parallel - end";

View File

@ -2334,7 +2334,7 @@ void ConfigWizard::priv::load_pages()
return a.first < b.first; return a.first < b.first;
}); });
for (const std::pair<std::wstring, std::string> v : sorted_vendors) { for (const std::pair<std::wstring, std::string> &v : sorted_vendors) {
const auto& pages = pages_3rdparty.find(v.second); const auto& pages = pages_3rdparty.find(v.second);
if (pages == pages_3rdparty.end()) if (pages == pages_3rdparty.end())
continue; // Should not happen continue; // Should not happen

View File

@ -499,10 +499,10 @@ bool GLGizmoCut3D::render_double_input(const std::string& label, double& value_i
bool GLGizmoCut3D::render_slider_double_input(const std::string& label, float& value_in, float& tolerance_in) bool GLGizmoCut3D::render_slider_double_input(const std::string& label, float& value_in, float& tolerance_in)
{ {
constexpr float UndefMinVal = -0.1f; constexpr const float UndefMinVal = -0.1f;
const float f_mm_to_in = static_cast<float>(ObjectManipulation::mm_to_in); const float f_mm_to_in = static_cast<float>(ObjectManipulation::mm_to_in);
auto render_slider = [this, UndefMinVal, f_mm_to_in] auto render_slider = [this, f_mm_to_in]
(const std::string& label, float& val, float def_val, float max_val, const wxString& tooltip) { (const std::string& label, float& val, float def_val, float max_val, const wxString& tooltip) {
float min_val = val < 0.f ? UndefMinVal : def_val; float min_val = val < 0.f ? UndefMinVal : def_val;
float value = val; float value = val;

View File

@ -785,7 +785,7 @@ void PlaterPresetComboBox::show_edit_menu()
[this](wxCommandEvent&) { this->change_extruder_color(); }, "funnel", menu, []() { return true; }, wxGetApp().plater()); [this](wxCommandEvent&) { this->change_extruder_color(); }, "funnel", menu, []() { return true; }, wxGetApp().plater());
#endif //__linux__ #endif //__linux__
append_menu_item(menu, wxID_ANY, _L("Show/Hide template presets"), "", append_menu_item(menu, wxID_ANY, _L("Show/Hide template presets"), "",
[this](wxCommandEvent&) { wxGetApp().open_preferences("no_templates", "General"); }, "spool", menu, []() { return true; }, wxGetApp().plater()); [](wxCommandEvent&) { wxGetApp().open_preferences("no_templates", "General"); }, "spool", menu, []() { return true; }, wxGetApp().plater());
wxGetApp().plater()->PopupMenu(menu); wxGetApp().plater()->PopupMenu(menu);
return; return;

File diff suppressed because one or more lines are too long