Commit 238c404b authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Avoiding compiler warnings

parent a4157051
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -102,6 +102,11 @@ if( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
   set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-maybe-uninitialized" )
endif()

# disable false Clang warning: https://stackoverflow.com/q/57645872
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
   set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-self-assign-overloaded" )
endif()

# enable link time optimizations (but not in continuous integration)
if( NOT DEFINED ENV{CI_JOB_NAME} )
   if( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
+16 −0
Original line number Diff line number Diff line
@@ -30,6 +30,14 @@
 * Implemented by: Jakub Klinkovsky
 */

// wrapper for nvcc pragma which disables warnings about __host__ __device__
// functions: https://stackoverflow.com/q/55481202
#ifdef __NVCC__
   #define TNL_NVCC_HD_WARNING_DISABLE #pragma hd_warning_disable
#else
   #define TNL_NVCC_HD_WARNING_DISABLE
#endif

#if defined(NDEBUG) || defined(HAVE_MIC)

// empty macros for optimized build
@@ -280,6 +288,7 @@ cmpHelperOpFailure( const char* assertion,
   fatalFailure();
}

TNL_NVCC_HD_WARNING_DISABLE
template< typename T1, typename T2 >
__cuda_callable__ void
cmpHelperTrue( const char* assertion,
@@ -298,6 +307,7 @@ cmpHelperTrue( const char* assertion,
                                         expr1, "true", val1, true, "==" );
}

TNL_NVCC_HD_WARNING_DISABLE
template< typename T1, typename T2 >
__cuda_callable__ void
cmpHelperFalse( const char* assertion,
@@ -336,16 +346,22 @@ cmpHelper##op_name( const char* assertion, \
}

// Implements the helper function for TNL_ASSERT_EQ
TNL_NVCC_HD_WARNING_DISABLE
TNL_IMPL_CMP_HELPER_( EQ, == );
// Implements the helper function for TNL_ASSERT_NE
TNL_NVCC_HD_WARNING_DISABLE
TNL_IMPL_CMP_HELPER_( NE, != );
// Implements the helper function for TNL_ASSERT_LE
TNL_NVCC_HD_WARNING_DISABLE
TNL_IMPL_CMP_HELPER_( LE, <= );
// Implements the helper function for TNL_ASSERT_LT
TNL_NVCC_HD_WARNING_DISABLE
TNL_IMPL_CMP_HELPER_( LT, < );
// Implements the helper function for TNL_ASSERT_GE
TNL_NVCC_HD_WARNING_DISABLE
TNL_IMPL_CMP_HELPER_( GE, >= );
// Implements the helper function for TNL_ASSERT_GT
TNL_NVCC_HD_WARNING_DISABLE
TNL_IMPL_CMP_HELPER_( GT, > );

#undef TNL_IMPL_CMP_HELPER_
+5 −0
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@ public:

   // Copy-assignment does deep copy, just like regular array, but the sizes
   // must match (i.e. copy-assignment cannot resize).
   TNL_NVCC_HD_WARNING_DISABLE
   __cuda_callable__
   NDArrayView& operator=( const NDArrayView& other )
   {
@@ -79,7 +80,9 @@ public:
   }

   // Templated copy-assignment
   TNL_NVCC_HD_WARNING_DISABLE
   template< typename OtherView >
   __cuda_callable__
   NDArrayView& operator=( const OtherView& other )
   {
      static_assert( std::is_same< PermutationType, typename OtherView::PermutationType >::value,
@@ -128,6 +131,7 @@ public:
      array = nullptr;
   }

   TNL_NVCC_HD_WARNING_DISABLE
   __cuda_callable__
   bool operator==( const NDArrayView& other ) const
   {
@@ -137,6 +141,7 @@ public:
      return Algorithms::ArrayOperations< Device, Device >::compare( array, other.array, getStorageSize() );
   }

   TNL_NVCC_HD_WARNING_DISABLE
   __cuda_callable__
   bool operator!=( const NDArrayView& other ) const
   {
+2 −0
Original line number Diff line number Diff line
@@ -105,12 +105,14 @@ public:
      return i + begin;
   }

   __cuda_callable__
   bool operator==( const Subrange& other ) const
   {
      return begin == other.begin &&
             end == other.end;
   }

   __cuda_callable__
   bool operator!=( const Subrange& other ) const
   {
      return ! (*this == other);
+3 −1
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@ inline DicomImageInfo::DicomImageInfo( DicomHeader& dicomHeader )
: dicomHeader( dicomHeader )
{
    isObjectRetrieved = false;
    width = 0;
    height = 0;
    depth = 0;
}

Loading