]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix warnings in tests, clang-6
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Thu, 31 May 2018 06:41:07 +0000 (08:41 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Thu, 31 May 2018 06:48:11 +0000 (08:48 +0200)
18 files changed:
tests/base/aligned_vector_04.cc
tests/base/table_06.cc
tests/bits/accessor_equality.cc
tests/bits/distorted_cells_06.cc
tests/codim_one/integrate_log.cc
tests/grid/intergrid_map.cc
tests/lac/block_linear_operator_01.cc
tests/lac/pointer_matrix_03.cc
tests/lac/pointer_matrix_04.cc
tests/lac/pointer_matrix_05.cc
tests/lac/pointer_matrix_06.cc
tests/lac/pointer_matrix_07.cc
tests/lac/pointer_matrix_08.cc
tests/lac/sparse_matrix_move.cc
tests/lac/sparse_matrix_move.output
tests/manifold/chart_manifold_06.cc
tests/numerics/project_boundary_01.cc
tests/opencascade/manifold_clone_01.cc

index 8523b8d021d06e9a59e3a358333071f4560b0dc0..a7f8b67ed3a95b7be923119bc18804071521a6d0 100644 (file)
 class FunctionBase
 {
 public:
-  ~FunctionBase()
+  virtual ~FunctionBase()
   {}
 
   virtual void
   do_test() = 0;
 };
 
-class Function
+class Function : public FunctionBase
 {
 public:
   Function() : size_(2)
@@ -51,13 +51,13 @@ public:
     deallog << "Copy construct object" << std::endl;
   }
 
-  ~Function()
+  virtual ~Function() override
   {
     deallog << "Destruct with size " << vec.size() << std::endl;
   }
 
   virtual void
-  do_test()
+  do_test() override
   {
     vec.resize(size_++);
     deallog << "Resize vector to " << vec.size() << std::endl;
index cb499f00aa1a782fb3062961020cc5c97e593c15..cff35681640903a559a0e9c04fdbca575a9ad925 100644 (file)
 class FunctionBase
 {
 public:
-  ~FunctionBase()
+  virtual ~FunctionBase()
   {}
 
   virtual void
   do_test() = 0;
 };
 
-class Function
+class Function : public FunctionBase
 {
 public:
   Function() : size_(2)
@@ -51,13 +51,13 @@ public:
     deallog << "Copy construct object" << std::endl;
   }
 
-  ~Function()
+  virtual ~Function() override
   {
     deallog << "Destruct with size " << vec.size() << std::endl;
   }
 
   virtual void
-  do_test()
+  do_test() override
   {
     vec.resize(size_++);
     deallog << "Resize vector to " << vec.size() << std::endl;
index b7ebc2bdbae0ce389c076b94bf183cb2004b26ef..e84cd808edcb4c120470898b40d6788cdcfa2f7b 100644 (file)
@@ -92,7 +92,9 @@ test()
     dof_handler2.distribute_dofs(fe);
     try
       {
-        (dof_handler.begin_active() != dof_handler2.begin_active());
+        bool is_same =
+          (dof_handler.begin_active() != dof_handler2.begin_active());
+        (void)is_same;
       }
     catch (ExceptionBase &e)
       {
index 05f94b292d98a09ba4e2dec6a78115b199a44472..c33d9306aac4bdef3166e2bb6510e11e214b5214 100644 (file)
@@ -49,7 +49,7 @@ class MyManifold : public Manifold<dim>
 
   virtual Point<dim>
   get_new_point_on_line(
-    const typename Triangulation<dim>::line_iterator &line) const
+    const typename Triangulation<dim>::line_iterator &line) const override
   {
     deallog << "Finding point between " << line->vertex(0) << " and "
             << line->vertex(1) << std::endl;
@@ -59,7 +59,7 @@ class MyManifold : public Manifold<dim>
 
   virtual Point<dim>
   get_new_point_on_quad(
-    const typename Triangulation<dim>::quad_iterator &) const
+    const typename Triangulation<dim>::quad_iterator &) const override
   {
     Assert(false, ExcInternalError());
     return Point<dim>(0, 0, 1.25);
index 6ff5d9ac6b62d319fd27b970ab581ad1457bfd87..2832c5026149254c4afba59dec1adebcfe6a8156 100644 (file)
@@ -120,14 +120,15 @@ factorial(unsigned int a)
 double
 newton_binomial(unsigned int a, unsigned int b)
 {
-  double c;
+  double c = 0.;
   if (a >= b)
-    c = factorial(a) / factorial(b) / factorial(a - b);
-  else
-    deallog
-      << "Error: in Newton binomial the first integer must be greater or equal to the second.";
+    return factorial(a) / factorial(b) / factorial(a - b);
 
-  return c;
+  // we should not get here
+  deallog << "Error: in Newton binomial the first integer "
+             "must be greater or equal to the second.";
+
+  return 0.;
 }
 
 int
index b395c57666ce0b1b0f06ecc1a29c717a06ce2769..7bacd751feae9e6c7ab057495d274f0a92c0ef6b 100644 (file)
@@ -14,8 +14,8 @@
 // ---------------------------------------------------------------------
 
 /*
-/* Author: Wolfgang Bangerth, University of Heidelberg, 2000
-/*
+ * Author: Wolfgang Bangerth, University of Heidelberg, 2000
+ *
  * Purpose: check some things with the intergrid map
  */
 
index 6f8af8db8ee8689044f9f645e8d44ca163baf232..7d4f2f06e3db6d45111519b0b39094fc4c5e03ca 100644 (file)
@@ -112,7 +112,7 @@ main()
   auto op_b11 = linear_operator(a.block(1, 1));
 
   std::array<std::array<decltype(op_b00), 2>, 2> temp{
-    {op_b00, op_b01, op_b10, op_b11}};
+    {{op_b00, op_b01}, {op_b10, op_b11}}};
   auto op_b = block_operator<2, 2, BlockVector<double>>(temp);
 
   {
@@ -189,7 +189,9 @@ main()
   // And finally complicated block structures:
 
   std::array<std::array<decltype(op_b00), 3>, 3> temp2{
-    {op_b00, op_b01, op_b00, op_b10, op_b11, op_b10, op_b10, op_b11, op_b10}};
+    {{op_b00, op_b01, op_b00},
+     {op_b10, op_b11, op_b10},
+     {op_b10, op_b11, op_b10}}};
   auto op_upp_x_upu = block_operator<3, 3, BlockVector<double>>(temp2);
 
   op_upp_x_upu.reinit_domain_vector(u, false);
@@ -208,11 +210,11 @@ main()
   PRINTME("v", v);
 
   std::array<std::array<decltype(op_b01), 1>, 3> temp3{
-    {op_b01, op_b11, op_b11}};
+    {{op_b01}, {op_b11}, {op_b11}}};
   auto op_upp_x_p = block_operator<3, 1, BlockVector<double>>(temp3);
 
   std::array<std::array<decltype(op_b01), 3>, 1> temp4{
-    {op_b00, op_b01, op_b00}};
+    {{op_b00, op_b01, op_b00}}};
   auto op_u_x_upu = block_operator<1, 3, BlockVector<double>>(temp4);
 
   auto op_long = op_u_x_upu * transpose_operator(op_upp_x_upu) * op_upp_x_p;
index d78e1ac73e6288d93f207d2ddad0af23a5e1e78b..c34c8a23cd8573fdc72d9bce68c00e7aeef6d85f 100644 (file)
@@ -38,7 +38,7 @@ main()
   deallog << std::setprecision(4);
   deallog.attach(logfile);
 
-  char *name = "Matrix A";
+  char name[] = "Matrix A";
 
   checkConstructor3<double>(name);
 }
