Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some warnings. #14378

Merged
merged 1 commit into from Oct 29, 2022
Merged

Fix some warnings. #14378

merged 1 commit into from Oct 29, 2022

Conversation

marcfehling
Copy link
Member

According to https://cdash.dealii.43-1.org/viewBuildError.php?type=1&buildid=992

[source/dofs/dof_handler_policy.cc:3664](https://github.com/dealii/dealii/blob/master/source/dofs/dof_handler_policy.cc#L3664):27: warning: loop variable ‘index’ creates a copy from type ‘const std::pair<const unsigned int, unsigned int>’ [-Wrange-loop-construct]
[source/dofs/dof_handler_policy.cc:3664](https://github.com/dealii/dealii/blob/master/source/dofs/dof_handler_policy.cc#L3664):27: note: use reference type to prevent copying

[source/cgal/intersections.cc:387](https://github.com/dealii/dealii/blob/master/source/cgal/intersections.cc#L387):37: warning: loop variable ‘f’ of type ‘const dealii::CGALWrappers::Face_handle&’ {aka ‘const CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Delaunay_mesh_face_base_2<CGAL::Simple_cartesian<CORE::Expr>, CGAL::Constrained_triangulation_face_base_2<CGAL::Simple_cartesian<CORE::Expr>, CGAL::Triangulation_face_base_with_info_2<dealii::CGALWrappers::FaceInfo2, CGAL::Simple_cartesian<CORE::Expr>, CGAL::Triangulation_face_base_2<CGAL::Simple_cartesian<CORE::Expr>, CGAL::Triangulation_ds_face_base_2<CGAL::Triangulation_data_structure_2<CGAL::Triangulation_vertex_base_2<CGAL::Simple_cartesian<CORE::Expr>, CGAL::Triangulation_ds_vertex_base_2<void> >, CGAL::Delaunay_mesh_face_base_2<CGAL::Simple_cartesian<CORE::Expr>, CGAL::Constrained_triangulation_face_base_2<CGAL::Simple_cartesian<CORE::Expr>, CGAL::Triangulation_face_base_with_info_2<dealii::CGALWrappers::FaceInfo2, CGAL::Simple_cartesian<CORE::Expr> > > > > > > > > >, CGAL::Default, CGAL::Default, CGAL::Default>, false>&’} binds to a temporary constructed from type ‘CGAL::Triangulation_2<CGAL::Simple_cartesian<CORE::Expr>, CGAL::Triangulation_data_structure_2<CGAL::Triangulation_vertex_base_2<CGAL::Simple_cartesian<CORE::Expr>, CGAL::Triangulation_ds_vertex_base_2<void> >, CGAL::Delaunay_mesh_face_base_2<CGAL::Simple_cartesian<CORE::Expr>, CGAL::Constrained_triangulation_face_base_2<CGAL::Simple_cartesian<CORE::Expr>, CGAL::Triangulation_face_base_with_info_2<dealii::CGALWrappers::FaceInfo2, CGAL::Simple_cartesian<CORE::Expr> > > > > >::Finite_faces_iterator’ [-Wrange-loop-construct]
[source/cgal/intersections.cc:387](https://github.com/dealii/dealii/blob/master/source/cgal/intersections.cc#L387):37: note: use non-reference type ‘const dealii::CGALWrappers::Face_handle’ {aka ‘const CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Delaunay_mesh_face_base_2<CGAL::Simple_cartesian<CORE::Expr>, CGAL::Constrained_triangulation_face_base_2<CGAL::Simple_cartesian<CORE::Expr>, CGAL::Triangulation_face_base_with_info_2<dealii::CGALWrappers::FaceInfo2, CGAL::Simple_cartesian<CORE::Expr>, CGAL::Triangulation_face_base_2<CGAL::Simple_cartesian<CORE::Expr>, CGAL::Triangulation_ds_face_base_2<CGAL::Triangulation_data_structure_2<CGAL::Triangulation_vertex_base_2<CGAL::Simple_cartesian<CORE::Expr>, CGAL::Triangulation_ds_vertex_base_2<void> >, CGAL::Delaunay_mesh_face_base_2<CGAL::Simple_cartesian<CORE::Expr>, CGAL::Constrained_triangulation_face_base_2<CGAL::Simple_cartesian<CORE::Expr>, CGAL::Triangulation_face_base_with_info_2<dealii::CGALWrappers::FaceInfo2, CGAL::Simple_cartesian<CORE::Expr> > > > > > > > > >, CGAL::Default, CGAL::Default, CGAL::Default>, false>’} to make the copy explicit or ‘const CGAL::Triangulation_2<CGAL::Simple_cartesian<CORE::Expr>, CGAL::Triangulation_data_structure_2<CGAL::Triangulation_vertex_base_2<CGAL::Simple_cartesian<CORE::Expr>, CGAL::Triangulation_ds_vertex_base_2<void> >, CGAL::Delaunay_mesh_face_base_2<CGAL::Simple_cartesian<CORE::Expr>, CGAL::Constrained_triangulation_face_base_2<CGAL::Simple_cartesian<CORE::Expr>, CGAL::Triangulation_face_base_with_info_2<dealii::CGALWrappers::FaceInfo2, CGAL::Simple_cartesian<CORE::Expr> > > > > >::Finite_faces_iterator&’ to prevent copying

@@ -384,7 +384,7 @@ namespace CGALWrappers
internal::mark_domains(cdt);
std::array<Point<2>, 3> vertices;

for (const Face_handle &f : cdt.finite_face_handles())
for (const Face_handle f : cdt.finite_face_handles())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need the explicit type change here, or would using const auto & work?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or would using const auto & work?

Potentially yes. But then I would be in favor of using const auto & in all loops of that kind in this file, i.e.

for (CDT::Face_handle f : cdt.all_face_handles())

for (Face_handle f : cdt.finite_face_handles())

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say this is unrelated to the warnings fixed here.

@tjhei tjhei merged commit 9512b4c into dealii:master Oct 29, 2022
@marcfehling marcfehling deleted the warnings branch October 29, 2022 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants