Fix unnecessary deprecation warnings in visual studio

When using a deprecated `ArrayHandle`, you should get the warning when
you declare it, not when it's used in a templated class or method.
This commit is contained in:
Kenneth Moreland 2020-09-09 06:09:39 -06:00
parent f7cc03107d
commit e706880d7b
6 changed files with 78 additions and 0 deletions

@ -35,6 +35,15 @@ struct TransportTagArrayIn
template <typename ContObjectType, typename Device>
struct Transport<vtkm::cont::arg::TransportTagArrayIn, ContObjectType, Device>
{
// MSVC will issue deprecation warnings here if this template is instantiated with
// a deprecated class even if the template is used from a section of code where
// deprecation warnings are suppressed. This is annoying behavior since this template
// has no control over what class it is used with. To get around it, we have to
// suppress all deprecation warnings here.
#ifdef VTKM_MSVC
VTKM_DEPRECATED_SUPPRESS_BEGIN
#endif
VTKM_IS_ARRAY_HANDLE(ContObjectType);
using ExecObjectType = decltype(
@ -54,6 +63,10 @@ struct Transport<vtkm::cont::arg::TransportTagArrayIn, ContObjectType, Device>
return object.PrepareForInput(Device(), token);
}
#ifdef VTKM_MSVC
VTKM_DEPRECATED_SUPPRESS_END
#endif
};
}
}

@ -36,6 +36,15 @@ struct TransportTagArrayInOut
template <typename ContObjectType, typename Device>
struct Transport<vtkm::cont::arg::TransportTagArrayInOut, ContObjectType, Device>
{
// MSVC will issue deprecation warnings here if this template is instantiated with
// a deprecated class even if the template is used from a section of code where
// deprecation warnings are suppressed. This is annoying behavior since this template
// has no control over what class it is used with. To get around it, we have to
// suppress all deprecation warnings here.
#ifdef VTKM_MSVC
VTKM_DEPRECATED_SUPPRESS_BEGIN
#endif
// If you get a compile error here, it means you tried to use an object that
// is not an array handle as an argument that is expected to be one.
VTKM_IS_ARRAY_HANDLE(ContObjectType);
@ -57,6 +66,10 @@ struct Transport<vtkm::cont::arg::TransportTagArrayInOut, ContObjectType, Device
return object.PrepareForInPlace(Device(), token);
}
#ifdef VTKM_MSVC
VTKM_DEPRECATED_SUPPRESS_END
#endif
};
}
}

@ -35,6 +35,15 @@ struct TransportTagArrayOut
template <typename ContObjectType, typename Device>
struct Transport<vtkm::cont::arg::TransportTagArrayOut, ContObjectType, Device>
{
// MSVC will issue deprecation warnings here if this template is instantiated with
// a deprecated class even if the template is used from a section of code where
// deprecation warnings are suppressed. This is annoying behavior since this template
// has no control over what class it is used with. To get around it, we have to
// suppress all deprecation warnings here.
#ifdef VTKM_MSVC
VTKM_DEPRECATED_SUPPRESS_BEGIN
#endif
// If you get a compile error here, it means you tried to use an object that
// is not an array handle as an argument that is expected to be one.
VTKM_IS_ARRAY_HANDLE(ContObjectType);
@ -53,6 +62,10 @@ struct Transport<vtkm::cont::arg::TransportTagArrayOut, ContObjectType, Device>
{
return object.PrepareForOutput(outputRange, Device(), token);
}
#ifdef VTKM_MSVC
VTKM_DEPRECATED_SUPPRESS_END
#endif
};
}
}

@ -40,6 +40,15 @@ struct TransportTagWholeArrayIn
template <typename ContObjectType, typename Device>
struct Transport<vtkm::cont::arg::TransportTagWholeArrayIn, ContObjectType, Device>
{
// MSVC will issue deprecation warnings here if this template is instantiated with
// a deprecated class even if the template is used from a section of code where
// deprecation warnings are suppressed. This is annoying behavior since this template
// has no control over what class it is used with. To get around it, we have to
// suppress all deprecation warnings here.
#ifdef VTKM_MSVC
VTKM_DEPRECATED_SUPPRESS_BEGIN
#endif
// If you get a compile error here, it means you tried to use an object that
// is not an array handle as an argument that is expected to be one.
VTKM_IS_ARRAY_HANDLE(ContObjectType);
@ -62,6 +71,10 @@ struct Transport<vtkm::cont::arg::TransportTagWholeArrayIn, ContObjectType, Devi
return ExecObjectType(array, token);
}
#ifdef VTKM_MSVC
VTKM_DEPRECATED_SUPPRESS_END
#endif
};
}
}

@ -42,6 +42,15 @@ struct TransportTagWholeArrayInOut
template <typename ContObjectType, typename Device>
struct Transport<vtkm::cont::arg::TransportTagWholeArrayInOut, ContObjectType, Device>
{
// MSVC will issue deprecation warnings here if this template is instantiated with
// a deprecated class even if the template is used from a section of code where
// deprecation warnings are suppressed. This is annoying behavior since this template
// has no control over what class it is used with. To get around it, we have to
// suppress all deprecation warnings here.
#ifdef VTKM_MSVC
VTKM_DEPRECATED_SUPPRESS_BEGIN
#endif
// If you get a compile error here, it means you tried to use an object that
// is not an array handle as an argument that is expected to be one.
VTKM_IS_ARRAY_HANDLE(ContObjectType);
@ -64,6 +73,10 @@ struct Transport<vtkm::cont::arg::TransportTagWholeArrayInOut, ContObjectType, D
return ExecObjectType(array, token);
}
#ifdef VTKM_MSVC
VTKM_DEPRECATED_SUPPRESS_END
#endif
};
}
}

@ -42,6 +42,15 @@ struct TransportTagWholeArrayOut
template <typename ContObjectType, typename Device>
struct Transport<vtkm::cont::arg::TransportTagWholeArrayOut, ContObjectType, Device>
{
// MSVC will issue deprecation warnings here if this template is instantiated with
// a deprecated class even if the template is used from a section of code where
// deprecation warnings are suppressed. This is annoying behavior since this template
// has no control over what class it is used with. To get around it, we have to
// suppress all deprecation warnings here.
#ifdef VTKM_MSVC
VTKM_DEPRECATED_SUPPRESS_BEGIN
#endif
// If you get a compile error here, it means you tried to use an object that
// is not an array handle as an argument that is expected to be one.
VTKM_IS_ARRAY_HANDLE(ContObjectType);
@ -64,6 +73,10 @@ struct Transport<vtkm::cont::arg::TransportTagWholeArrayOut, ContObjectType, Dev
return ExecObjectType(array, array.GetNumberOfValues(), token);
}
#ifdef VTKM_MSVC
VTKM_DEPRECATED_SUPPRESS_END
#endif
};
}
}