Commit e9a8c397 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Avoiding more warnings about unused variables

parent 3af1c308
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ benchmarkArrayOperations( Benchmark & benchmark,
   deviceArray2.setSize( size );
#endif

   Real resultHost, resultDevice;
   Real resultHost;


   // reset functions
@@ -104,6 +104,7 @@ benchmarkArrayOperations( Benchmark & benchmark,
   benchmark.setOperation( "comparison (operator==)", 2 * datasetSize );
   benchmark.time< Devices::Host >( reset1, "CPU", compareHost );
#ifdef HAVE_CUDA
   Real resultDevice;
   auto compareCuda = [&]() {
      resultDevice = (int) ( deviceArray == deviceArray2 );
   };
@@ -118,6 +119,7 @@ benchmarkArrayOperations( Benchmark & benchmark,
   // copyBasetime is used later inside HAVE_CUDA guard, so the compiler will
   // complain when compiling without CUDA
   const double copyBasetime = benchmark.time< Devices::Host >( reset1, "CPU", copyAssignHostHost );
   (void)copyBasetime;  // ignore unused variable
#ifdef HAVE_CUDA
   auto copyAssignCudaCuda = [&]() {
      deviceArray = deviceArray2;
+8 −0
Original line number Diff line number Diff line
@@ -144,6 +144,14 @@ class MpiCommunicator
         MPI_Init( &argc, &argv );
         selectGPU();
#endif

         // silence warnings about (potentially) unused variables
         (void) NullGroup;
         (void) NullRequest;
         (void) backup;
         (void) psbuf;
         (void) filestr;
         (void) redirect;
      }

      static void setRedirection( bool redirect_ )
+2 −1
Original line number Diff line number Diff line
@@ -166,7 +166,8 @@ class DistributedGridIO_MPIIOBase
                      MPI_MODE_CREATE | MPI_MODE_WRONLY,
                      MPI_INFO_NULL,
                      &file);
      TNL_ASSERT_EQ(ok,0,"Open file falied");
      if( ok != 0 )
         throw std::runtime_error("Open file falied");
      
		int written=save(file,meshFunction, data,0);

+6 −0
Original line number Diff line number Diff line
@@ -127,6 +127,8 @@ protected:
   #pragma diag_suppress = declared_but_not_referenced
#endif

#define MAYBE_UNUSED(expr) (void)(expr)

#define SETUP_BINARY_TEST_ALIASES \
   using Left = typename TestFixture::Left;                 \
   using Right = typename TestFixture::Right;               \
@@ -134,6 +136,10 @@ protected:
   Left& L2 = this->L2;                                     \
   Right& R1 = this->R1;                                    \
   Right& R2 = this->R2;                                    \
   MAYBE_UNUSED(L1);                                        \
   MAYBE_UNUSED(L2);                                        \
   MAYBE_UNUSED(R1);                                        \
   MAYBE_UNUSED(R2);                                        \

// types for which VectorBinaryOperationsTest is instantiated
#if defined(DISTRIBUTED_VECTOR)
+7 −12
Original line number Diff line number Diff line
@@ -142,7 +142,6 @@ TYPED_TEST_SUITE( VectorUnaryOperationsTest, VectorTypes );
#ifdef STATIC_VECTOR
   #define SETUP_UNARY_VECTOR_TEST( _ ) \
      using VectorOrView = typename TestFixture::VectorOrView; \
      constexpr int size = VectorOrView::getSize();            \
                                                               \
      VectorOrView V1, V2;                                     \
                                                               \
@@ -153,13 +152,13 @@ TYPED_TEST_SUITE( VectorUnaryOperationsTest, VectorTypes );
      using VectorOrView = typename TestFixture::VectorOrView; \
      using RealType = typename VectorOrView::RealType;        \
      using ExpectedVector = typename TestFixture::template Vector< decltype(function(RealType{})) >; \
      constexpr int size = VectorOrView::getSize();            \
      constexpr int _size = VectorOrView::getSize();            \
                                                               \
      VectorOrView V1;                                         \
      ExpectedVector expected;                                 \
                                                               \
      const double h = (double) (end - begin) / size;          \
      for( int i = 0; i < size; i++ )                          \
      const double h = (double) (end - begin) / _size;         \
      for( int i = 0; i < _size; i++ )                         \
      {                                                        \
         const RealType x = begin + i * h;                     \
         V1[ i ] = x;                                          \
@@ -167,10 +166,9 @@ TYPED_TEST_SUITE( VectorUnaryOperationsTest, VectorTypes );
      }                                                        \

#elif defined(DISTRIBUTED_VECTOR)
   #define SETUP_UNARY_VECTOR_TEST( _size ) \
   #define SETUP_UNARY_VECTOR_TEST( size ) \
      using VectorType = typename TestFixture::VectorType;     \
      using VectorOrView = typename TestFixture::VectorOrView; \
      constexpr int size = _size;                              \
      using CommunicatorType = typename VectorOrView::CommunicatorType; \
      const auto group = CommunicatorType::AllGroup; \
      using LocalRangeType = typename VectorOrView::LocalRangeType; \
@@ -185,14 +183,13 @@ TYPED_TEST_SUITE( VectorUnaryOperationsTest, VectorTypes );
                                                               \
      VectorOrView V1( _V1 ), V2( _V2 );                       \

   #define SETUP_UNARY_VECTOR_TEST_FUNCTION( _size, begin, end, function ) \
   #define SETUP_UNARY_VECTOR_TEST_FUNCTION( size, begin, end, function ) \
      using VectorType = typename TestFixture::VectorType;     \
      using VectorOrView = typename TestFixture::VectorOrView; \
      using RealType = typename VectorType::RealType;          \
      using ExpectedVector = typename TestFixture::template Vector< decltype(function(RealType{})) >; \
      using HostVector = typename VectorType::template Self< RealType, Devices::Host >; \
      using HostExpectedVector = typename ExpectedVector::template Self< decltype(function(RealType{})), Devices::Host >; \
      constexpr int size = _size;                              \
      using CommunicatorType = typename VectorOrView::CommunicatorType; \
      const auto group = CommunicatorType::AllGroup; \
      using LocalRangeType = typename VectorOrView::LocalRangeType; \
@@ -216,10 +213,9 @@ TYPED_TEST_SUITE( VectorUnaryOperationsTest, VectorTypes );
      ExpectedVector expected; expected = expected_h;          \

#else
   #define SETUP_UNARY_VECTOR_TEST( _size ) \
   #define SETUP_UNARY_VECTOR_TEST( size ) \
      using VectorType = typename TestFixture::VectorType;     \
      using VectorOrView = typename TestFixture::VectorOrView; \
      constexpr int size = _size;                              \
                                                               \
      VectorType _V1( size ), _V2( size );                     \
                                                               \
@@ -228,14 +224,13 @@ TYPED_TEST_SUITE( VectorUnaryOperationsTest, VectorTypes );
                                                               \
      VectorOrView V1( _V1 ), V2( _V2 );                       \

   #define SETUP_UNARY_VECTOR_TEST_FUNCTION( _size, begin, end, function ) \
   #define SETUP_UNARY_VECTOR_TEST_FUNCTION( size, begin, end, function ) \
      using VectorType = typename TestFixture::VectorType;     \
      using VectorOrView = typename TestFixture::VectorOrView; \
      using RealType = typename VectorType::RealType;          \
      using ExpectedVector = typename TestFixture::template Vector< decltype(function(RealType{})) >; \
      using HostVector = typename VectorType::template Self< RealType, Devices::Host >; \
      using HostExpectedVector = typename ExpectedVector::template Self< decltype(function(RealType{})), Devices::Host >; \
      constexpr int size = _size;                              \
                                                               \
      HostVector _V1h( size );                                 \
      HostExpectedVector expected_h( size );                   \