Fix warnings

This commit is contained in:
Sujin Philip 2020-07-03 10:27:56 -05:00 committed by Robert Maynard
parent 452f61e290
commit db57ed26a2
7 changed files with 28 additions and 23 deletions

@ -63,6 +63,7 @@ public:
return this->portal1.GetNumberOfValues() + this->portal2.GetNumberOfValues();
}
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC_CONT
ValueType Get(vtkm::Id index) const
{
@ -76,6 +77,7 @@ public:
}
}
VTKM_SUPPRESS_EXEC_WARNINGS
template <typename Writable_ = Writable,
typename = typename std::enable_if<Writable_::value>::type>
VTKM_EXEC_CONT void Set(vtkm::Id index, const ValueType& value) const

@ -82,6 +82,7 @@ public:
}
private:
VTKM_SUPPRESS_EXEC_WARNINGS
template <std::size_t I>
VTKM_EXEC_CONT ComponentType GetComponent(vtkm::Id valueIndex) const
{
@ -94,6 +95,7 @@ private:
return ValueType{ this->GetComponent<I>(valueIndex)... };
}
VTKM_SUPPRESS_EXEC_WARNINGS
template <std::size_t I>
VTKM_EXEC_CONT bool SetComponent(vtkm::Id valueIndex, const ValueType& value) const
{

@ -68,9 +68,11 @@ public:
{
}
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC_CONT
vtkm::Id GetNumberOfValues() const { return this->PortalFirst.GetNumberOfValues(); }
VTKM_SUPPRESS_EXEC_WARNINGS
template <typename Readable_ = Readable,
typename = typename std::enable_if<Readable_::value>::type>
VTKM_EXEC_CONT ValueType Get(vtkm::Id index) const noexcept
@ -78,6 +80,7 @@ public:
return vtkm::make_Pair(this->PortalFirst.Get(index), this->PortalSecond.Get(index));
}
VTKM_SUPPRESS_EXEC_WARNINGS
template <typename Writable_ = Writable,
typename = typename std::enable_if<Writable_::value>::type>
VTKM_EXEC_CONT void Set(vtkm::Id index, const ValueType& value) const noexcept

@ -46,6 +46,7 @@ struct NumIndicesDecorator
{
OffsetsPortal Offsets;
VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC_CONT
vtkm::IdComponent operator()(vtkm::Id cellId) const
{

@ -85,7 +85,6 @@ public:
// work there. This is so that this class can be used in classes that work in both
// control and execution environments without having to suppress warnings in them all.
VTKM_SUPPRESS_EXEC_WARNINGS
template <typename PT = Superclass,
typename std::enable_if<vtkm::internal::PortalSupportsGets<PT>::value, int>::type = 0>
VTKM_CONT typename Superclass::ValueType Get(vtkm::Id index) const
@ -104,10 +103,9 @@ public:
return this->Superclass::Get(index);
}
VTKM_SUPPRESS_EXEC_WARNINGS
template <typename PT = Superclass,
typename std::enable_if<vtkm::internal::PortalSupportsGets3D<PT>::value, int>::type = 0>
VTKM_EXEC_CONT typename Superclass::ValueType Get(vtkm::Id3 index) const
VTKM_CONT typename Superclass::ValueType Get(vtkm::Id3 index) const
{
if (!(*this->Valid))
{
@ -123,7 +121,6 @@ public:
return this->Superclass::Get(index);
}
VTKM_SUPPRESS_EXEC_WARNINGS
template <typename PT = Superclass,
typename std::enable_if<vtkm::internal::PortalSupportsSets<PT>::value, int>::type = 0>
VTKM_CONT void Set(vtkm::Id index, typename Superclass::ValueType value) const
@ -142,10 +139,9 @@ public:
this->Superclass::Set(index, value);
}
VTKM_SUPPRESS_EXEC_WARNINGS
template <typename PT = Superclass,
typename std::enable_if<vtkm::internal::PortalSupportsSets3D<PT>::value, int>::type = 0>
VTKM_EXEC_CONT void Set(vtkm::Id3 index, typename Superclass::ValueType value) const
VTKM_CONT void Set(vtkm::Id3 index, typename Superclass::ValueType value) const
{
if (!(*this->Valid))
{

@ -211,9 +211,9 @@ private:
{ //as input
vtkm::cont::Token token;
typename vtkm::cont::ArrayHandle<T>::template ExecutionTypes<DeviceAdapterTag>::PortalConst
executionPortal;
executionPortal = arrayHandle.PrepareForInput(DeviceAdapterTag(), token);
executionPortal = arrayHandle.PrepareForInput(DeviceAdapterTag(), token);
token.DetachFromAll();
static_cast<void>(executionPortal);
//use a worklet to verify the input transfer worked properly
vtkm::cont::ArrayHandle<T> result;
@ -225,9 +225,9 @@ private:
{ //as inplace
vtkm::cont::Token token;
typename vtkm::cont::ArrayHandle<T>::template ExecutionTypes<DeviceAdapterTag>::Portal
executionPortal;
executionPortal = arrayHandle.PrepareForInPlace(DeviceAdapterTag(), token);
executionPortal = arrayHandle.PrepareForInPlace(DeviceAdapterTag(), token);
token.DetachFromAll();
static_cast<void>(executionPortal);
//use a worklet to verify the inplace transfer worked properly
vtkm::cont::ArrayHandle<T> result;
@ -303,9 +303,9 @@ private:
{ //as input
vtkm::cont::Token token;
typename vtkm::cont::ArrayHandle<T>::template ExecutionTypes<DeviceAdapterTag>::PortalConst
executionPortal;
executionPortal = arrayHandle.PrepareForInput(DeviceAdapterTag(), token);
executionPortal = arrayHandle.PrepareForInput(DeviceAdapterTag(), token);
token.DetachFromAll();
static_cast<void>(executionPortal);
//use a worklet to verify the input transfer worked properly
vtkm::cont::ArrayHandle<T> result;
@ -317,9 +317,9 @@ private:
{ //as inplace
vtkm::cont::Token token;
typename vtkm::cont::ArrayHandle<T>::template ExecutionTypes<DeviceAdapterTag>::Portal
executionPortal;
executionPortal = arrayHandle.PrepareForInPlace(DeviceAdapterTag(), token);
executionPortal = arrayHandle.PrepareForInPlace(DeviceAdapterTag(), token);
token.DetachFromAll();
static_cast<void>(executionPortal);
//use a worklet to verify the inplace transfer worked properly
vtkm::cont::ArrayHandle<T> result;

@ -17,19 +17,19 @@ namespace
struct NewClass
{
VTKM_EXEC_CONT
VTKM_CONT
void ImportantMethod(double x, double tolerance)
{
std::cout << "Using " << x << " with tolerance " << tolerance << std::endl;
}
VTKM_EXEC_CONT
VTKM_CONT
VTKM_DEPRECATED(1.7, "You must now specify a tolerance.") void ImportantMethod(double x)
{
this->ImportantMethod(x, 1e-6);
}
VTKM_EXEC_CONT
VTKM_CONT
VTKM_DEPRECATED(1.6, "You must now specify both a value and tolerance.")
void ImportantMethod()
{
@ -91,9 +91,10 @@ static void DoTest()
std::cout << "Deprecation is: " << VTKM_STRINGIFY_FIRST(VTKM_DEPRECATED(X.Y, "Message."))
<< std::endl;
VTKM_TEST_ASSERT(test_equal(VTK_M_DEPRECATED_MAKE_MESSAGE(X.Y), " Deprecated in version X.Y."));
VTKM_TEST_ASSERT(test_equal(VTK_M_DEPRECATED_MAKE_MESSAGE(X.Y.Z, "Use feature foo instead."),
"Use feature foo instead. Deprecated in version X.Y.Z."));
VTKM_TEST_ASSERT(VTK_M_DEPRECATED_MAKE_MESSAGE(X.Y) ==
std::string(" Deprecated in version X.Y."));
VTKM_TEST_ASSERT(VTK_M_DEPRECATED_MAKE_MESSAGE(X.Y.Z, "Use feature foo instead.") ==
std::string("Use feature foo instead. Deprecated in version X.Y.Z."));
// Using valid classes with unused deprecated parts should be fine.
NewClass useIt;
@ -101,8 +102,8 @@ static void DoTest()
useIt.ImportantMethod(1.1, 1e-8);
DoSomethingWithObject(NewEnum::NEW_VALUE);
// These should each give compiler warnings.
#if 0
// These should each give compiler warnings without the suppressions.
VTKM_DEPRECATED_SUPPRESS_BEGIN
OldClass useOldClass;
DoSomethingWithObject(useOldClass);
OldAlias useOldAlias;
@ -114,7 +115,7 @@ static void DoTest()
DoSomethingWithObject(OldEnum::OLD_VALUE);
DoSomethingWithObject(NewEnum::OLD_VALUE1);
DoSomethingWithObject(NewEnum::OLD_VALUE2);
#endif
VTKM_DEPRECATED_SUPPRESS_END
}
} // anonymous namespace