From 58e7addedb1a9fa38af288222d33064e9762263a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20Klinkovsk=C3=BD?= <klinkjak@fjfi.cvut.cz>
Date: Sun, 4 Sep 2016 12:17:54 +0200
Subject: [PATCH] Fixed issues reported in compiler warnings

- base class with non-virtual destructor causes undefined behaviour
- missing return statements at the end of non-void functions
- missing const before char* function argument
- reordered initialization of class members
- misleading indentation after for statement
- fixed use of uninitialized variables
- fixed unsequenced modification and access to variables (the C++
  standard does not define the evaluation order of operands, so
  expressions with side-effects such as j++ cause undefined behaviour)
---
 src/TNL/Config/ConfigEntryBase.h              |  4 ++-
 src/TNL/Containers/ArrayOperationsCuda_impl.h | 10 +++++--
 src/TNL/Images/JPEGImage_impl.h               |  2 ++
 src/TNL/Images/PNGImage_impl.h                |  2 +-
 src/TNL/Matrices/CSR_impl.h                   |  2 +-
 src/TNL/Matrices/ChunkedEllpack_impl.h        |  6 ++---
 src/TNL/Matrices/Multidiagonal_impl.h         |  2 +-
 src/TNL/Matrices/SlicedEllpack_impl.h         |  8 +++---
 src/TNL/Matrices/Tridiagonal_impl.h           | 12 ++++-----
 .../GridDetails/GridEntityMeasureGetter.h     |  2 +-
 src/TNL/Meshes/MeshBuilder.h                  |  2 +-
 .../MeshEntityReferenceOrientation.h          |  2 +-
 .../Meshes/MeshDetails/MeshWriterVTKLegacy.h  |  3 +--
 .../initializer/MeshEntityInitializer.h       |  4 +--
 .../MeshDetails/initializer/MeshInitializer.h |  1 +
 src/TNL/Solvers/ODE/ExplicitSolver_impl.h     |  2 +-
 src/TNL/Solvers/PDE/ExplicitUpdater.h         |  4 +--
 src/TNL/Timer.cpp                             |  2 +-
 .../tnl-benchmark-simple-heat-equation.h      |  3 ++-
 tests/benchmarks/spmv.h                       | 10 ++++---
 tools/src/tnl-diff.h                          | 27 ++++++++++---------
 tools/src/tnl-image-converter.cpp             |  2 ++
 tools/src/tnl-init.h                          |  6 +++++
 tools/src/tnl-mesh-convert.h                  |  3 +++
 tools/src/tnl-view.h                          |  1 +
 25 files changed, 75 insertions(+), 47 deletions(-)

diff --git a/src/TNL/Config/ConfigEntryBase.h b/src/TNL/Config/ConfigEntryBase.h
index 8f405213ff..f69729ef5a 100644
--- a/src/TNL/Config/ConfigEntryBase.h
+++ b/src/TNL/Config/ConfigEntryBase.h
@@ -41,7 +41,9 @@ struct ConfigEntryBase
 
    virtual bool hasEnumValues() const { return false; };
 
-   virtual void printEnumValues() const{};
+   virtual void printEnumValues() const {};
+
+   virtual ~ConfigEntryBase() {};
 };
 
 } // namespace Config
diff --git a/src/TNL/Containers/ArrayOperationsCuda_impl.h b/src/TNL/Containers/ArrayOperationsCuda_impl.h
index 64948f4893..61839e55d2 100644
--- a/src/TNL/Containers/ArrayOperationsCuda_impl.h
+++ b/src/TNL/Containers/ArrayOperationsCuda_impl.h
@@ -230,7 +230,10 @@ bool ArrayOperations< Devices::Host, Devices::Cuda >::copyMemory( DestinationEle
          }
          Index j( 0 );
          while( j < Devices::Cuda::getGPUTransferBufferSize() && i + j < size )
-            destination[ i + j ] = buffer[ j++ ];
+         {
+            destination[ i + j ] = buffer[ j ];
+            j++;
+         }
          i += j;
       }
       delete[] buffer;
