diff --git a/vtkm/Types.h b/vtkm/Types.h index 6bf11c49d..0df485d9a 100644 --- a/vtkm/Types.h +++ b/vtkm/Types.h @@ -388,7 +388,10 @@ namespace detail #if (defined(VTKM_CUDA) && (__CUDACC_VER_MAJOR__ < 8)) #if (defined(VTKM_GCC) || defined(VTKM_CLANG)) #pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunknown-pragmas" +#pragma GCC diagnostic ignored "-Wpragmas" #pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wfloat-conversion" #endif // gcc || clang #endif // use cuda < 8 template @@ -479,7 +482,10 @@ public: #if (!(defined(VTKM_CUDA) && (__CUDACC_VER_MAJOR__ < 8))) #if (defined(VTKM_GCC) || defined(VTKM_CLANG)) #pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunknown-pragmas" +#pragma GCC diagnostic ignored "-Wpragmas" #pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wfloat-conversion" #endif // gcc || clang #endif // not using cuda < 8 @@ -596,11 +602,7 @@ public: VTKM_EXEC_CONT const ComponentType* GetPointer() const { return &this->Component(0); } }; -#if (defined(VTKM_CUDA) && (__CUDACC_VER_MAJOR__ < 8)) -#if (defined(VTKM_GCC) || defined(VTKM_CLANG)) -#pragma GCC diagnostic pop -#endif // gcc || clang -#endif // use cuda < 8 + /// Base implementation of all Vec classes. /// @@ -623,12 +625,28 @@ protected: } } +#if (!(defined(VTKM_CUDA) && (__CUDACC_VER_MAJOR__ < 8))) +#if (defined(VTKM_GCC) || defined(VTKM_CLANG)) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunknown-pragmas" +#pragma GCC diagnostic ignored "-Wpragmas" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wfloat-conversion" +#endif // gcc || clang +#endif //not using cuda < 8 +#if defined(VTKM_MSVC) +#pragma warning(push) +#pragma warning(disable : 4244) +#endif + template - VTKM_EXEC_CONT VecBase(const VecBase& src) + VTKM_EXEC_CONT explicit VecBase(const VecBase& src) { + //DO NOT CHANGE THIS AND THE ABOVE PRAGMA'S UNLESS YOU FULLY UNDERSTAND THE + //ISSUE https://gitlab.kitware.com/vtk/vtk-m/issues/221 for (vtkm::IdComponent i = 0; i < Size; ++i) { - this->Components[i] = static_cast(src[i]); + this->Components[i] = src[i]; } } @@ -649,12 +667,6 @@ public: return this->Components[idx]; } -#if (!(defined(VTKM_CUDA) && (__CUDACC_VER_MAJOR__ < 8))) -#if (defined(VTKM_GCC) || defined(VTKM_CLANG)) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif // gcc || clang -#endif // not using cuda < 8 template inline VTKM_EXEC_CONT DerivedClass @@ -721,11 +733,20 @@ public: #pragma GCC diagnostic pop #endif // gcc || clang #endif // not using cuda < 8 +#if defined(VTKM_MSVC) +#pragma warning(pop) +#endif protected: ComponentType Components[NUM_COMPONENTS]; }; +#if (defined(VTKM_CUDA) && (__CUDACC_VER_MAJOR__ < 8)) +#if (defined(VTKM_GCC) || defined(VTKM_CLANG)) +#pragma GCC diagnostic pop +#endif // gcc || clang +#endif // use cuda < 8 + /// Base of all VecC and VecCConst classes. /// template @@ -771,10 +792,9 @@ public: : Superclass(value) { } - // VTKM_EXEC_CONT explicit Vec(const T* values) : Superclass(values) { } template - VTKM_EXEC_CONT Vec(const Vec& src) + VTKM_EXEC_CONT explicit Vec(const Vec& src) : Superclass(src) { } @@ -835,14 +855,6 @@ public: : Superclass(src) { } - - // This convenience operator removed because it was causing ambiguous - // overload errors - // VTKM_EXEC_CONT - // operator T() const - // { - // return this->Components[0]; - // } }; //----------------------------------------------------------------------------- @@ -936,21 +948,6 @@ public: } }; -/// Provides the appropriate type when not sure if using a Vec or a scalar in a -/// templated class or function. The \c Type in the struct is the same as the -/// \c ComponentType when \c NumComponents is 1 and a \c Vec otherwise. -/// -template -struct VecOrScalar -{ - using Type = vtkm::Vec; -}; -template -struct VecOrScalar -{ - using Type = ComponentType; -}; - /// Initializes and returns a Vec of length 2. /// template