Fix Linux build & some warnings (#6438)

* Fix linux deps debug build

* Use the same DL_CACHE for release build when building debug version of deps on Linux.
This prevents downloading the same source packages twice, and avoid downloading again after deleting the build dir.

* Fix debug build

* Fix warnings "loop variable creates a copy from type" and "loop variable binds to a temporary constructed from type"
This commit is contained in:
Noisyfox
2024-08-18 11:33:00 +08:00
committed by GitHub
parent 0d886a133f
commit f136f04cfd
17 changed files with 45 additions and 38 deletions

View File

@@ -23,7 +23,7 @@ Clipper2Lib::Paths64 Slic3rPoints_to_Paths64(const std::vector<T>& in)
{
Clipper2Lib::Paths64 out;
out.reserve(in.size());
for (const T item: in) {
for (const T& item: in) {
Clipper2Lib::Path64 path;
path.reserve(item.size());
for (const Slic3r::Point& point : item.points)

View File

@@ -334,8 +334,8 @@ bool Emboss::divide_segments_for_close_point(ExPolygons &expolygons, double dist
const Points &poly_pts = poly.points;
const Point &line_a = poly_pts[id.point_index];
const Point &line_b = (!ids.is_last_point(id)) ? poly_pts[id.point_index + 1] : poly_pts.front();
assert(line_a == lines[index].a.cast<int>());
assert(line_b == lines[index].b.cast<int>());
assert(line_a == lines[index].a.cast<coord_t>());
assert(line_b == lines[index].b.cast<coord_t>());
if (p == line_a || p == line_b) continue;
divs.emplace_back(p, index);

View File

@@ -4622,7 +4622,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
its.vertices.assign(sub_object->geometry.vertices.begin(), sub_object->geometry.vertices.end());
// BBS
for (const std::string prop_str : sub_object->geometry.face_properties) {
for (const std::string& prop_str : sub_object->geometry.face_properties) {
FaceProperty face_prop;
face_prop.from_string(prop_str);
its.properties.push_back(face_prop);

View File

@@ -3538,7 +3538,7 @@ void check_model_ids_validity(const Model &model)
for (const ModelInstance *model_instance : model_object->instances)
check(model_instance->id());
}
for (const auto mm : model.materials) {
for (const auto& mm : model.materials) {
check(mm.second->id());
check(mm.second->config.id());
}

View File

@@ -340,7 +340,7 @@ void Preset::normalize(DynamicPrintConfig &config)
static_cast<ConfigOptionVectorBase*>(opt)->resize(n, defaults.option(key));
}
// The following keys are mandatory for the UI, but they are not part of FullPrintConfig, therefore they are handled separately.
for (const std::string &key : { "filament_settings_id" }) {
for (const std::string key : { "filament_settings_id" }) {
auto *opt = config.option(key, false);
assert(opt == nullptr || opt->type() == coStrings);
if (opt != nullptr && opt->type() == coStrings)

View File

@@ -2925,7 +2925,7 @@ DynamicConfig PrintStatistics::config() const
DynamicConfig PrintStatistics::placeholders()
{
DynamicConfig config;
for (const std::string &key : {
for (const std::string key : {
"print_time", "normal_print_time", "silent_print_time",
"used_filament", "extruded_volume", "total_cost", "total_weight",
"initial_tool", "total_toolchanges", "total_wipe_tower_cost", "total_wipe_tower_filament"})

View File

@@ -5329,11 +5329,11 @@ void PrintConfigDef::init_extruder_option_keys()
"retraction_length",
"retraction_minimum_travel",
"retraction_speed",
"travel_slope",
"wipe",
"wipe_distance",
"z_hop",
"z_hop_types",
"travel_slope"
"z_hop_types"
};
assert(std::is_sorted(m_extruder_retract_keys.begin(), m_extruder_retract_keys.end()));
}

View File

@@ -29,7 +29,7 @@ template<typename T> inline void reorder_by_shortest_traverse(std::vector<T> &po
{
Points start_point;
start_point.reserve(polylines_out.size());
for (const T contour : polylines_out) start_point.push_back(contour.points.front());
for (const T& contour : polylines_out) start_point.push_back(contour.points.front());
std::vector<Points::size_type> order = chain_points(start_point);

View File

@@ -482,7 +482,7 @@ static bool move_inside_expolys(const ExPolygons& polygons, Point& from, double
// because we compare with vsize2_with_unscale here (no division by zero), we also need to compare by vsize2_with_unscale inside the loop
// to avoid integer rounding edge cases
bool projected_p_beyond_prev_segment = dot_with_unscale(p1 - p0, from - p0) >= vsize2_with_unscale(p1 - p0);
for(const Point p2 : poly.contour.points)
for(const Point& p2 : poly.contour.points)
{
// X = A + Normal(B-A) * (((B-A) dot_with_unscale (P-A)) / VSize(B-A));
// = A + (B-A) * ((B-A) dot_with_unscale (P-A)) / VSize2(B-A);
@@ -1437,11 +1437,11 @@ void TreeSupport::generate_toolpaths()
if (m_object->support_layer_count() > m_raft_layers) {
const SupportLayer *ts_layer = m_object->get_support_layer(m_raft_layers);
for (const ExPolygon expoly : ts_layer->floor_areas)
for (const ExPolygon& expoly : ts_layer->floor_areas)
raft_areas.push_back(expoly);
for (const ExPolygon expoly : ts_layer->roof_areas)
for (const ExPolygon& expoly : ts_layer->roof_areas)
raft_areas.push_back(expoly);
for (const ExPolygon expoly : ts_layer->base_areas)
for (const ExPolygon& expoly : ts_layer->base_areas)
raft_areas.push_back(expoly);
}
@@ -3628,7 +3628,7 @@ const ExPolygons& TreeSupportData::get_avoidance(coordf_t radius, size_t layer_n
Polygons TreeSupportData::get_contours(size_t layer_nr) const
{
Polygons contours;
for (const ExPolygon expoly : m_layer_outlines[layer_nr]) {
for (const ExPolygon& expoly : m_layer_outlines[layer_nr]) {
contours.push_back(expoly.contour);
}
@@ -3638,7 +3638,7 @@ Polygons TreeSupportData::get_contours(size_t layer_nr) const
Polygons TreeSupportData::get_contours_with_holes(size_t layer_nr) const
{
Polygons contours;
for (const ExPolygon expoly : m_layer_outlines[layer_nr]) {
for (const ExPolygon& expoly : m_layer_outlines[layer_nr]) {
for(int i=0;i<expoly.num_contours();i++)
contours.push_back(expoly.contour_or_hole(i));
}