Fixed Clang 12 compiler warnings.

This commit is contained in:
Lukáš Hejl 2022-01-28 14:51:08 +01:00
parent 383f6509a9
commit 46c827c7fc
8 changed files with 15 additions and 7 deletions

View File

@ -239,6 +239,11 @@ if (NOT MSVC AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMP
add_compile_options(-Wno-deprecated-declarations) add_compile_options(-Wno-deprecated-declarations)
endif() endif()
# Clang reports misleading indentation for some IF blocks because of mixing tabs with spaces.
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
add_compile_options(-Wno-misleading-indentation)
endif()
#GCC generates loads of -Wunknown-pragmas when compiling igl. The fix is not easy due to a bug in gcc, see #GCC generates loads of -Wunknown-pragmas when compiling igl. The fix is not easy due to a bug in gcc, see
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66943 or # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66943 or
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431

View File

@ -2391,7 +2391,7 @@ static std::vector<MonotonicRegionLink> chain_monotonic_regions(
// Probability (unnormalized) of traversing a link between two monotonic regions. // Probability (unnormalized) of traversing a link between two monotonic regions.
auto path_probability = [ auto path_probability = [
#ifndef __APPLE__ #if !defined(__APPLE__) && !defined(__clang__)
// clang complains when capturing constexpr constants. // clang complains when capturing constexpr constants.
pheromone_alpha, pheromone_beta pheromone_alpha, pheromone_beta
#endif // __APPLE__ #endif // __APPLE__

View File

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

View File

@ -17,7 +17,8 @@ class MultiPoint
public: public:
Points points; Points points;
MultiPoint() {} MultiPoint() = default;
virtual ~MultiPoint() = default;
MultiPoint(const MultiPoint &other) : points(other.points) {} MultiPoint(const MultiPoint &other) : points(other.points) {}
MultiPoint(MultiPoint &&other) : points(std::move(other.points)) {} MultiPoint(MultiPoint &&other) : points(std::move(other.points)) {}
MultiPoint(std::initializer_list<Point> list) : points(list) {} MultiPoint(std::initializer_list<Point> list) : points(list) {}

View File

@ -19,7 +19,7 @@ class Polygon : public MultiPoint
{ {
public: public:
Polygon() = default; Polygon() = default;
virtual ~Polygon() = default; ~Polygon() override = default;
explicit Polygon(const Points &points) : MultiPoint(points) {} explicit Polygon(const Points &points) : MultiPoint(points) {}
Polygon(std::initializer_list<Point> points) : MultiPoint(points) {} Polygon(std::initializer_list<Point> points) : MultiPoint(points) {}
Polygon(const Polygon &other) : MultiPoint(other.points) {} Polygon(const Polygon &other) : MultiPoint(other.points) {}

View File

@ -16,7 +16,8 @@ typedef std::vector<ThickPolyline> ThickPolylines;
class Polyline : public MultiPoint { class Polyline : public MultiPoint {
public: public:
Polyline() {}; Polyline() = default;
~Polyline() override = default;
Polyline(const Polyline &other) : MultiPoint(other.points) {} Polyline(const Polyline &other) : MultiPoint(other.points) {}
Polyline(Polyline &&other) : MultiPoint(std::move(other.points)) {} Polyline(Polyline &&other) : MultiPoint(std::move(other.points)) {}
Polyline(std::initializer_list<Point> list) : MultiPoint(list) {} Polyline(std::initializer_list<Point> list) : MultiPoint(list) {}

View File

@ -654,7 +654,7 @@ void FirmwareDialog::priv::perform_upload()
} }
}) })
.on_message([ .on_message([
#ifndef __APPLE__ #if !defined(__APPLE__) && !defined(__clang__)
// clang complains when capturing constants. // clang complains when capturing constants.
extra_verbose, extra_verbose,
#endif // __APPLE__ #endif // __APPLE__

View File

@ -185,7 +185,7 @@ public:
OptionsGroup( wxWindow* _parent, const wxString& title, bool is_tab_opt = false, OptionsGroup( wxWindow* _parent, const wxString& title, bool is_tab_opt = false,
column_t extra_clmn = nullptr); column_t extra_clmn = nullptr);
~OptionsGroup() { clear(true); } virtual ~OptionsGroup() { clear(true); }
wxGridSizer* get_grid_sizer() { return m_grid_sizer; } wxGridSizer* get_grid_sizer() { return m_grid_sizer; }
const std::vector<Line>& get_lines() { return m_lines; } const std::vector<Line>& get_lines() { return m_lines; }
@ -253,6 +253,7 @@ public:
OptionsGroup(parent, title, is_tab_opt, extra_clmn), m_config(&config->get()), m_modelconfig(config) {} OptionsGroup(parent, title, is_tab_opt, extra_clmn), m_config(&config->get()), m_modelconfig(config) {}
ConfigOptionsGroup( wxWindow* parent) : ConfigOptionsGroup( wxWindow* parent) :
OptionsGroup(parent, wxEmptyString, true, nullptr) {} OptionsGroup(parent, wxEmptyString, true, nullptr) {}
~ConfigOptionsGroup() override = default;
const wxString& config_category() const throw() { return m_config_category; } const wxString& config_category() const throw() { return m_config_category; }
int config_type() const throw() { return m_config_type; } int config_type() const throw() { return m_config_type; }