index fc6a4650e79362f53625b6307f9361040be8f93a..d87f4a3a3b3b35c7e0d6fc7b2026e45f3334df48 100644 (file)
@@ -43,7 +43,7 @@ main()
   FullMatrix<double> A(2, 2);
   A.fill(Adata);
 
-  char *name = "Matrix A";
+  char name[] = "Matrix A";
 
   checkConstructor4<double>(A, name);
 }
index 358e6f19991080483685bcb62f7446b869575c50..cbda10a1e142f584680c54d38cd10b86da6f4708 100644 (file)
 
 template <typename number>
 void
-checkVmult(FullMatrix<number> &A, Vector<number> &V, char *name = "Test Matrix")
+checkVmult(FullMatrix<number> &A,
+           Vector<number> &    V,
+           const std::string & name = "Test Matrix")
 {
   deallog << "vmult" << std::endl;
 
-  PointerMatrix<FullMatrix<number>, Vector<number>> P(&A, name);
+  PointerMatrix<FullMatrix<number>, Vector<number>> P(&A, name.c_str());
   Vector<number>                                    O(A.m());
   P.vmult(O, V);
 
index 75c0693b3daa6c64bd3a10258b54099f5bc5f14e..ae117aa6b74f4f6b4b8ec7c080089e53ae3f1ecd 100644 (file)
@@ -25,11 +25,11 @@ template <typename number>
 void
 checkTvmult(FullMatrix<number> &A,
             Vector<number> &    V,
-            char *              name = "Test Matrix")
+            const std::string & name = "Test Matrix")
 {
   deallog << "Tvmult" << std::endl;
 
-  PointerMatrix<FullMatrix<number>, Vector<number>> P(&A, name);
+  PointerMatrix<FullMatrix<number>, Vector<number>> P(&A, name.c_str());
   Vector<number>                                    O(A.m());
   P.Tvmult(O, V);
 
index 4247e73f75b756aa354fdd700e755ba7e901e485..4aa5503404cf0844ae4d19d47e4c52d802cfd202 100644 (file)
@@ -25,11 +25,11 @@ template <typename number>
 void
 checkTvmult_add(FullMatrix<number> &A,
                 Vector<number> &    V,
-                char *              name = "Test Matrix")
+                const std::string & name = "Test Matrix")
 {
   deallog << "Tvmult_add" << std::endl;
 
-  PointerMatrix<FullMatrix<number>, Vector<number>> P(&A, name);
+  PointerMatrix<FullMatrix<number>, Vector<number>> P(&A, name.c_str());
 
   deallog << "Result vector set to all ones and to be added with result"
           << std::endl;
index 2f7d209038ff38075dff8127149ff163cf1c9fb1..54d29ea26d72aac4cd0a3489374e5fe26b1327a1 100644 (file)
@@ -25,11 +25,11 @@ template <typename number>
 void
 checkVmult_add(FullMatrix<number> &A,
                Vector<number> &    V,
-               char *              name = "Test Matrix")
+               const std::string & name = "Test Matrix")
 {
   deallog << "vmult_add" << std::endl;
 
-  PointerMatrix<FullMatrix<number>, Vector<number>> P(&A, name);
+  PointerMatrix<FullMatrix<number>, Vector<number>> P(&A, name.c_str());
 
   deallog << "Result vector set to all ones and to be added with result"
           << std::endl;
index c65e3765f65d39eff91409f38fc96257ab99d41e..ce63d8276c98c6bbc8d3159b25f10fa9f544d067 100644 (file)
@@ -48,15 +48,6 @@ graph_laplacian(const SparsityPattern &sparsity)
 }
 
 
