Merge pull request #5340 from danston/CGAL-clang_warnings_fix-danston

Clang warnings fixed
This commit is contained in:
Laurent Rineau 2021-02-05 16:10:37 +01:00
commit 4c947f0ee0
18 changed files with 40 additions and 41 deletions

View File

@ -159,11 +159,11 @@ namespace CGAL {
{ return CK_Equal_2()(a0, a1); }
result_type
operator() ( const Line_arc_2 &a0, const Circular_arc_2 &a1) const
operator() ( const Line_arc_2 &/*a0*/, const Circular_arc_2 &/*a1*/) const
{ return false; }
result_type
operator() ( const Circular_arc_2 &a0, const Line_arc_2 &a1) const
operator() ( const Circular_arc_2 &/*a0*/, const Line_arc_2 &/*a1*/) const
{ return false; }
result_type

View File

@ -123,7 +123,7 @@ public:
CGAL_precondition (m_labels.is_valid_ground_truth (ground_truth));
CGAL_precondition (m_labels.is_valid_ground_truth (result));
for (const auto& p : CGAL::make_range
for (const auto p : CGAL::make_range
(boost::make_zip_iterator(boost::make_tuple(ground_truth.begin(), result.begin())),
boost::make_zip_iterator(boost::make_tuple(ground_truth.end(), result.end()))))
{

View File

@ -47,7 +47,7 @@ void test_const_vertex_handles(
auto lit = hds_list.vertices_begin();
assert(hds_list.vertex_handles().size() == 1);
for (const auto vh : hds_list.vertex_handles()) {
for (const auto& vh : hds_list.vertex_handles()) {
assert(vh == lit);
assert(vh->point() == lit->point());
assert(vh->halfedge() == lit->halfedge());
@ -57,7 +57,7 @@ void test_const_vertex_handles(
auto vit = hds_vector.vertices_begin();
assert(hds_vector.vertex_handles().size() == 1);
for (const auto vh : hds_vector.vertex_handles()) {
for (const auto& vh : hds_vector.vertex_handles()) {
assert(vh == vit);
assert(vh->point() == vit->point());
assert(vh->halfedge() == vit->halfedge());
@ -97,7 +97,7 @@ void test_const_face_handles(
auto lit = hds_list.faces_begin();
assert(hds_list.face_handles().size() == 2);
for (const auto fh : hds_list.face_handles()) {
for (const auto& fh : hds_list.face_handles()) {
assert(fh == lit);
assert(fh->plane() == lit->plane());
assert(fh->halfedge() == lit->halfedge());
@ -107,7 +107,7 @@ void test_const_face_handles(
auto vit = hds_vector.faces_begin();
assert(hds_vector.face_handles().size() == 2);
for (const auto fh : hds_vector.face_handles()) {
for (const auto& fh : hds_vector.face_handles()) {
assert(fh == vit);
assert(fh->plane() == vit->plane());
assert(fh->halfedge() == vit->halfedge());
@ -147,7 +147,7 @@ void test_const_halfedge_handles(
auto lit = hds_list.halfedges_begin();
assert(hds_list.halfedge_handles().size() == 2);
for (const auto hh : hds_list.halfedge_handles()) {
for (const auto& hh : hds_list.halfedge_handles()) {
assert(hh == lit);
assert(hh->face() == lit->face());
assert(hh->vertex() == lit->vertex());
@ -157,7 +157,7 @@ void test_const_halfedge_handles(
auto vit = hds_vector.halfedges_begin();
assert(hds_vector.halfedge_handles().size() == 2);
for (const auto hh : hds_vector.halfedge_handles()) {
for (const auto& hh : hds_vector.halfedge_handles()) {
assert(hh == vit);
assert(hh->face() == vit->face());
assert(hh->vertex() == vit->vertex());

View File

@ -301,7 +301,7 @@ bool build_infinite_cells(Tr& tr,
#endif
// add the facets to the incident cells map
for (const Cell_handle c : infinite_cells)
for (const Cell_handle& c : infinite_cells)
if(!add_infinite_facets_to_incident_cells_map<Tr>(c, 0, incident_cells_map, verbose))
return false;

View File

@ -36,7 +36,7 @@ int main(int argc, char** argv)
// one can associate positions to the vertices of the mesh without changing the mesh
std::unordered_map<vertex_descriptor, Point> translated_positions;
for(const vertex_descriptor v : vertices(sm))
for(const vertex_descriptor& v : vertices(sm))
translated_positions[v] = sm.point(v) + Vector(1, 2, 3);
CGAL::oriented_bounding_box(sm, obb_points,
@ -44,7 +44,7 @@ int main(int argc, char** argv)
// using a range of points
std::vector<Point> points;
for(const vertex_descriptor v : vertices(sm))
for(const vertex_descriptor& v : vertices(sm))
points.push_back(sm.point(v));
CGAL::oriented_bounding_box(points, obb_points);

View File

@ -91,7 +91,7 @@ void test_OBB_of_mesh(const std::string fname,
}
std::vector<Point> points;
for(const auto v : vertices(mesh))
for(const auto& v : vertices(mesh))
points.push_back(v->point());
test_OBB_data(points, expected_vol);

View File

@ -135,7 +135,7 @@ int main(int argc, char * argv[])
struct A{};
std::vector< std::pair<Point, A> > points_bis;
points_bis.reserve(points.size());
for (const Point p : points)
for (const Point& p : points)
points_bis.push_back( std::make_pair(p, A()) );
test_avg_knn_sq_distance(points_bis, nb_neighbors_remove_outliers, removed_percentage,
CGAL::First_of_pair_property_map<std::pair<Point,A>>());

View File

@ -38,7 +38,7 @@ void test_const_vertex_handles_and_points(
auto pit = polyhedron.points_begin();
auto vit = polyhedron.vertices_begin();
for (const auto vh : polyhedron.vertex_handles()) {
for (const auto& vh : polyhedron.vertex_handles()) {
assert(vh == vit);
assert(vh->point() == vit->point());
assert(vh->point() == *pit);
@ -88,7 +88,7 @@ void test_const_facet_handles_and_planes(
auto pit = polyhedron.planes_begin();
auto fit = polyhedron.facets_begin();
for (const auto fh : polyhedron.facet_handles()) {
for (const auto& fh : polyhedron.facet_handles()) {
assert(fh == fit);
assert(fh->plane() == fit->plane());
assert(fh->plane() == *pit);
@ -133,7 +133,7 @@ void test_const_halfedge_handles_and_edges(
const Polyhedron& polyhedron) {
auto hit = polyhedron.halfedges_begin();
for (const auto hh : polyhedron.halfedge_handles()) {
for (const auto& hh : polyhedron.halfedge_handles()) {
assert(hh == hit);
assert(hh->facet() == hit->facet());
assert(hh->vertex() == hit->vertex());

View File

@ -47,7 +47,7 @@ int main()
// neighbor search returns a set of pair of
// point and distance <Point_3,FT>, here we
// keep the points only
for (const Point_with_distance& pwd : search)
for (const Point_with_distance pwd : search)
neighbors[s].push_back (pwd.first);
}
});

View File

@ -50,8 +50,7 @@ struct Compact_metric_point_proxy
// fitting center
Vector_3 center = CGAL::NULL_VECTOR;
FT sum_areas = FT(0.0);
for(const face_descriptor f : faces)
{
for(const face_descriptor& f : faces) {
center = center + (center_pmap[f] - CGAL::ORIGIN) * area_pmap[f];
sum_areas += area_pmap[f];
}

View File

@ -127,7 +127,7 @@ public:
// fitting normal
Vector_3 norm = CGAL::NULL_VECTOR;
for(const face_descriptor f : faces) {
for(const face_descriptor& f : faces) {
norm = m_sum_functor(norm,
m_scale_functor(get(m_fnmap, f), get(m_famap, f)));
}

View File

@ -125,7 +125,7 @@ public:
CGAL_assertion(!faces.empty());
std::list<Triangle_3> tris;
for(const face_descriptor f : faces) {
for(const face_descriptor& f : faces) {
const halfedge_descriptor he = halfedge(f, *m_tm);
const Point_3 &p0 = m_vpmap[source(he, *m_tm)];
const Point_3 &p1 = m_vpmap[target(he, *m_tm)];

View File

@ -1552,7 +1552,7 @@ private:
std::cerr << "#chord_anchor " << m_bcycles.back().num_anchors << std::endl;
#endif
for(const halfedge_descriptor he : chord)
for(const halfedge_descriptor& he : chord)
he_candidates.erase(he);
} while (he_start != he_mark);
}
@ -1600,7 +1600,7 @@ private:
FT dist_max(0.0);
chord_vec = scale_functor(chord_vec,
FT(1.0) / CGAL::approximate_sqrt(chord_vec.squared_length()));
for(const halfedge_descriptor he : chord) {
for(const halfedge_descriptor& he : chord) {
Vector_3 vec = vector_functor(pt_begin, m_vpoint_map[target(he, *m_ptm)]);
vec = cross_product_functor(chord_vec, vec);
const FT dist = CGAL::approximate_sqrt(vec.squared_length());
@ -1612,7 +1612,7 @@ private:
}
else {
FT dist_max(0.0);
for(const halfedge_descriptor he : chord) {
for(const halfedge_descriptor& he : chord) {
const FT dist = CGAL::approximate_sqrt(CGAL::squared_distance(
pt_begin, m_vpoint_map[target(he, *m_ptm)]));
if (dist > dist_max) {

View File

@ -46,7 +46,7 @@ struct Compact_metric_point_proxy {
// fitting center
Vector_3 center = CGAL::NULL_VECTOR;
FT sum_areas = FT(0.0);
for(const face_descriptor f : faces) {
for(const face_descriptor& f : faces) {
center = center + (center_pmap[f] - CGAL::ORIGIN) * area_pmap[f];
sum_areas += area_pmap[f];
}

View File

@ -104,7 +104,7 @@ int main()
CGAL::Bbox_3 bbox;
for(const vertex_descriptor v : vertices(mesh))
for(const vertex_descriptor& v : vertices(mesh))
bbox += vpmap[v].bbox();
const FT ymin = bbox.ymin(), ymax = bbox.ymax(), yrange = ymax - ymin;
std::cout << "Range along y axis: [" << ymin << ", " << ymax << "]" << std::endl;
@ -113,7 +113,7 @@ int main()
std::size_t planar_pxidx = static_cast<std::size_t>(-1);
std::size_t num_planar_faces = 0;
bool first = true;
for(const face_descriptor f : faces(mesh)) {
for(const face_descriptor& f : faces(mesh)) {
const halfedge_descriptor he = halfedge(f, mesh);
const Point_3 &p0 = vpmap[source(he, mesh)];
const Point_3 &p1 = vpmap[target(he, mesh)];

View File

@ -491,7 +491,7 @@ add_shape_optimization_constraints(const vertex_descriptor_vector& link)
0.0, 0.0, s);
Vector c = NULL_VECTOR;
for(const vertex_descriptor v : link)
for(const vertex_descriptor& v : link)
c = c + (ORIGIN - get_point(v));
CGAL_SMS_LT_TRACE(1," Adding shape optimization constraint. Shape vector: " << xyz_to_string(c));
@ -540,7 +540,7 @@ compute_shape_cost(const Point& p,
const vertex_descriptor_vector& link)
{
FT rCost(0);
for(const vertex_descriptor v : link)
for(const vertex_descriptor& v : link)
rCost += squared_distance(p, get_point(v));
return rCost;

View File

@ -219,7 +219,7 @@ public:
Vertex_handle infinite_vertex = triangulation.infinite_vertex();
bool v0_updated = false;
for (const Cell_handle ch : find_incident)
for (const Cell_handle& ch : find_incident)
{
if (invalid_cells.find(ch) == invalid_cells.end()) //valid cell
{
@ -445,7 +445,7 @@ bool is_valid_collapse(const typename C3t3::Edge& edge,
c3t3.triangulation().finite_incident_cells(v0,
std::back_inserter(cells_to_check));
for (const Cell_handle ch : cells_to_check)
for (const Cell_handle& ch : cells_to_check)
{
if (!ch->has_vertex(v1))
{
@ -478,7 +478,7 @@ bool is_valid_collapse(const typename C3t3::Edge& edge,
c3t3.triangulation().finite_incident_cells(v1,
std::back_inserter(cells_to_check));
for (const Cell_handle ch : cells_to_check)
for (const Cell_handle& ch : cells_to_check)
{
if (!ch->has_vertex(v0))
{
@ -792,7 +792,7 @@ collapse(const typename C3t3::Cell_handle ch,
std::vector<Cell_handle> cells_to_remove;
boost::unordered_set<Cell_handle> invalid_cells;
for(const Cell_handle c : inc_cells)
for(const Cell_handle& c : inc_cells)
{
const int v0_id = c->index(vh0);
const int v1_id = c->index(vh1);
@ -838,7 +838,7 @@ collapse(const typename C3t3::Cell_handle ch,
const Vertex_handle infinite_vertex = tr.infinite_vertex();
bool v0_updated = false;
for (const Cell_handle c : find_incident)
for (const Cell_handle& c : find_incident)
{
if (invalid_cells.find(c) == invalid_cells.end())//valid cell
{
@ -856,7 +856,7 @@ collapse(const typename C3t3::Cell_handle ch,
= { { {{0,1}}, {{0,2}}, {{0,3}}, {{1,2}}, {{1,3}}, {{2,3}} } }; //vertex indices in cells
const Vertex_handle vkept = vh0;
const Vertex_handle vdeleted = vh1;
for (const Cell_handle c : cells_to_update)
for (const Cell_handle& c : cells_to_update)
{
for (const std::array<int, 2>& ei : edges)
{
@ -886,7 +886,7 @@ collapse(const typename C3t3::Cell_handle ch,
// update complex facets
//Update the vertex before removing it
for (const Cell_handle c : cells_to_update)
for (const Cell_handle& c : cells_to_update)
{
if (invalid_cells.find(c) == invalid_cells.end()) //valid cell
{
@ -1005,7 +1005,7 @@ bool is_cells_set_manifold(const C3t3&,
}
boost::unordered_map<EV, int> edges;
for (const std::pair<FV, int>& fvv : facets)
for (const auto& fvv : facets)
{
if (fvv.second != 1)
continue;
@ -1021,7 +1021,7 @@ bool is_cells_set_manifold(const C3t3&,
}
}
for (const std::pair<EV, int>& evv : edges)
for (const auto& evv : edges)
if (evv.second != 2)
return false;

View File

@ -162,7 +162,7 @@ private:
}
}
for (const std::pair<Facet, Vector_3>& fn : fnormals)
for (const auto& fn : fnormals)
{
if(fn.second != CGAL::NULL_VECTOR)
continue;
@ -347,7 +347,7 @@ private:
v->set_point(typename Tr::Point(pv + frac * move));
bool valid_try = true;
for (const typename Tr::Cell_handle ci : inc_cells)
for (const typename Tr::Cell_handle& ci : inc_cells)
{
if (CGAL::POSITIVE != CGAL::orientation(point(ci->vertex(0)->point()),
point(ci->vertex(1)->point()),