mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-14 10:17:55 -06:00
Suppress some compiler warnings, fix few possible bugs. (#6224)
* Supress warnings on unused functions an variables Compilation of OrcaSlicer produces 3056 warnings. Nearly half of them related to unused functions and variables. It is unlikely we going to clean them up since we may want to keep code base as close to the BBS as possible * initialize class member with correct value * Fix memset arguments order * Merge multiple statemensts into single * fix -Wpessimizing-move
This commit is contained in:
parent
b1a06e80b3
commit
143d8c4a8d
6 changed files with 16 additions and 14 deletions
|
@ -252,8 +252,10 @@ if (NOT MSVC AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMP
|
||||||
# On GCC and Clang, no return from a non-void function is a warning only. Here, we make it an error.
|
# On GCC and Clang, no return from a non-void function is a warning only. Here, we make it an error.
|
||||||
add_compile_options(-Werror=return-type)
|
add_compile_options(-Werror=return-type)
|
||||||
|
|
||||||
# Ignore unused functions warnings
|
# Since some portions of code are just commented out or put under conditional compilation, there are
|
||||||
add_compile_options(-Wno-unused-function)
|
# a bunch of warning related to unused functions and variables. Suppress those warnings to not pollute
|
||||||
|
# compilers diagnostics output with warnings we not going to look at
|
||||||
|
add_compile_options(-Wno-unused-function -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unused-label -Wno-unused-local-typedefs)
|
||||||
|
|
||||||
# Ignore signed/unsigned comparison warnings
|
# Ignore signed/unsigned comparison warnings
|
||||||
add_compile_options(-Wno-sign-compare)
|
add_compile_options(-Wno-sign-compare)
|
||||||
|
|
|
@ -9,7 +9,7 @@ double Extruder::m_share_retracted = 0.;
|
||||||
Extruder::Extruder(unsigned int id, GCodeConfig *config, bool share_extruder) :
|
Extruder::Extruder(unsigned int id, GCodeConfig *config, bool share_extruder) :
|
||||||
m_id(id),
|
m_id(id),
|
||||||
m_config(config),
|
m_config(config),
|
||||||
m_share_extruder(m_share_extruder)
|
m_share_extruder(share_extruder)
|
||||||
{
|
{
|
||||||
reset();
|
reset();
|
||||||
|
|
||||||
|
|
|
@ -873,7 +873,7 @@ void TreeSupport::detect_overhangs(bool detect_first_sharp_tail_only)
|
||||||
|
|
||||||
// normal overhang
|
// normal overhang
|
||||||
ExPolygons lower_layer_offseted = offset_ex(lower_polys, support_offset_scaled, SUPPORT_SURFACES_OFFSET_PARAMETERS);
|
ExPolygons lower_layer_offseted = offset_ex(lower_polys, support_offset_scaled, SUPPORT_SURFACES_OFFSET_PARAMETERS);
|
||||||
ExPolygons overhang_areas = std::move(diff_ex(curr_polys, lower_layer_offseted));
|
ExPolygons overhang_areas = diff_ex(curr_polys, lower_layer_offseted);
|
||||||
|
|
||||||
overhang_areas.erase(std::remove_if(overhang_areas.begin(), overhang_areas.end(),
|
overhang_areas.erase(std::remove_if(overhang_areas.begin(), overhang_areas.end(),
|
||||||
[extrusion_width_scaled](ExPolygon& area) { return offset_ex(area, -0.1 * extrusion_width_scaled).empty(); }),
|
[extrusion_width_scaled](ExPolygon& area) { return offset_ex(area, -0.1 * extrusion_width_scaled).empty(); }),
|
||||||
|
@ -2303,7 +2303,7 @@ void TreeSupport::draw_circles(const std::vector<std::vector<Node*>>& contact_no
|
||||||
for (size_t i = 0; i <= bottom_gap_layers; i++)
|
for (size_t i = 0; i <= bottom_gap_layers; i++)
|
||||||
{
|
{
|
||||||
const Layer* below_layer = m_object->get_layer(layer_nr - bottom_interface_layers - i);
|
const Layer* below_layer = m_object->get_layer(layer_nr - bottom_interface_layers - i);
|
||||||
ExPolygons bottom_interface = std::move(intersection_ex(base_areas, below_layer->lslices));
|
ExPolygons bottom_interface = intersection_ex(base_areas, below_layer->lslices);
|
||||||
floor_areas.insert(floor_areas.end(), bottom_interface.begin(), bottom_interface.end());
|
floor_areas.insert(floor_areas.end(), bottom_interface.begin(), bottom_interface.end());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2315,7 +2315,7 @@ void TreeSupport::draw_circles(const std::vector<std::vector<Node*>>& contact_no
|
||||||
}
|
}
|
||||||
if (bottom_gap_layers > 0 && layer_nr > bottom_gap_layers) {
|
if (bottom_gap_layers > 0 && layer_nr > bottom_gap_layers) {
|
||||||
const Layer* below_layer = m_object->get_layer(layer_nr - bottom_gap_layers);
|
const Layer* below_layer = m_object->get_layer(layer_nr - bottom_gap_layers);
|
||||||
ExPolygons bottom_gap_area = std::move(intersection_ex(floor_areas, below_layer->lslices));
|
ExPolygons bottom_gap_area = intersection_ex(floor_areas, below_layer->lslices);
|
||||||
if (!bottom_gap_area.empty()) {
|
if (!bottom_gap_area.empty()) {
|
||||||
floor_areas = std::move(diff_ex(floor_areas, bottom_gap_area));
|
floor_areas = std::move(diff_ex(floor_areas, bottom_gap_area));
|
||||||
}
|
}
|
||||||
|
@ -2659,7 +2659,7 @@ void TreeSupport::drop_nodes(std::vector<std::vector<Node*>>& contact_nodes)
|
||||||
|
|
||||||
m_object->print()->set_status(60, (boost::format(_L("Support: propagate branches at layer %d")) % layer_nr).str());
|
m_object->print()->set_status(60, (boost::format(_L("Support: propagate branches at layer %d")) % layer_nr).str());
|
||||||
|
|
||||||
Polygons layer_contours = std::move(m_ts_data->get_contours_with_holes(layer_nr));
|
Polygons layer_contours = m_ts_data->get_contours_with_holes(layer_nr);
|
||||||
//std::unordered_map<Line, bool, LineHash>& mst_line_x_layer_contour_cache = m_mst_line_x_layer_contour_caches[layer_nr];
|
//std::unordered_map<Line, bool, LineHash>& mst_line_x_layer_contour_cache = m_mst_line_x_layer_contour_caches[layer_nr];
|
||||||
std::unordered_map<Line, bool, LineHash> mst_line_x_layer_contour_cache;
|
std::unordered_map<Line, bool, LineHash> mst_line_x_layer_contour_cache;
|
||||||
auto is_line_cut_by_contour = [&mst_line_x_layer_contour_cache,&layer_contours](Point a, Point b)
|
auto is_line_cut_by_contour = [&mst_line_x_layer_contour_cache,&layer_contours](Point a, Point b)
|
||||||
|
@ -3645,7 +3645,7 @@ const ExPolygons& TreeSupportData::calculate_collision(const RadiusLayerPair& ke
|
||||||
{
|
{
|
||||||
assert(key.layer_nr < m_layer_outlines.size());
|
assert(key.layer_nr < m_layer_outlines.size());
|
||||||
|
|
||||||
ExPolygons collision_areas = std::move(offset_ex(m_layer_outlines[key.layer_nr], scale_(key.radius)));
|
ExPolygons collision_areas = offset_ex(m_layer_outlines[key.layer_nr], scale_(key.radius));
|
||||||
const auto ret = m_collision_cache.insert({ key, std::move(collision_areas) });
|
const auto ret = m_collision_cache.insert({ key, std::move(collision_areas) });
|
||||||
return ret.first->second;
|
return ret.first->second;
|
||||||
}
|
}
|
||||||
|
@ -3677,7 +3677,7 @@ const ExPolygons& TreeSupportData::calculate_avoidance(const RadiusLayerPair& ke
|
||||||
}
|
}
|
||||||
|
|
||||||
layer_nr_next = layer_heights[layer_nr].next_layer_nr;
|
layer_nr_next = layer_heights[layer_nr].next_layer_nr;
|
||||||
ExPolygons avoidance_areas = std::move(offset_ex(get_avoidance(radius, layer_nr_next, key.recursions+1), scale_(-m_max_move)));
|
ExPolygons avoidance_areas = offset_ex(get_avoidance(radius, layer_nr_next, key.recursions+1), scale_(-m_max_move));
|
||||||
const ExPolygons &collision = get_collision(radius, layer_nr);
|
const ExPolygons &collision = get_collision(radius, layer_nr);
|
||||||
avoidance_areas.insert(avoidance_areas.end(), collision.begin(), collision.end());
|
avoidance_areas.insert(avoidance_areas.end(), collision.begin(), collision.end());
|
||||||
avoidance_areas = std::move(union_ex(avoidance_areas));
|
avoidance_areas = std::move(union_ex(avoidance_areas));
|
||||||
|
@ -3685,7 +3685,7 @@ const ExPolygons& TreeSupportData::calculate_avoidance(const RadiusLayerPair& ke
|
||||||
//assert(ret.second);
|
//assert(ret.second);
|
||||||
return ret.first->second;
|
return ret.first->second;
|
||||||
} else {
|
} else {
|
||||||
ExPolygons avoidance_areas = std::move(offset_ex(m_layer_outlines_below[layer_nr], scale_(m_xy_distance + radius)));
|
ExPolygons avoidance_areas = offset_ex(m_layer_outlines_below[layer_nr], scale_(m_xy_distance + radius));
|
||||||
auto ret = m_avoidance_cache.insert({ key, std::move(avoidance_areas) });
|
auto ret = m_avoidance_cache.insert({ key, std::move(avoidance_areas) });
|
||||||
assert(ret.second);
|
assert(ret.second);
|
||||||
return ret.first->second;
|
return ret.first->second;
|
||||||
|
|
|
@ -101,7 +101,7 @@ bool GLGizmoFdmSupports::on_init()
|
||||||
m_desc["smart_fill_angle"] = _L("Smart fill angle");
|
m_desc["smart_fill_angle"] = _L("Smart fill angle");
|
||||||
m_desc["on_overhangs_only"] = _L("On overhangs only");
|
m_desc["on_overhangs_only"] = _L("On overhangs only");
|
||||||
|
|
||||||
memset(&m_print_instance, sizeof(m_print_instance), 0);
|
memset(&m_print_instance, 0, sizeof(m_print_instance));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -459,7 +459,7 @@ public:
|
||||||
std::string get_left_preset_name(Preset::Type type);
|
std::string get_left_preset_name(Preset::Type type);
|
||||||
std::string get_right_preset_name(Preset::Type type);
|
std::string get_right_preset_name(Preset::Type type);
|
||||||
|
|
||||||
std::vector<std::string> get_selected_options(Preset::Type type) const { return std::move(m_tree->options(type, true)); }
|
std::vector<std::string> get_selected_options(Preset::Type type) const { return m_tree->options(type, true); }
|
||||||
|
|
||||||
std::array<Preset::Type, 3> types_list() const;
|
std::array<Preset::Type, 3> types_list() const;
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ bool ESP3D::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn
|
||||||
std::string short_name = get_short_name(upload_data.upload_path.string());
|
std::string short_name = get_short_name(upload_data.upload_path.string());
|
||||||
bool res = false;
|
bool res = false;
|
||||||
|
|
||||||
auto http = Http::post(std::move((boost::format("http://%1%/upload_serial") % m_host).str()));
|
auto http = Http::post((boost::format("http://%1%/upload_serial") % m_host).str());
|
||||||
http.header("Connection", "keep-alive")
|
http.header("Connection", "keep-alive")
|
||||||
.form_add_file("file", upload_data.source_path, short_name)
|
.form_add_file("file", upload_data.source_path, short_name)
|
||||||
.on_complete([&](std::string body, unsigned status) {
|
.on_complete([&](std::string body, unsigned status) {
|
||||||
|
@ -171,4 +171,4 @@ std::string ESP3D::format_command(const std::string& path, const std::string& ar
|
||||||
return (boost::format("http://%1%%2%?%3%=%4%") % m_host % path % arg % val).str();
|
return (boost::format("http://%1%%2%?%3%=%4%") % m_host % path % arg % val).str();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Slic3r
|
} // namespace Slic3r
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue