Fixing Clang warnings 2

This commit is contained in:
Lukas Matena 2021-01-29 17:12:06 +01:00
parent 0ff0444dcc
commit b85de89751
22 changed files with 70 additions and 107 deletions

View file

@ -653,7 +653,7 @@ inline bool intersect_ray_all_hits(
std::vector<igl::Hit> &hits)
{
auto ray_intersector = detail::RayIntersectorHits<VertexType, IndexedFaceType, TreeType, VectorType> {
vertices, faces, tree,
vertices, faces, {tree},
origin, dir, VectorType(dir.cwiseInverse())
};
if (! tree.empty()) {

View file

@ -12,7 +12,7 @@ class Surface;
class FillRectilinear : public Fill
{
public:
Fill* clone() const override { return new FillRectilinear(*this); };
Fill* clone() const override { return new FillRectilinear(*this); }
~FillRectilinear() override = default;
Polylines fill_surface(const Surface *surface, const FillParams &params) override;
@ -32,18 +32,18 @@ protected:
class FillAlignedRectilinear : public FillRectilinear
{
public:
Fill* clone() const override { return new FillAlignedRectilinear(*this); };
Fill* clone() const override { return new FillAlignedRectilinear(*this); }
~FillAlignedRectilinear() override = default;
protected:
// Always generate infill at the same angle.
virtual float _layer_angle(size_t idx) const { return 0.f; }
virtual float _layer_angle(size_t idx) const override { return 0.f; }
};
class FillMonotonic : public FillRectilinear
{
public:
Fill* clone() const override { return new FillMonotonic(*this); };
Fill* clone() const override { return new FillMonotonic(*this); }
~FillMonotonic() override = default;
Polylines fill_surface(const Surface *surface, const FillParams &params) override;
bool no_sort() const override { return true; }
@ -52,7 +52,7 @@ public:
class FillGrid : public FillRectilinear
{
public:
Fill* clone() const override { return new FillGrid(*this); };
Fill* clone() const override { return new FillGrid(*this); }
~FillGrid() override = default;
Polylines fill_surface(const Surface *surface, const FillParams &params) override;
@ -64,7 +64,7 @@ protected:
class FillTriangles : public FillRectilinear
{
public:
Fill* clone() const override { return new FillTriangles(*this); };
Fill* clone() const override { return new FillTriangles(*this); }
~FillTriangles() override = default;
Polylines fill_surface(const Surface *surface, const FillParams &params) override;
@ -76,7 +76,7 @@ protected:
class FillStars : public FillRectilinear
{
public:
Fill* clone() const override { return new FillStars(*this); };
Fill* clone() const override { return new FillStars(*this); }
~FillStars() override = default;
Polylines fill_surface(const Surface *surface, const FillParams &params) override;
@ -88,7 +88,7 @@ protected:
class FillCubic : public FillRectilinear
{
public:
Fill* clone() const override { return new FillCubic(*this); };
Fill* clone() const override { return new FillCubic(*this); }
~FillCubic() override = default;
Polylines fill_surface(const Surface *surface, const FillParams &params) override;
@ -98,6 +98,6 @@ protected:
};
}; // namespace Slic3r
} // namespace Slic3r
#endif // slic3r_FillRectilinear_hpp_

View file

@ -213,7 +213,7 @@ inline bool liang_barsky_line_clipping_interval(
double t0 = 0.0;
double t1 = 1.0;
// Traverse through left, right, bottom, top edges.
auto clip_side = [&x0, &v, &bbox, &t0, &t1](double p, double q) -> bool {
auto clip_side = [&t0, &t1](double p, double q) -> bool {
if (p == 0) {
if (q < 0)
// Line parallel to the bounding box edge is fully outside of the bounding box.

View file

@ -297,7 +297,7 @@ template<class Rst> class Grid {
case SquareTag::full:
case SquareTag::none: {
Coord crd{tl(cell) + Coord{m_cellsize.r / 2, m_cellsize.c / 2}};
return {{crd, Dir::none, m_rst}, crd};
return {{crd, Dir::none, m_rst}, {crd}};
}
}

View file

@ -41,7 +41,7 @@ template<> struct _ccr<true>
static void for_each(It from, It to, Fn &&fn, size_t granularity = 1)
{
tbb::parallel_for(tbb::blocked_range{from, to, granularity},
[&fn, from](const auto &range) {
[&fn](const auto &range) {
loop_(range, std::forward<Fn>(fn));
});
}

View file

@ -424,7 +424,7 @@ public:
void clear() override;
bool empty() const override { return m_objects.empty(); }
// List of existing PrintObject IDs, to remove notifications for non-existent IDs.
std::vector<ObjectID> print_object_ids() const;
std::vector<ObjectID> print_object_ids() const override;
ApplyStatus apply(const Model &model, DynamicPrintConfig config) override;
void set_task(const TaskParams &params) override;
void process() override;

View file

@ -1582,7 +1582,7 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::bottom_conta
});
Polygons &layer_support_area = layer_support_areas[layer_id];
task_group.run([this, &projection, &projection_raw, &layer, &layer_support_area, layer_id] {
task_group.run([this, &projection, &projection_raw, &layer, &layer_support_area] {
// Remove the areas that touched from the projection that will continue on next, lower, top surfaces.
// Polygons trimming = union_(to_polygons(layer.slices), touching, true);
Polygons trimming = offset(layer.lslices, float(SCALED_EPSILON));
@ -1736,7 +1736,7 @@ void PrintObjectSupportMaterial::trim_top_contacts_by_bottom_contacts(
const PrintObject &object, const MyLayersPtr &bottom_contacts, MyLayersPtr &top_contacts) const
{
tbb::parallel_for(tbb::blocked_range<int>(0, int(top_contacts.size())),
[this, &object, &bottom_contacts, &top_contacts](const tbb::blocked_range<int>& range) {
[&bottom_contacts, &top_contacts](const tbb::blocked_range<int>& range) {
int idx_bottom_overlapping_first = -2;
// For all top contact layers, counting downwards due to the way idx_higher_or_equal caches the last index to avoid repeated binary search.
for (int idx_top = range.end() - 1; idx_top >= range.begin(); -- idx_top) {
@ -1965,7 +1965,7 @@ void PrintObjectSupportMaterial::generate_base_layers(
BOOST_LOG_TRIVIAL(debug) << "PrintObjectSupportMaterial::generate_base_layers() in parallel - start";
tbb::parallel_for(
tbb::blocked_range<size_t>(0, intermediate_layers.size()),
[this, &object, &bottom_contacts, &top_contacts, &intermediate_layers, &layer_support_areas](const tbb::blocked_range<size_t>& range) {
[&object, &bottom_contacts, &top_contacts, &intermediate_layers, &layer_support_areas](const tbb::blocked_range<size_t>& range) {
// index -2 means not initialized yet, -1 means intialized and decremented to 0 and then -1.
int idx_top_contact_above = -2;
int idx_bottom_contact_overlapping = -2;
@ -2328,32 +2328,6 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::generate_int
return interface_layers;
}
static inline void fill_expolygons_generate_paths(
ExtrusionEntitiesPtr &dst,
const ExPolygons &expolygons,
Fill *filler,
float density,
ExtrusionRole role,
const Flow &flow)
{
FillParams fill_params;
fill_params.density = density;
fill_params.dont_adjust = true;
for (const ExPolygon &expoly : expolygons) {
Surface surface(stInternal, expoly);
Polylines polylines;
try {
polylines = filler->fill_surface(&surface, fill_params);
} catch (InfillFailedException &) {
}
extrusion_entities_append_paths(
dst,
std::move(polylines),
role,
flow.mm3_per_mm(), flow.width, flow.height);
}
}
static inline void fill_expolygons_generate_paths(
ExtrusionEntitiesPtr &dst,
ExPolygons &&expolygons,

View file

@ -246,7 +246,7 @@ private:
bool m_can_merge_support_regions;
coordf_t m_support_layer_height_min;
coordf_t m_support_layer_height_max;
// coordf_t m_support_layer_height_max;
coordf_t m_gap_xy;
};

View file

@ -10,15 +10,6 @@
#include <GL/glew.h>
// phi / theta angles to orient the camera.
static const float VIEW_DEFAULT[2] = { 45.0f, 45.0f };
static const float VIEW_LEFT[2] = { 90.0f, 90.0f };
static const float VIEW_RIGHT[2] = { -90.0f, 90.0f };
static const float VIEW_TOP[2] = { 0.0f, 0.0f };
static const float VIEW_BOTTOM[2] = { 0.0f, 180.0f };
static const float VIEW_FRONT[2] = { 0.0f, 90.0f };
static const float VIEW_REAR[2] = { 180.0f, 90.0f };
namespace Slic3r {
namespace GUI {

View file

@ -113,8 +113,8 @@ public:
void field_changed() { on_change_field(); }
Field(const ConfigOptionDef& opt, const t_config_option_key& id) : m_opt(opt), m_opt_id(id) {};
Field(wxWindow* parent, const ConfigOptionDef& opt, const t_config_option_key& id) : m_parent(parent), m_opt(opt), m_opt_id(id) {};
Field(const ConfigOptionDef& opt, const t_config_option_key& id) : m_opt(opt), m_opt_id(id) {}
Field(wxWindow* parent, const ConfigOptionDef& opt, const t_config_option_key& id) : m_parent(parent), m_opt(opt), m_opt_id(id) {}
virtual ~Field();
/// If you don't know what you are getting back, check both methods for nullptr.
@ -315,12 +315,12 @@ public:
/// Propagate value from field to the OptionGroupe and Config after kill_focus/ENTER
void propagate_value() ;
void set_value(const std::string& value, bool change_event = false) {
void set_value(const std::string& value, bool change_event = false) {
m_disable_change_event = !change_event;
dynamic_cast<wxSpinCtrl*>(window)->SetValue(value);
m_disable_change_event = false;
}
void set_value(const boost::any& value, bool change_event = false) {
}
void set_value(const boost::any& value, bool change_event = false) override {
m_disable_change_event = !change_event;
tmp_value = boost::any_cast<int>(value);
m_value = value;
@ -395,8 +395,8 @@ public:
boost::any& get_value() override;
void msw_rescale() override;
void enable() override { dynamic_cast<wxColourPickerCtrl*>(window)->Enable(); };
void disable() override{ dynamic_cast<wxColourPickerCtrl*>(window)->Disable(); };
void enable() override { dynamic_cast<wxColourPickerCtrl*>(window)->Enable(); }
void disable() override{ dynamic_cast<wxColourPickerCtrl*>(window)->Disable(); }
wxWindow* getWindow() override { return window; }
};
@ -456,8 +456,8 @@ public:
void msw_rescale() override;
void enable() override { dynamic_cast<wxStaticText*>(window)->Enable(); };
void disable() override{ dynamic_cast<wxStaticText*>(window)->Disable(); };
void enable() override { dynamic_cast<wxStaticText*>(window)->Enable(); }
void disable() override{ dynamic_cast<wxStaticText*>(window)->Disable(); }
wxWindow* getWindow() override { return window; }
};

View file

@ -2771,7 +2771,7 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool
return color;
};
auto travel_color = [this](const Path& path) {
auto travel_color = [](const Path& path) {
return (path.delta_extruder < 0.0f) ? Travel_Colors[2] /* Retract */ :
((path.delta_extruder > 0.0f) ? Travel_Colors[1] /* Extrude */ :
Travel_Colors[0] /* Move */);
@ -3436,7 +3436,7 @@ void GCodeViewer::render_toolpaths() const
shader.set_uniform("uniform_color", color4);
};
auto render_as_points = [this, zoom, point_size, near_plane_height, set_uniform_color]
auto render_as_points = [zoom, point_size, near_plane_height, set_uniform_color]
(const TBuffer& buffer, unsigned int ibuffer_id, GLShaderProgram& shader) {
#if ENABLE_FIXED_SCREEN_SIZE_POINT_MARKERS
shader.set_uniform("use_fixed_screen_size", 1);
@ -3466,7 +3466,7 @@ void GCodeViewer::render_toolpaths() const
glsafe(::glDisable(GL_VERTEX_PROGRAM_POINT_SIZE));
};
auto render_as_lines = [this, light_intensity, set_uniform_color](const TBuffer& buffer, unsigned int ibuffer_id, GLShaderProgram& shader) {
auto render_as_lines = [light_intensity, set_uniform_color](const TBuffer& buffer, unsigned int ibuffer_id, GLShaderProgram& shader) {
shader.set_uniform("light_intensity", light_intensity);
for (const RenderPath& path : buffer.render_paths) {
if (path.index_buffer_id == ibuffer_id) {
@ -3479,7 +3479,7 @@ void GCodeViewer::render_toolpaths() const
}
};
auto render_as_triangles = [this, set_uniform_color](const TBuffer& buffer, unsigned int ibuffer_id, GLShaderProgram& shader) {
auto render_as_triangles = [set_uniform_color](const TBuffer& buffer, unsigned int ibuffer_id, GLShaderProgram& shader) {
for (const RenderPath& path : buffer.render_paths) {
if (path.index_buffer_id == ibuffer_id) {
set_uniform_color(path.color, shader);
@ -3874,8 +3874,8 @@ void GCodeViewer::render_legend() const
ImGui::PopStyleVar();
};
auto append_range = [this, draw_list, &imgui, append_item](const Extrusions::Range& range, unsigned int decimals) {
auto append_range_item = [this, draw_list, &imgui, append_item](int i, float value, unsigned int decimals) {
auto append_range = [append_item](const Extrusions::Range& range, unsigned int decimals) {
auto append_range_item = [append_item](int i, float value, unsigned int decimals) {
char buf[1024];
::sprintf(buf, "%.*f", decimals, value);
append_item(EItemType::Rect, Range_Colors[i], buf);
@ -3969,7 +3969,7 @@ void GCodeViewer::render_legend() const
return _u8L("from") + " " + std::string(buf1) + " " + _u8L("to") + " " + std::string(buf2) + " " + _u8L("mm");
};
auto role_time_and_percent = [this, time_mode](ExtrusionRole role) {
auto role_time_and_percent = [ time_mode](ExtrusionRole role) {
auto it = std::find_if(time_mode.roles_times.begin(), time_mode.roles_times.end(), [role](const std::pair<ExtrusionRole, float>& item) { return role == item.first; });
return (it != time_mode.roles_times.end()) ? std::make_pair(it->second, it->second / time_mode.time) : std::make_pair(0.0f, 0.0f);
};
@ -4177,7 +4177,7 @@ void GCodeViewer::render_legend() const
return items;
};
auto append_color_change = [this, &imgui](const Color& color1, const Color& color2, const std::array<float, 2>& offsets, const Times& times) {
auto append_color_change = [&imgui](const Color& color1, const Color& color2, const std::array<float, 2>& offsets, const Times& times) {
imgui.text(_u8L("Color change"));
ImGui::SameLine();
@ -4196,7 +4196,7 @@ void GCodeViewer::render_legend() const
imgui.text(short_time(get_time_dhms(times.second - times.first)));
};
auto append_print = [this, &imgui](const Color& color, const std::array<float, 2>& offsets, const Times& times) {
auto append_print = [&imgui](const Color& color, const std::array<float, 2>& offsets, const Times& times) {
imgui.text(_u8L("Print"));
ImGui::SameLine();

View file

@ -394,7 +394,6 @@ class GLCanvas3D
class Slope
{
bool m_enabled{ false };
bool m_dialog_shown{ false };
GLCanvas3D& m_canvas;
GLVolumeCollection& m_volumes;
static float s_window_width;

View file

@ -35,7 +35,7 @@ void disable_screensaver()
{
#if __APPLE__
CFStringRef reasonForActivity = CFSTR("Slic3r");
IOReturn success = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep,
[[maybe_unused]]IOReturn success = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep,
kIOPMAssertionLevelOn, reasonForActivity, &assertionID);
// ignore result: success == kIOReturnSuccess
#elif _WIN32
@ -46,7 +46,7 @@ void disable_screensaver()
void enable_screensaver()
{
#if __APPLE__
IOReturn success = IOPMAssertionRelease(assertionID);
IOPMAssertionRelease(assertionID);
#elif _WIN32
SetThreadExecutionState(ES_CONTINUOUS);
#endif

View file

@ -31,17 +31,17 @@ public:
std::string get_tooltip() const override;
protected:
virtual bool on_init();
virtual void on_load(cereal::BinaryInputArchive& ar) { ar(m_cut_z, m_keep_upper, m_keep_lower, m_rotate_lower); }
virtual void on_save(cereal::BinaryOutputArchive& ar) const { ar(m_cut_z, m_keep_upper, m_keep_lower, m_rotate_lower); }
virtual std::string on_get_name() const;
virtual void on_set_state();
virtual bool on_is_activable() const;
virtual void on_start_dragging();
virtual void on_update(const UpdateData& data);
virtual void on_render() const;
virtual void on_render_for_picking() const;
virtual void on_render_input_window(float x, float y, float bottom_limit);
virtual bool on_init() override;
virtual void on_load(cereal::BinaryInputArchive& ar) override{ ar(m_cut_z, m_keep_upper, m_keep_lower, m_rotate_lower); }
virtual void on_save(cereal::BinaryOutputArchive& ar) const override { ar(m_cut_z, m_keep_upper, m_keep_lower, m_rotate_lower); }
virtual std::string on_get_name() const override;
virtual void on_set_state() override;
virtual bool on_is_activable() const override;
virtual void on_start_dragging() override;
virtual void on_update(const UpdateData& data) override;
virtual void on_render() const override;
virtual void on_render_for_picking() const override;
virtual void on_render_input_window(float x, float y, float bottom_limit) override;
private:
void update_max_z(const Selection& selection) const;

View file

@ -33,14 +33,14 @@ public:
std::string get_tooltip() const override;
protected:
virtual bool on_init();
virtual std::string on_get_name() const;
virtual bool on_is_activable() const;
virtual void on_start_dragging();
virtual void on_stop_dragging();
virtual void on_update(const UpdateData& data);
virtual void on_render() const;
virtual void on_render_for_picking() const;
virtual bool on_init() override;
virtual std::string on_get_name() const override;
virtual bool on_is_activable() const override;
virtual void on_start_dragging() override;
virtual void on_stop_dragging() override;
virtual void on_update(const UpdateData& data) override;
virtual void on_render() const override;
virtual void on_render_for_picking() const override;
private:
double calc_projection(const UpdateData& data) const;

View file

@ -59,8 +59,8 @@ class GLGizmoPainterBase : public GLGizmoBase
private:
ObjectID m_old_mo_id;
size_t m_old_volumes_size = 0;
virtual void on_render() const {}
virtual void on_render_for_picking() const {}
virtual void on_render() const override {}
virtual void on_render_for_picking() const override {}
public:
GLGizmoPainterBase(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id);

View file

@ -47,13 +47,13 @@ public:
std::string get_tooltip() const override;
protected:
virtual bool on_init();
virtual std::string on_get_name() const;
virtual bool on_is_activable() const;
virtual void on_start_dragging();
virtual void on_update(const UpdateData& data);
virtual void on_render() const;
virtual void on_render_for_picking() const;
virtual bool on_init() override;
virtual std::string on_get_name() const override;
virtual bool on_is_activable() const override;
virtual void on_start_dragging() override;
virtual void on_update(const UpdateData& data) override;
virtual void on_render() const override;
virtual void on_render_for_picking() const override;
private:
void render_grabbers_connection(unsigned int id_1, unsigned int id_2) const;

View file

@ -161,7 +161,7 @@ protected:
private:
ModelObject* m_model_object = nullptr;
int m_active_inst = -1;
// int m_active_inst = -1;
float m_z_shift = 0.f;
};

View file

@ -133,7 +133,7 @@ class MainFrame : public DPIFrame
ESettingsLayout m_layout{ ESettingsLayout::Unknown };
protected:
virtual void on_dpi_changed(const wxRect &suggested_rect);
virtual void on_dpi_changed(const wxRect &suggested_rect) override;
virtual void on_sys_color_changed() override;
public:

View file

@ -273,7 +273,6 @@ private:
const DynamicPrintConfig* m_config {nullptr};
// If the config is modelconfig, then ModelConfig::touch() has to be called after value change.
ModelConfig* m_modelconfig { nullptr };
bool m_full_labels{ 0 };
t_opt_map m_opt_map;
std::string m_config_category;

View file

@ -20,7 +20,7 @@ public:
OctoPrint(DynamicPrintConfig *config);
~OctoPrint() override = default;
const char* get_name() const;
const char* get_name() const override;
bool test(wxString &curl_msg) const override;
wxString get_test_ok_msg () const override;

View file

@ -19,7 +19,7 @@ public:
Repetier(DynamicPrintConfig *config);
~Repetier() override = default;
const char* get_name() const;
const char* get_name() const override;
bool test(wxString &curl_msg) const override;
wxString get_test_ok_msg () const override;