]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use DEAL_II_FALLTHROUGH to silence gcc-7 warnings 4230/head
authorDaniel Arndt <d.arndt@math.uni-goettingen.de>
Fri, 7 Apr 2017 20:21:14 +0000 (22:21 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sat, 15 Apr 2017 12:18:33 +0000 (14:18 +0200)
14 files changed:
examples/step-19/step-19.cc
include/deal.II/base/table_indices.h
include/deal.II/base/utilities.h
include/deal.II/fe/fe_poly_face.templates.h
include/deal.II/grid/tria_accessor.templates.h
include/deal.II/lac/vector_operations_internal.h
include/deal.II/numerics/vector_tools.templates.h
source/base/data_out_base.cc
source/base/geometry_info.cc
source/fe/fe_poly_tensor.cc
source/fe/fe_q_base.cc
source/grid/grid_generator.cc
source/grid/grid_in.cc
source/lac/trilinos_solver.cc

index edf6284c9425c07f436a029df45f4f5bf9f9bf86..b4299b97fecbd9ad2c29da7bb25cfafb4d759b16 100644 (file)
@@ -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)
index cf73345ed996976ed320ad26582181821eae7d42..804ce2bfd51b54253315e3db65ed372b3463753e 100644 (file)
@@ -140,22 +140,30 @@ TableIndices<N>::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<N>::TableIndices(const unsigned int index0,
       // remaining indices to numbers::invalid_unsigned_int:
       for (unsigned int i=0; i<N; ++i)
         indices[i] = numbers::invalid_unsigned_int;
-    case 9: // fallthrough
+      DEAL_II_FALLTHROUGH;
+    case 9:
       indices[8 % N] = index8;
-    case 8: // fallthrough
+      DEAL_II_FALLTHROUGH;
+    case 8:
       indices[7 % N] = index7;
-    case 7: // fallthrough
+      DEAL_II_FALLTHROUGH;
+    case 7:
       indices[6 % N] = index6;
-    case 6: // fallthrough
+      DEAL_II_FALLTHROUGH;
+    case 6:
       indices[5 % N] = index5;
-    case 5: // fallthrough
+      DEAL_II_FALLTHROUGH;
+    case 5:
       indices[4 % N] = index4;
-    case 4: // fallthrough
+      DEAL_II_FALLTHROUGH;
+    case 4:
       indices[3 % N] = index3;
-    case 3: // fallthrough
+      DEAL_II_FALLTHROUGH;
+    case 3:
       indices[2 % N] = index2;
-    case 2: // fallthrough
+      DEAL_II_FALLTHROUGH;
+    case 2:
       indices[1 % N] = index1;
-    case 1: // fallthrough
+      DEAL_II_FALLTHROUGH;
+    case 1:
       indices[0 % N] = index0;
     }
 
index d133c885be50d40ead2542038958256312aa045a..d7aa997490432c624d01fee87a0acf807e69e6f7 100644 (file)
@@ -659,26 +659,32 @@ namespace Utilities
                 if (!comp(*first, val))
                   return first;
                 ++first;
+                DEAL_II_FALLTHROUGH;
               case 6:
                 if (!comp(*first, val))
                   return first;
                 ++first;
+                DEAL_II_FALLTHROUGH;
               case 5:
                 if (!comp(*first, val))
                   return first;
                 ++first;
+                DEAL_II_FALLTHROUGH;
               case 4:
                 if (!comp(*first, val))
                   return first;
                 ++first;
+                DEAL_II_FALLTHROUGH;
               case 3:
                 if (!comp(*first, val))
                   return first;
                 ++first;
+                DEAL_II_FALLTHROUGH;
               case 2:
                 if (!comp(*first, val))
                   return first;
                 ++first;
+                DEAL_II_FALLTHROUGH;
               case 1:
                 if (!comp(*first, val))
                   return first;