-SparseMatrix<double>
-graph_laplacian_move_return(const SparsityPattern &sparsity)
-{
-  SparseMatrix<double> A(sparsity);
-  graph_laplacian(sparsity, A);
-
-  return std::move(A);
-}
-
 
 int
 main()
@@ -88,16 +79,17 @@ main()
   }
 
   {
-    // Return a sparse matrix using the move constructor
-    SparseMatrix<double> A = graph_laplacian_move_return(sparsity);
+    // Return a sparse matrix using the move constructoir
+    SparseMatrix<double> B = graph_laplacian(sparsity);
+    SparseMatrix<double> A = std::move(B);
     deallog << A.n_nonzero_elements() << std::endl;
+    deallog << B.empty() << std::endl;
     y = 1.0;
     A.vmult(y, x);
 
     deallog << y.l2_norm() << std::endl;
 
     // Explicitly move a sparse matrix
-    SparseMatrix<double> B;
     B = std::move(A);
     deallog << B.m() << std::endl;
     deallog << A.empty() << std::endl;
index 7239c9cda828639d6e8f41f7429fabc0c1eeceb9..b9bd8fe01c4aeda52ba3752fd8763b3e56d921c3 100644 (file)
@@ -2,6 +2,7 @@
 DEAL::64
 DEAL::0.00
 DEAL::64
+DEAL::1
 DEAL::0.00
 DEAL::16
 DEAL::1
index 5eeb3acd4922f0e0ae1ff88ab2d93dd9a129698c..7981cd18296c6ea230a176e24fb79c4e5b47f3f2 100644 (file)
@@ -42,20 +42,20 @@ public:
 
 
   virtual Point<spacedim>
-  pull_back(const Point<spacedim> &space_point) const
+  pull_back(const Point<spacedim> &space_point) const override
   {
     return space_point;
   }
 
 
   virtual Point<spacedim>
-  push_forward(const Point<spacedim> &chart_point) const
+  push_forward(const Point<spacedim> &chart_point) const override
   {
     return chart_point;
   }
 
   virtual DerivativeForm<1, spacedim, spacedim>
-  push_forward_gradient(const Point<spacedim> &chart_point) const
+  push_forward_gradient(const Point<spacedim> &chart_point) const override
   {
     DerivativeForm<1, spacedim, spacedim> x;
     for (unsigned int d = 0; d < spacedim; ++d)
index 3404c0f9a29b9ffdaf134dee485d8c552822f6d2..7df8b0edbf51465c812cc5fd8d5c5847be64342d 100644 (file)
@@ -148,8 +148,8 @@ check()
   fe_list.push_back(new FE_Q<dim>(1));
   function_list.push_back(new MySquareFunction<dim>(1));
 
-  // test four different cases for the parameter: 1, 1e-20, 1e-170, 1e-800 (= 0)
-  double factors[] = {1., 1e-40, 1e-170, 1e-800};
+  // test four different cases for the parameter: 1, 1e-20, 1e-170, 0.
+  double factors[] = {1., 1e-40, 1e-170, 0.};
   for (unsigned int it = 0; it < 4; ++it)
     {
       deallog.push(Utilities::int_to_string(it, 1));
index 6136277330e5a4e4ce94f6d67b3b75c04b6da883..e2dd1d71b8cf19f1dadefc51fe54a23739bb9219 100644 (file)
@@ -54,14 +54,16 @@ main()
     TopoDS_Edge edge           = BRepBuilderAPI_MakeEdge(circle);
 
     NormalProjectionBoundary<2, 3>  manifold_b(edge);
-    std::unique_ptr<Manifold<2, 3>> clone_b = manifold_b.clone();
+    std::unique_ptr<Manifold<2, 3>> clone_b       = manifold_b.clone();
+    const auto &                    deref_clone_b = *clone_b;
     deallog << "typeid of NormalProjectionBoundary<2, 3> is "
-            << boost::core::demangle(typeid(*clone_b).name()) << std::endl;
+            << boost::core::demangle(typeid(deref_clone_b).name()) << std::endl;
 
     NormalProjectionManifold<2, 3>  manifold_m(edge);
-    std::unique_ptr<Manifold<2, 3>> clone_m = manifold_m.clone();
+    std::unique_ptr<Manifold<2, 3>> clone_m       = manifold_m.clone();
+    const auto &                    deref_clone_m = *clone_m;
     deallog << "typeid of NormalProjectionManifold<2, 3> is "
-            << boost::core::demangle(typeid(*clone_m).name()) << std::endl;
+            << boost::core::demangle(typeid(deref_clone_m).name()) << std::endl;
   }
 
   {
@@ -81,15 +83,17 @@ main()
 
     DirectionalProjectionBoundary<2, 3> manifold_b(face, Point<3>(0, 0, 1));
 
-    std::unique_ptr<Manifold<2, 3>> clone_b = manifold_b.clone();
+    std::unique_ptr<Manifold<2, 3>> clone_b       = manifold_b.clone();
+    const auto &                    deref_clone_b = *clone_b;
     deallog << "typeid of DirectionalProjectionBoundary<2, 3> is "
-            << boost::core::demangle(typeid(*clone_b).name()) << std::endl;
+            << boost::core::demangle(typeid(deref_clone_b).name()) << std::endl;
 
     DirectionalProjectionManifold<2, 3> manifold_m(face, Point<3>(0, 0, 1));
 
-    std::unique_ptr<Manifold<2, 3>> clone_m = manifold_m.clone();
+    std::unique_ptr<Manifold<2, 3>> clone_m       = manifold_m.clone();
+    const auto &                    deref_clone_m = *clone_m;
     deallog << "typeid of DirectionalProjectionManifold<2, 3> is "
-            << boost::core::demangle(typeid(*clone_m).name()) << std::endl;
+            << boost::core::demangle(typeid(deref_clone_m).name()) << std::endl;
   }
 
   // Create a bspline passing through the points
@@ -109,14 +113,16 @@ main()
 
     NormalToMeshProjectionBoundary<1, 3> manifold_b(face);
 
-    std::unique_ptr<Manifold<1, 3>> clone_b = manifold_b.clone();
+    std::unique_ptr<Manifold<1, 3>> clone_b       = manifold_b.clone();
+    const auto &                    deref_clone_b = *clone_b;
     deallog << "typeid of NormalProjectionBoundary<2, 3> is "
-            << boost::core::demangle(typeid(*clone_b).name()) << std::endl;
+            << boost::core::demangle(typeid(deref_clone_b).name()) << std::endl;
 
     NormalToMeshProjectionManifold<1, 3> manifold_m(face);
-    std::unique_ptr<Manifold<1, 3>>      clone_m = manifold_m.clone();
+    std::unique_ptr<Manifold<1, 3>>      clone_m       = manifold_m.clone();
+    const auto &                         deref_clone_m = *clone_m;
     deallog << "typeid of NormalProjectionManifold<2, 3> is "
-            << boost::core::demangle(typeid(*clone_m).name()) << std::endl;
+            << boost::core::demangle(typeid(deref_clone_m).name()) << std::endl;
   }
 
   deallog << "OK" << std::endl;

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.