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)
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
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66943 or
# 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.
auto path_probability = [
#ifndef __APPLE__
#if !defined(__APPLE__) && !defined(__clang__)
// clang complains when capturing constexpr constants.
pheromone_alpha, pheromone_beta
#endif // __APPLE__

View File

@ -2264,7 +2264,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

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

View File

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

View File

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

View File

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

View File

@ -185,7 +185,7 @@ public:
OptionsGroup( wxWindow* _parent, const wxString& title, bool is_tab_opt = false,
column_t extra_clmn = nullptr);
~OptionsGroup() { clear(true); }
virtual ~OptionsGroup() { clear(true); }
wxGridSizer* get_grid_sizer() { return m_grid_sizer; }
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) {}
ConfigOptionsGroup( wxWindow* parent) :
OptionsGroup(parent, wxEmptyString, true, nullptr) {}
~ConfigOptionsGroup() override = default;
const wxString& config_category() const throw() { return m_config_category; }
int config_type() const throw() { return m_config_type; }