index 7247e4e9fe059f96a93af5936e5a40acafc161dd..2d61668c8ee177e56cdc7e2d304712923310717d 100644 (file)
@@ -124,9 +124,8 @@ fill_fe_face_values (const typename Triangulation<dim,spacedim>::cell_iterator &
                 for (unsigned int k=0; k<this->dofs_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<dim,spacedim>::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:
           {
index 18c532198ae5937da3ad84c3689e08bdb23ea147..d65f83ca84a1e74954aa960d6bec96862ef76108 100644 (file)
@@ -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:
index d603841a98881469b87e2b1bb8b3cb53c202f6cd..fbcd2c02060bd7e26fadff565d2761e37a4231c3 100644 (file)
@@ -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<remainder_inner; ++j)
                     r0 += op(index++);
index dea18e79b149fe2967b6f1efa084801c200abd55..e45e8d9e7dbe4798d40fc518cb7382b0b7fbdd67 100644 (file)
@@ -7112,7 +7112,7 @@ namespace VectorTools
           update_flags |= UpdateFlags (update_gradients);
           if (spacedim == dim+1)
             update_flags |= UpdateFlags (update_normal_vectors);
-        // no break!
+          DEAL_II_FALLTHROUGH;
 
         default:
           update_flags |= UpdateFlags (update_values);
index 94fa6b06be83a9e1e864d0ad1a4033a080fa830c..5debb6738e78a43fdac61c69f6afe0bf3c4a16f9 100644 (file)
@@ -128,6 +128,7 @@ namespace
         {
           while (1)
             {
+              DEAL_II_FALLTHROUGH;
             case step_A:
             {
               if (plainchar == plaintextend)
@@ -140,6 +141,7 @@ namespace
               result = (fragment & 0x0fc) >> 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<n_subdivisions+1, ExcIndexRange(zstep,0,n_subdivisions+1));
             point_no+=(n_subdivisions+1)*(n_subdivisions+1)*zstep;
+            DEAL_II_FALLTHROUGH;
           case 2:
             Assert (ystep<n_subdivisions+1, ExcIndexRange(ystep,0,n_subdivisions+1));
             point_no+=(n_subdivisions+1)*ystep;
+            DEAL_II_FALLTHROUGH;
           case 1:
             Assert (xstep<n_subdivisions+1, ExcIndexRange(xstep,0,n_subdivisions+1));
             point_no+=xstep;
@@ -1887,6 +1891,7 @@ namespace DataOutBase
             rgb_values.red   = 1;
             rgb_values.green = (4*x-xmin-3*xmax)*rezdif;
             rgb_values.blue  = (4.*x-sum13)*rezdif;
+            break;
           default:
             break;
           }
index 24c0775baa4e302724f6ad5f8bef1b88507cc4f2..875d5e6bc48d015b64a0361d903343f05a9cee48 100644 (file)
@@ -1608,6 +1608,7 @@ d_linear_shape_function (const Point<dim> &xi,
         case 1:
           return x;
         }
+      break;
     }
 
     case 2:
@@ -1625,6 +1626,7 @@ d_linear_shape_function (const Point<dim> &xi,
         case 3:
           return x*y;
         }
+      break;
     }
 
     case 3:
@@ -1651,6 +1653,7 @@ d_linear_shape_function (const Point<dim> &xi,
         case 7:
           return x*y*z;
         }
+      break;
     }
 
     default:
index 4ff9e3295e07f6a7c610496ef23f02bdf7a68d25..c7bcc7c7bf0971bd29611406ed9d495144a7fb0f 100644 (file)
@@ -1743,7 +1743,9 @@ FE_PolyTensor<PolynomialType,dim,spacedim>::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:
     {
index 260052b2860d2a4cfa0a80e6ca7072306d32bf65..5ca450e936d195f64c2081e0dc399e46c91afc11 100644 (file)
@@ -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
index 7989aa5e9792fa1140a0697683afde72f8595d2e..28c2873b61763042900584332fbf16294fa23eb9 100644 (file)
@@ -4211,6 +4211,7 @@ namespace GridGenerator
                           break;
                         case 7:
                           cell->face(f)->vertex(v) = center+Point<dim>(outer_radius,-outer_radius);
+                          break;
                         default:
                           break;
                         }
index fca781871ef4a3aa3f27aeebccd29798f27077d5..9fa62ae2d4b744a4b8dd394a13be2387a67c749c 100644 (file)
@@ -2119,8 +2119,10 @@ void GridIn<dim, spacedim>::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;
     }
index f87ac67aa0386585c6838b3a5ea5c832dbf1e74e..9cb1c028bed71d645b8f584b19cd1719743661ad 100644 (file)
@@ -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));
       }

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.