@@ -332,7 +335,10 @@ bool ArrayOperations< Devices::Cuda, Devices::Host >::copyMemory( DestinationEle
       {
          Index j( 0 );
          while( j < Devices::Cuda::getGPUTransferBufferSize() && i + j < size )
-            buffer[ j ] = source[ i + j++ ];
+         {
+            buffer[ j ] = source[ i + j ];
+            j++;
+         }
          if( cudaMemcpy( &destination[ i ],
                          buffer,
                          j * sizeof( DestinationElement ),
diff --git a/src/TNL/Images/JPEGImage_impl.h b/src/TNL/Images/JPEGImage_impl.h
index c20258c825..ae0b8012e8 100644
--- a/src/TNL/Images/JPEGImage_impl.h
+++ b/src/TNL/Images/JPEGImage_impl.h
@@ -69,6 +69,7 @@ readHeader()
    this->components = this->decinfo.num_components;
    //this->color_space = this->cinfo.jpeg_color_space;
    //cout << this->height << " x " << this->width << " : " << this->components << " " << this->color_space << std::endl;
+   return true;
 #else
    std::cerr << "TNL was not compiled with support of JPEG. You may still use PGM format." << std::endl;
    return false;
@@ -192,6 +193,7 @@ writeHeader( const Meshes::Grid< 2, Real, Device, Index >& grid )
    this->cinfo.in_color_space = JCS_GRAYSCALE;
    jpeg_set_defaults( &this->cinfo );
    jpeg_start_compress( &this->cinfo, true );
+   return true;
 #else
    //cerr << "TNL was not compiled with support of JPEG. You may still use PGM format." << std::endl;
    return false;
diff --git a/src/TNL/Images/PNGImage_impl.h b/src/TNL/Images/PNGImage_impl.h
index 2835aff0e6..1e0a2df60f 100644
--- a/src/TNL/Images/PNGImage_impl.h
+++ b/src/TNL/Images/PNGImage_impl.h
@@ -265,7 +265,7 @@ writeHeader( const Meshes::Grid< 2, Real, Device, Index >& grid )
                  PNG_FILTER_TYPE_DEFAULT );
    png_init_io( this->png_ptr, this->file );
    png_write_info( png_ptr, info_ptr );
- 
+   return true;
 #else
    std::cerr << "TNL was not compiled with support of PNG. You may still use PGM format." << std::endl;
    return false;
diff --git a/src/TNL/Matrices/CSR_impl.h b/src/TNL/Matrices/CSR_impl.h
index 587b0999f7..3c9d239bda 100644
--- a/src/TNL/Matrices/CSR_impl.h
+++ b/src/TNL/Matrices/CSR_impl.h
@@ -222,7 +222,7 @@ bool CSR< Real, Device, Index >::addElement( const IndexType row,
 
     IndexType elementPtr = this->rowPointers.getElement( row );
     const IndexType rowEnd = this->rowPointers.getElement( row + 1 );
-    IndexType col;
+    IndexType col = 0;
     while( elementPtr < rowEnd &&
            ( col = this->columnIndexes.getElement( elementPtr ) ) < column &&
            col != this->getPaddingIndex() ) elementPtr++;
diff --git a/src/TNL/Matrices/ChunkedEllpack_impl.h b/src/TNL/Matrices/ChunkedEllpack_impl.h
index fd4e67a5a7..b8b9374e1c 100644
--- a/src/TNL/Matrices/ChunkedEllpack_impl.h
+++ b/src/TNL/Matrices/ChunkedEllpack_impl.h
@@ -435,7 +435,7 @@ bool ChunkedEllpack< Real, Device, Index >::addElementToChunkFast( const IndexTy
                                            elementPtr,
                                            chunkEnd,
                                            step );
-   IndexType col;
+   IndexType col = 0;
    while( elementPtr < chunkEnd &&
           ( col = this->columnIndexes[ elementPtr ] ) < column &&
           col != this->getPaddingIndex() )
@@ -532,7 +532,7 @@ bool ChunkedEllpack< Real, Device, Index >::addElementToChunk( const IndexType s
                                            elementPtr,
                                            chunkEnd,
                                            step );
-   IndexType col;
+   IndexType col = 0;
    while( elementPtr < chunkEnd &&
           ( col = this->columnIndexes.getElement( elementPtr ) ) < column &&
           col != this->getPaddingIndex() )
@@ -1044,7 +1044,7 @@ typename Vector::RealType ChunkedEllpack< Real, Device, Index >::chunkVectorProd
                                            elementPtr,
                                            chunkEnd,
                                            step );
-   IndexType i( 0 ), col;
+   IndexType i( 0 ), col( 0 );
    typename Vector::RealType result( 0.0 );
    while( i < chunkSize && ( col = this->columnIndexes[ elementPtr ] ) != this->getPaddingIndex() )
    {
diff --git a/src/TNL/Matrices/Multidiagonal_impl.h b/src/TNL/Matrices/Multidiagonal_impl.h
index e4d60504d8..9bc03c1042 100644
--- a/src/TNL/Matrices/Multidiagonal_impl.h
+++ b/src/TNL/Matrices/Multidiagonal_impl.h
@@ -158,7 +158,7 @@ template< typename Real,
           typename Index >
 Index Multidiagonal< Real, Device, Index > :: getNumberOfNonzeroMatrixElements() const
 {
-   IndexType nonzeroElements;
+   IndexType nonzeroElements = 0;
    for( IndexType i = 0; i < this->values.getSize(); i++ )
       if( this->values.getElement( i ) != 0 )
          nonzeroElements++;
diff --git a/src/TNL/Matrices/SlicedEllpack_impl.h b/src/TNL/Matrices/SlicedEllpack_impl.h
index d2c0554e93..67d14b89cb 100644
--- a/src/TNL/Matrices/SlicedEllpack_impl.h
+++ b/src/TNL/Matrices/SlicedEllpack_impl.h
@@ -193,7 +193,7 @@ bool SlicedEllpack< Real, Device, Index, SliceSize >::addElementFast( const Inde
    Index elementPtr, rowEnd, step;
    DeviceDependentCode::initRowTraverseFast( *this, row, elementPtr, rowEnd, step );
 
-   IndexType col;
+   IndexType col = 0;
    while( elementPtr < rowEnd &&
           ( col = this->columnIndexes[ elementPtr ] ) < column &&
           col != this->getPaddingIndex() ) elementPtr += step;
@@ -241,7 +241,7 @@ bool SlicedEllpack< Real, Device, Index, SliceSize >::addElement( const IndexTyp
    Index elementPtr, rowEnd, step;
    DeviceDependentCode::initRowTraverse( *this, row, elementPtr, rowEnd, step );
 
-   IndexType col;
+   IndexType col = 0;
    while( elementPtr < rowEnd &&
           ( col = this->columnIndexes.getElement( elementPtr ) ) < column &&
           col != this->getPaddingIndex() ) elementPtr += step;
@@ -379,7 +379,7 @@ Real SlicedEllpack< Real, Device, Index, SliceSize >::getElementFast( const Inde
    Index elementPtr, rowEnd, step;
    DeviceDependentCode::initRowTraverseFast( *this, row, elementPtr, rowEnd, step );
 
-   IndexType col;
+   IndexType col = 0;
    while( elementPtr < rowEnd &&
           ( col = this->columnIndexes[ elementPtr ] ) < column &&
           col != this->getPaddingIndex() )
@@ -400,7 +400,7 @@ Real SlicedEllpack< Real, Device, Index, SliceSize >::getElement( const IndexTyp
    Index elementPtr, rowEnd, step;
    DeviceDependentCode::initRowTraverse( *this, row, elementPtr, rowEnd, step );
 
-   IndexType col;
+   IndexType col = 0;
    while( elementPtr < rowEnd &&
           ( col = this->columnIndexes.getElement( elementPtr ) ) < column &&
           col != this->getPaddingIndex() )
diff --git a/src/TNL/Matrices/Tridiagonal_impl.h b/src/TNL/Matrices/Tridiagonal_impl.h
index e766d78b15..afd72d1cd6 100644
--- a/src/TNL/Matrices/Tridiagonal_impl.h
+++ b/src/TNL/Matrices/Tridiagonal_impl.h
@@ -129,7 +129,7 @@ template< typename Real,
           typename Index >
 Index Tridiagonal< Real, Device, Index > :: getNumberOfNonzeroMatrixElements() const
 {
-   IndexType nonzeroElements;
+   IndexType nonzeroElements = 0;
    for( IndexType i = 0; i < this->values.getSize(); i++ )
       if( this->values.getElement( i ) != 0 )
          nonzeroElements++;
@@ -631,13 +631,13 @@ class TridiagonalDeviceDependentCode< Devices::Host >
          if( row == 0 )
             return vector[ 0 ] * values[ 0 ] +
                    vector[ 1 ] * values[ 1 ];
-         Index i = 3 * row - 1;
+         Index i = 3 * row;
          if( row == rows - 1 )
-            return vector[ row - 1 ] * values[ i++ ] +
+            return vector[ row - 1 ] * values[ i - 1 ] +
                    vector[ row ] * values[ i ];
-         return vector[ row - 1 ] * values[ i++ ] +
-                vector[ row ] * values[ i++ ] +
-                vector[ row + 1 ] * values[ i ];
+         return vector[ row - 1 ] * values[ i - 1 ] +
+                vector[ row ] * values[ i ] +
+                vector[ row + 1 ] * values[ i + 1 ];
       }
 
       template< typename Real,
diff --git a/src/TNL/Meshes/GridDetails/GridEntityMeasureGetter.h b/src/TNL/Meshes/GridDetails/GridEntityMeasureGetter.h
index 3fdfc69a4c..0bf847c3e8 100644
--- a/src/TNL/Meshes/GridDetails/GridEntityMeasureGetter.h
+++ b/src/TNL/Meshes/GridDetails/GridEntityMeasureGetter.h
@@ -34,7 +34,7 @@ class GridEntityMeasureGetter< Meshes::Grid< Dimensions, Real, Device, Index >,
  
       template< typename EntityType >
       __cuda_callable__ inline
-      static const Real& getMeasure( const GridType& grid,
+      static const Real getMeasure( const GridType& grid,
                                      const EntityType& entity )
       {
          return 0.0;
diff --git a/src/TNL/Meshes/MeshBuilder.h b/src/TNL/Meshes/MeshBuilder.h
index b576ffe62a..d9782c4c28 100644
--- a/src/TNL/Meshes/MeshBuilder.h
+++ b/src/TNL/Meshes/MeshBuilder.h
@@ -105,7 +105,7 @@ class MeshBuilder
          for( GlobalIndexType i = 0; i < this->points.getSize(); i++ )
             if (! this->pointsSet[ i ] )
                return false;
-            return true;
+         return true;
       }
 
       PointArrayType points;
diff --git a/src/TNL/Meshes/MeshDetails/MeshEntityReferenceOrientation.h b/src/TNL/Meshes/MeshDetails/MeshEntityReferenceOrientation.h
index 1b1e1e6149..73fb5e80dc 100644
--- a/src/TNL/Meshes/MeshDetails/MeshEntityReferenceOrientation.h
+++ b/src/TNL/Meshes/MeshDetails/MeshEntityReferenceOrientation.h
@@ -35,7 +35,7 @@ class MeshEntityReferenceOrientation
          }
       }
  
-      static String getType(){};
+      static String getType(){ return "MeshEntityReferenceOrientation"; };
 
       EntityOrientation createOrientation( const SeedType& seed ) const
       {
diff --git a/src/TNL/Meshes/MeshDetails/MeshWriterVTKLegacy.h b/src/TNL/Meshes/MeshDetails/MeshWriterVTKLegacy.h
index 5acbb754ae..ff4673a790 100644
--- a/src/TNL/Meshes/MeshDetails/MeshWriterVTKLegacy.h
+++ b/src/TNL/Meshes/MeshDetails/MeshWriterVTKLegacy.h
@@ -72,8 +72,7 @@ class MeshWriterVTKLegacy
       outputFile << std::setprecision( 6 );
       outputFile << std::fixed;
 
-      if( ! writeMesh( outputFile, mesh, verbose ) )
-         return false;
+      return writeMesh( outputFile, mesh, verbose );
    }
 
    template< typename MeshType >
diff --git a/src/TNL/Meshes/MeshDetails/initializer/MeshEntityInitializer.h b/src/TNL/Meshes/MeshDetails/initializer/MeshEntityInitializer.h
index 12d6b4ffa1..37e0988199 100644
--- a/src/TNL/Meshes/MeshDetails/initializer/MeshEntityInitializer.h
+++ b/src/TNL/Meshes/MeshDetails/initializer/MeshEntityInitializer.h
@@ -74,7 +74,7 @@ class MeshEntityInitializer
 
    //using SuperentityBaseType::setNumberOfSuperentities;
 
-   static String getType() {};
+   static String getType() { return "MeshEntityInitializer"; };
 
    MeshEntityInitializer() : entity(0), entityIndex( -1 ) {}
 
@@ -111,7 +111,7 @@ class MeshEntityInitializer< MeshConfig, MeshVertexTopology >
       typedef typename MeshTraits< MeshConfig >::PointType  PointType;
       typedef MeshInitializer< MeshConfig >                 InitializerType;
 
-      static String getType() {};
+      static String getType() { return "MeshEntityInitializer"; };
  
       static void setVertexPoint( VertexType& vertex,
                                   const PointType& point,
diff --git a/src/TNL/Meshes/MeshDetails/initializer/MeshInitializer.h b/src/TNL/Meshes/MeshDetails/initializer/MeshInitializer.h
index c80844f758..22e88efda6 100644
--- a/src/TNL/Meshes/MeshDetails/initializer/MeshInitializer.h
+++ b/src/TNL/Meshes/MeshDetails/initializer/MeshInitializer.h
@@ -337,6 +337,7 @@ class MeshInitializerLayer< MeshConfig,
       using BaseType::findEntitySeedIndex;
       GlobalIndexType findEntitySeedIndex( const SeedType& seed ) const
       {
+         // FIXME: index may be uninitialized (when seedsIndexedSet.find returns false)
          GlobalIndexType index;
          this->seedsIndexedSet.find( seed, index );
          return index;
diff --git a/src/TNL/Solvers/ODE/ExplicitSolver_impl.h b/src/TNL/Solvers/ODE/ExplicitSolver_impl.h
index b9b4341721..bfe133d779 100644
--- a/src/TNL/Solvers/ODE/ExplicitSolver_impl.h
+++ b/src/TNL/Solvers/ODE/ExplicitSolver_impl.h
@@ -18,9 +18,9 @@ template< typename Problem >
 ExplicitSolver< Problem >::
 ExplicitSolver()
 :  time( 0.0 ),
+   stopTime( 0.0 ),
    tau( 0.0 ),
    maxTau( DBL_MAX ),
-   stopTime( 0.0 ),
    solver_comm( MPI_COMM_WORLD ),
    verbosity( 0 ),
    timer( &defaultTimer ),
diff --git a/src/TNL/Solvers/PDE/ExplicitUpdater.h b/src/TNL/Solvers/PDE/ExplicitUpdater.h
index 78e2825f66..45b33efa2c 100644
--- a/src/TNL/Solvers/PDE/ExplicitUpdater.h
+++ b/src/TNL/Solvers/PDE/ExplicitUpdater.h
@@ -27,6 +27,8 @@ class ExplicitUpdaterTraverserUserData
 {
    public:
       
+      const Real time;
+
       const DifferentialOperator* differentialOperator;
 
       const BoundaryConditions* boundaryConditions;
@@ -35,8 +37,6 @@ class ExplicitUpdaterTraverserUserData
 
       MeshFunction *u, *fu;
       
-      const Real time;
-
       ExplicitUpdaterTraverserUserData( const Real& time,
                                         const DifferentialOperator* differentialOperator,
                                         const BoundaryConditions* boundaryConditions,
diff --git a/src/TNL/Timer.cpp b/src/TNL/Timer.cpp
index e5434b8049..06a5035801 100644
--- a/src/TNL/Timer.cpp
+++ b/src/TNL/Timer.cpp
@@ -142,7 +142,7 @@ bool Timer::writeLog( Logger& logger, int logLevel )
    logger.writeParameter< double                 >( "Real time:",  this->getRealTime(),  logLevel );
    logger.writeParameter< double                 >( "CPU time:",   this->getCPUTime(),   logLevel );
    logger.writeParameter< unsigned long long int >( "CPU Cycles:", this->getCPUCycles(), logLevel );
-
+   return true;
 }
 
 } // namespace TNL
diff --git a/tests/benchmarks/heat-equation-benchmark/tnl-benchmark-simple-heat-equation.h b/tests/benchmarks/heat-equation-benchmark/tnl-benchmark-simple-heat-equation.h
index 9a6cf7b95e..19750dc214 100644
--- a/tests/benchmarks/heat-equation-benchmark/tnl-benchmark-simple-heat-equation.h
+++ b/tests/benchmarks/heat-equation-benchmark/tnl-benchmark-simple-heat-equation.h
@@ -210,7 +210,7 @@ __global__ void updateKernel( Real* u,
 
 template< typename Real, typename Index >
 bool writeFunction(
-   char* fileName,
+   const char* fileName,
    const Real* data,
    const Index xSize,
    const Index ySize,
@@ -232,6 +232,7 @@ bool writeFunction(
          file << i * hx - originX << " " << j * hy - originY << " " << data[ j * xSize + i ] << endl;
       file << endl;
    }
+   return true;
 }
 
 template< typename Real, typename Index >
diff --git a/tests/benchmarks/spmv.h b/tests/benchmarks/spmv.h
index c7c9a2fc7d..a197a15a73 100644
--- a/tests/benchmarks/spmv.h
+++ b/tests/benchmarks/spmv.h
@@ -173,11 +173,13 @@ benchmarkSpmvSynthetic( Benchmark & benchmark,
                         const int & size,
                         const int & elementsPerRow )
 {
+    bool result = true;
     // TODO: benchmark all formats from tnl-benchmark-spmv (different parameters of the base formats)
-    benchmarkSpMV< Real, Matrices::CSR >( benchmark, loops, size, elementsPerRow );
-    benchmarkSpMV< Real, Matrices::Ellpack >( benchmark, loops, size, elementsPerRow );
-    benchmarkSpMV< Real, SlicedEllpack >( benchmark, loops, size, elementsPerRow );
-    benchmarkSpMV< Real, Matrices::ChunkedEllpack >( benchmark, loops, size, elementsPerRow );
+    result |= benchmarkSpMV< Real, Matrices::CSR >( benchmark, loops, size, elementsPerRow );
+    result |= benchmarkSpMV< Real, Matrices::Ellpack >( benchmark, loops, size, elementsPerRow );
+    result |= benchmarkSpMV< Real, SlicedEllpack >( benchmark, loops, size, elementsPerRow );
+    result |= benchmarkSpMV< Real, Matrices::ChunkedEllpack >( benchmark, loops, size, elementsPerRow );
+    return result;
 }
 
 } // namespace benchmarks
diff --git a/tools/src/tnl-diff.h b/tools/src/tnl-diff.h
index 232df3d58e..756fc6d180 100644
--- a/tools/src/tnl-diff.h
+++ b/tools/src/tnl-diff.h
@@ -300,6 +300,7 @@ bool computeDifference( const MeshPointer& meshPointer, const String& objectType
    if( objectType == "Containers::Vector" ||
        objectType == "tnlVector" || objectType == "tnlSharedVector" )   // TODO: remove deprecated type name
       return computeDifferenceOfVectors< MeshPointer, Element, Real, Index >( meshPointer, parameters );
+   return false;
 }
 
 
@@ -379,6 +380,7 @@ bool setTupleType( const MeshPointer& meshPointer,
             return setIndexType< MeshPointer, Containers::StaticVector< 3, long double >, long double >( meshPointer, inputFileName, parsedObjectType, parameters );
             break;
       }
+   return false;
 }
 
 template< typename MeshPointer >
@@ -444,21 +446,22 @@ bool processFiles( const Config::ParameterContainer& parameters )
       }
 
    String objectType;
-   if( ! getObjectType( inputFiles[ 0 ], objectType ) )
+   if( ! getObjectType( inputFiles[ 0 ], objectType ) ) {
        std::cerr << "unknown object ... SKIPPING!" << std::endl;
-   else
-   {
-      if( verbose )
-        std::cout << objectType << " detected ... ";
+       return false;
+   }
 
-      List< String > parsedObjectType;
-      if( ! parseObjectType( objectType, parsedObjectType ) )
-      {
-         std::cerr << "Unable to parse object type " << objectType << "." << std::endl;
-         return false;
-      }
-      setElementType< MeshPointer >( meshPointer, inputFiles[ 0 ], parsedObjectType, parameters );
+   if( verbose )
+     std::cout << objectType << " detected ... ";
+
+   List< String > parsedObjectType;
+   if( ! parseObjectType( objectType, parsedObjectType ) )
+   {
+      std::cerr << "Unable to parse object type " << objectType << "." << std::endl;
+      return false;
    }
+   setElementType< MeshPointer >( meshPointer, inputFiles[ 0 ], parsedObjectType, parameters );
+   return true;
 }
 
 #endif /* TNL_DIFF_H_ */
diff --git a/tools/src/tnl-image-converter.cpp b/tools/src/tnl-image-converter.cpp
index 8effaace27..ebe9e6bef1 100644
--- a/tools/src/tnl-image-converter.cpp
+++ b/tools/src/tnl-image-converter.cpp
@@ -128,6 +128,7 @@ bool processImages( const Config::ParameterContainer& parameters )
          continue;
       }
    }
+   return true;
 }
 
 bool processTNLFiles( const Config::ParameterContainer& parameters )
@@ -189,6 +190,7 @@ bool processTNLFiles( const Config::ParameterContainer& parameters )
       }
 
    }
+   return true;
 }
 
 int main( int argc, char* argv[] )
diff --git a/tools/src/tnl-init.h b/tools/src/tnl-init.h
index 0788afaa23..41a2ce7774 100644
--- a/tools/src/tnl-init.h
+++ b/tools/src/tnl-init.h
@@ -198,6 +198,7 @@ bool resolveRealType( const Config::ParameterContainer& parameters )
       return resolveDerivatives< MeshType, double >( parameters );
    if( realType == "long-double" )
       return resolveDerivatives< MeshType, long double >( parameters );
+   return false;
 }
 
 
@@ -226,6 +227,8 @@ bool resolveIndexType( const List< String >& parsedMeshType,
 
    if( parsedMeshType[ 4 ] == "long int" )
       return resolveMesh< Dimensions, RealType, long int >( parsedMeshType, parameters );
+
+   return false;
 }
 
 template< int Dimensions >
@@ -241,6 +244,8 @@ bool resolveRealType( const List< String >& parsedMeshType,
 
    if( parsedMeshType[ 2 ] == "long-double" )
       return resolveIndexType< Dimensions, long double >( parsedMeshType, parameters );
+
+   return false;
 }
 
 bool resolveMeshType( const List< String >& parsedMeshType,
@@ -259,5 +264,6 @@ bool resolveMeshType( const List< String >& parsedMeshType,
    if( dimensions == 3 )
       return resolveRealType< 3 >( parsedMeshType, parameters );
 
+   return false;
 }
 #endif /* TNL_INIT_H_ */
diff --git a/tools/src/tnl-mesh-convert.h b/tools/src/tnl-mesh-convert.h
index f65233e09f..7e0bbac010 100644
--- a/tools/src/tnl-mesh-convert.h
+++ b/tools/src/tnl-mesh-convert.h
@@ -51,6 +51,7 @@ bool convertMesh( const Config::ParameterContainer& parameters )
          std::cerr << "I am not able to write the mesh into the file " << outputFileName << "." << std::endl;
          return false;
       }
+      return true;
    }
    if( outputFileExt == "vtk" )
    {
@@ -61,6 +62,7 @@ bool convertMesh( const Config::ParameterContainer& parameters )
       }
       return true;
    }
+   return false;
 }
 
 bool readNetgenMesh( const Config::ParameterContainer& parameters )
@@ -114,6 +116,7 @@ bool convertMesh( const Config::ParameterContainer& parameters )
    const String fileExt = getFileExtension( inputFileName );
    if( fileExt == "ng" )
       return readNetgenMesh( parameters );
+   return false;
 }
 
 
diff --git a/tools/src/tnl-view.h b/tools/src/tnl-view.h
index 1924324144..cb34f429a6 100644
--- a/tools/src/tnl-view.h
+++ b/tools/src/tnl-view.h
@@ -340,6 +340,7 @@ bool setTupleType( const MeshPointer& meshPointer,
             return setIndexType< MeshPointer, Containers::StaticVector< 3, long double >, long double >( meshPointer, inputFileName, parsedObjectType, parameters );
             break;
       }
+   return false;
 }
 
 template< typename MeshPointer >
-- 
GitLab