Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport to 2.8: Deprecate thrust universal iterator categories (#3461) #3471

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions thrust/thrust/iterator/detail/universal_categories.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
#endif // no system header
#include <thrust/iterator/iterator_categories.h>

// XXX eliminate this file

_CCCL_SUPPRESS_DEPRECATED_PUSH
THRUST_NAMESPACE_BEGIN

// define these types without inheritance to avoid ambiguous conversion to base classes

struct input_universal_iterator_tag
// deprecated [Since 2.8]
struct CCCL_DEPRECATED input_universal_iterator_tag
{
operator input_host_iterator_tag()
{
Expand All @@ -46,7 +46,8 @@ struct input_universal_iterator_tag
}
};

struct output_universal_iterator_tag
// deprecated [Since 2.8]
struct CCCL_DEPRECATED output_universal_iterator_tag
{
operator output_host_iterator_tag()
{
Expand All @@ -59,7 +60,8 @@ struct output_universal_iterator_tag
}
};

struct forward_universal_iterator_tag : input_universal_iterator_tag
// deprecated [Since 2.8]
struct CCCL_DEPRECATED forward_universal_iterator_tag : input_universal_iterator_tag
{
operator forward_host_iterator_tag()
{
Expand All @@ -72,7 +74,8 @@ struct forward_universal_iterator_tag : input_universal_iterator_tag
};
};

struct bidirectional_universal_iterator_tag : forward_universal_iterator_tag
// deprecated [Since 2.8]
struct CCCL_DEPRECATED bidirectional_universal_iterator_tag : forward_universal_iterator_tag
{
operator bidirectional_host_iterator_tag()
{
Expand All @@ -95,7 +98,8 @@ struct one_degree_of_separation : T

} // namespace detail

struct random_access_universal_iterator_tag
// deprecated [Since 2.8]
struct CCCL_DEPRECATED random_access_universal_iterator_tag
{
// these conversions are all P0
operator random_access_host_iterator_tag()
Expand All @@ -115,4 +119,5 @@ struct random_access_universal_iterator_tag
}
};

_CCCL_SUPPRESS_DEPRECATED_POP
THRUST_NAMESPACE_END
Comment on lines +122 to 123
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be after the end of the namespace

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I talked to @dkolsen-pgi about how pragmas work and they are always attached to the entity following the pragma. So by putting _CCCL_SUPPRESS_DEPRECATED_POP before the namespace end, I believe the pragma pop is attached to the closing of the namespace. If I would put it afterwards, then the pragma pop is attached to whatever entity happens to end up afterwards from any other header or source file.

The compiler later reconstructs the range between pragma push and pop by searching the AST, and this is sometimes buggy. I observed less bugs by putting the pragma pop before the namespace end. This is why I do it this way.

Loading