Commit 066f518a authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Avoiding new compiler warnings in GCC 8.1

parent 1332b5d6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ void tnl_slice_indexing( Scope & scope )
            if (!slice.compute(a.getSize(), &start, &stop, &step, &slicelength))
                throw py::error_already_set();

            if (slicelength != value.getSize())
            if (slicelength != (size_t) value.getSize())
                throw std::runtime_error("Left and right hand size of slice assignment have different sizes!");

            for (size_t i = 0; i < slicelength; ++i) {
+11 −0
Original line number Diff line number Diff line
@@ -101,7 +101,18 @@ copyMemory( DestinationElement* destination,
   if( std::is_same< DestinationElement, SourceElement >::value &&
       ( std::is_fundamental< DestinationElement >::value ||
         std::is_pointer< DestinationElement >::value ) )
   {
      // GCC 8.1 complains that we bypass a non-trivial copy-constructor
      // (in C++17 we could use constexpr if to avoid compiling this branch in that case)
      #if defined(__GNUC__) && !defined(__clang__) && !defined(__NVCC__)
         #pragma GCC diagnostic push
         #pragma GCC diagnostic ignored "-Wclass-memaccess"
      #endif
      memcpy( destination, source, size * sizeof( DestinationElement ) );
      #if defined(__GNUC__) && !defined(__clang__) && !defined(__NVCC__)
         #pragma GCC diagnostic pop
      #endif
   }
   else
      for( Index i = 0; i < size; i ++ )
         destination[ i ] = ( DestinationElement ) source[ i ];
+2 −2
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ void SmartPointersRegister::remove( SmartPointer* pointer, int deviceId )
   try {
      pointersOnDevices.at( deviceId ).erase( pointer );
   }
   catch( std::out_of_range ) {
   catch( const std::out_of_range& ) {
      std::cerr << "Given deviceId " << deviceId << " does not have any pointers yet. "
                << "Requested to remove pointer " << pointer << ". "
                << "This is most likely a bug in the smart pointer." << std::endl;
@@ -46,7 +46,7 @@ bool SmartPointersRegister::synchronizeDevice( int deviceId )
         ( *it ).synchronize();
      return TNL_CHECK_CUDA_DEVICE;
   }
   catch( std::out_of_range ) {
   catch( const std::out_of_range& ) {
      return false;
   }
}