From 20e348a975380a36add526198dedc08baec223aa Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Fri, 7 Apr 2017 22:21:14 +0200 Subject: [PATCH] Use DEAL_II_FALLTHROUGH to silence gcc-7 warnings --- examples/step-19/step-19.cc | 2 + include/deal.II/base/table_indices.h | 51 ++++++++++++------- include/deal.II/base/utilities.h | 6 +++ include/deal.II/fe/fe_poly_face.templates.h | 6 +-- .../deal.II/grid/tria_accessor.templates.h | 2 + .../deal.II/lac/vector_operations_internal.h | 6 +-- .../deal.II/numerics/vector_tools.templates.h | 2 +- source/base/data_out_base.cc | 7 ++- source/base/geometry_info.cc | 3 ++ source/fe/fe_poly_tensor.cc | 2 + source/fe/fe_q_base.cc | 6 ++- source/grid/grid_generator.cc | 1 + source/grid/grid_in.cc | 2 + source/lac/trilinos_solver.cc | 4 ++ 14 files changed, 73 insertions(+), 27 deletions(-) diff --git a/examples/step-19/step-19.cc b/examples/step-19/step-19.cc index edf6284c94..b4299b97fe 100644 --- a/examples/step-19/step-19.cc +++ b/examples/step-19/step-19.cc @@ -456,6 +456,7 @@ namespace Step19 return; } AssertThrow (false, ExcNotImplemented()); + break; case 2: switch (dimensions.second) @@ -469,6 +470,7 @@ namespace Step19 return; } AssertThrow (false, ExcNotImplemented()); + break; case 3: switch (dimensions.second) diff --git a/include/deal.II/base/table_indices.h b/include/deal.II/base/table_indices.h index cf73345ed9..804ce2bfd5 100644 --- a/include/deal.II/base/table_indices.h +++ b/include/deal.II/base/table_indices.h @@ -140,22 +140,30 @@ TableIndices::TableIndices(const unsigned int index0, switch (N) { - case 1: // fallthrough + case 1: Assert (index1 == numbers::invalid_unsigned_int, ExcMessage("more than N index values provided")); - case 2: // fallthrough + DEAL_II_FALLTHROUGH; + case 2: Assert (index2 == numbers::invalid_unsigned_int, ExcMessage("more than N index values provided")); - case 3: // fallthrough + DEAL_II_FALLTHROUGH; + case 3: Assert (index3 == numbers::invalid_unsigned_int, ExcMessage("more than N index values provided")); - case 4: // fallthrough + DEAL_II_FALLTHROUGH; + case 4: Assert (index4 == numbers::invalid_unsigned_int, ExcMessage("more than N index values provided")); - case 5: // fallthrough + DEAL_II_FALLTHROUGH; + case 5: Assert (index5 == numbers::invalid_unsigned_int, ExcMessage("more than N index values provided")); - case 6: // fallthrough + DEAL_II_FALLTHROUGH; + case 6: Assert (index6 == numbers::invalid_unsigned_int, ExcMessage("more than N index values provided")); - case 7: // fallthrough + DEAL_II_FALLTHROUGH; + case 7: Assert (index7 == numbers::invalid_unsigned_int, ExcMessage("more than N index values provided")); - case 8: // fallthrough + DEAL_II_FALLTHROUGH; + case 8: Assert (index8 == numbers::invalid_unsigned_int, ExcMessage("more than N index values provided")); + break; default: ; } @@ -169,23 +177,32 @@ TableIndices::TableIndices(const unsigned int index0, // remaining indices to numbers::invalid_unsigned_int: for (unsigned int i=0; i::cell_iterator & for (unsigned int k=0; kdofs_per_quad; ++k) output_data.shape_values(foffset+k,i) = fe_data.shape_values[k+this->first_face_quad_index][i]; } - - // fall through... } + DEAL_II_FALLTHROUGH; case 2: { @@ -141,9 +140,8 @@ fill_fe_face_values (const typename Triangulation::cell_iterator & = fe_data.shape_values[k+(line*this->dofs_per_line)+this->first_face_line_index][i]; } } - - // fall through... } + DEAL_II_FALLTHROUGH; case 1: { diff --git a/include/deal.II/grid/tria_accessor.templates.h b/include/deal.II/grid/tria_accessor.templates.h index 18c532198a..d65f83ca84 100644 --- a/include/deal.II/grid/tria_accessor.templates.h +++ b/include/deal.II/grid/tria_accessor.templates.h @@ -1404,6 +1404,7 @@ isotropic_child_index (const unsigned int i) const else Assert(false, ExcMessage("This cell has no grandchildren equivalent to isotropic refinement")); + break; } case 3: @@ -1510,6 +1511,7 @@ isotropic_child (const unsigned int i) const else Assert(false, ExcMessage("This cell has no grandchildren equivalent to isotropic refinement")); + break; } default: diff --git a/include/deal.II/lac/vector_operations_internal.h b/include/deal.II/lac/vector_operations_internal.h index d603841a98..fbcd2c0206 100644 --- a/include/deal.II/lac/vector_operations_internal.h +++ b/include/deal.II/lac/vector_operations_internal.h @@ -965,18 +965,18 @@ namespace internal r2 = op(index++); for (size_type j=1; j<8; ++j) r2 += op(index++); - // no break + DEAL_II_FALLTHROUGH; case 2: r1 = op(index++); for (size_type j=1; j<8; ++j) r1 += op(index++); r1 += r2; - // no break + DEAL_II_FALLTHROUGH; case 1: r2 = op(index++); for (size_type j=1; j<8; ++j) r2 += op(index++); - // no break + DEAL_II_FALLTHROUGH; default: for (size_type j=0; j> 2; *codechar++ = base64_encode_value(result); result = (fragment & 0x003) << 4; + DEAL_II_FALLTHROUGH; } case step_B: { @@ -153,6 +155,7 @@ namespace result |= (fragment & 0x0f0) >> 4; *codechar++ = base64_encode_value(result); result = (fragment & 0x00f) << 2; + DEAL_II_FALLTHROUGH; } case step_C: { @@ -626,15 +629,16 @@ namespace if (patch->points_are_available) { unsigned int point_no=0; - // note: switch without break ! switch (dim) { case 3: Assert (zstep &xi, case 1: return x; } + break; } case 2: @@ -1625,6 +1626,7 @@ d_linear_shape_function (const Point &xi, case 3: return x*y; } + break; } case 3: @@ -1651,6 +1653,7 @@ d_linear_shape_function (const Point &xi, case 7: return x*y*z; } + break; } default: diff --git a/source/fe/fe_poly_tensor.cc b/source/fe/fe_poly_tensor.cc index 4ff9e3295e..c7bcc7c7bf 100644 --- a/source/fe/fe_poly_tensor.cc +++ b/source/fe/fe_poly_tensor.cc @@ -1743,7 +1743,9 @@ FE_PolyTensor::requires_update_flags(const UpdateFl out |= update_hessians | update_values | update_gradients | update_jacobian_pushed_forward_grads | update_jacobian_pushed_forward_2nd_derivatives; + break; } + case mapping_raviart_thomas: case mapping_piola: { diff --git a/source/fe/fe_q_base.cc b/source/fe/fe_q_base.cc index 260052b286..5ca450e936 100644 --- a/source/fe/fe_q_base.cc +++ b/source/fe/fe_q_base.cc @@ -1061,11 +1061,12 @@ face_to_cell_index (const unsigned int face_index, // we now also need to adjust the line index for the case of // face orientation, face flips, etc - unsigned int adjusted_dof_index_on_line; + unsigned int adjusted_dof_index_on_line = 0; switch (dim) { case 1: Assert (false, ExcInternalError()); + break; case 2: // in 2d, only face_flip has a meaning. if it is set, consider @@ -1091,6 +1092,9 @@ face_to_cell_index (const unsigned int face_index, ExcNotImplemented()); adjusted_dof_index_on_line = dof_index_on_line; break; + + default: + Assert (false, ExcInternalError()); } return (this->first_line_index diff --git a/source/grid/grid_generator.cc b/source/grid/grid_generator.cc index 7989aa5e97..28c2873b61 100644 --- a/source/grid/grid_generator.cc +++ b/source/grid/grid_generator.cc @@ -4211,6 +4211,7 @@ namespace GridGenerator break; case 7: cell->face(f)->vertex(v) = center+Point(outer_radius,-outer_radius); + break; default: break; } diff --git a/source/grid/grid_in.cc b/source/grid/grid_in.cc index fca781871e..9fa62ae2d4 100644 --- a/source/grid/grid_in.cc +++ b/source/grid/grid_in.cc @@ -2119,8 +2119,10 @@ void GridIn::parse_tecplot_header(std::string &header, { case 3: IJK[2]=0; + DEAL_II_FALLTHROUGH; case 2: IJK[1]=0; + DEAL_II_FALLTHROUGH; case 1: IJK[0]=0; } diff --git a/source/lac/trilinos_solver.cc b/source/lac/trilinos_solver.cc index f87ac67aa0..9cb1c028be 100644 --- a/source/lac/trilinos_solver.cc +++ b/source/lac/trilinos_solver.cc @@ -508,15 +508,19 @@ namespace TrilinosWrappers case -1: AssertThrow (false, ExcMessage("AztecOO::Iterate error code -1: " "option not implemented")); + break; case -2: AssertThrow (false, ExcMessage("AztecOO::Iterate error code -2: " "numerical breakdown")); + break; case -3: AssertThrow (false, ExcMessage("AztecOO::Iterate error code -3: " "loss of precision")); + break; case -4: AssertThrow (false, ExcMessage("AztecOO::Iterate error code -4: " "GMRES Hessenberg ill-conditioned")); + break; default: AssertThrow (ierr >= 0, ExcTrilinosError(ierr)); } -- 2.39.5