@@ -28,20 +28,37 @@ class context;
28
28
// / \ingroup sycl_api
29
29
class __SYCL_EXPORT exception : public std::exception {
30
30
public:
31
+ __SYCL2020_DEPRECATED (" The version of an exception constructor which takes "
32
+ " no arguments is deprecated." )
31
33
exception () = default ;
32
34
33
- exception (std::error_code, const char *Msg)
34
- : exception(Msg, PI_INVALID_VALUE) {}
35
+ exception (std::error_code, const char *Msg);
35
36
36
- exception (std::error_code, const std::string &Msg)
37
- : exception(Msg, PI_INVALID_VALUE) {}
37
+ exception (std::error_code, const std::string &Msg);
38
+
39
+ // new SYCL 2020 constructors
40
+ exception (std::error_code);
41
+ exception (int , const std::error_category &, const std::string &);
42
+ exception (int , const std::error_category &, const char *);
43
+ exception (int , const std::error_category &);
44
+
45
+ exception (context, std::error_code, const std::string &);
46
+ exception (context, std::error_code, const char *);
47
+ exception (context, std::error_code);
48
+ exception (context, int , const std::error_category &, const std::string &);
49
+ exception (context, int , const std::error_category &, const char *);
50
+ exception (context, int , const std::error_category &);
51
+
52
+ const std::error_code &code () const noexcept ;
53
+ const std::error_category &category () const noexcept ;
38
54
39
55
const char *what () const noexcept final ;
40
56
41
57
bool has_context () const ;
42
58
43
59
context get_context () const ;
44
60
61
+ __SYCL2020_DEPRECATED (" use sycl::exception.code() instead." )
45
62
cl_int get_cl_code () const ;
46
63
47
64
private:
@@ -59,10 +76,18 @@ class __SYCL_EXPORT exception : public std::exception {
59
76
: MMsg(Msg + " " + detail::codeToString(CLErr)), MCLErr(CLErr),
60
77
MContext (Context) {}
61
78
62
- exception (const std::string &Msg) : MMsg(Msg), MContext(nullptr ) {}
79
+ exception (const string_class &Msg) : MMsg(Msg), MContext(nullptr ) {}
80
+
81
+ // base constructor for all SYCL 2020 constructors
82
+ // exception(context *ctxPtr, std::error_code ec, const std::string
83
+ // &what_arg);
84
+ exception (std::error_code ec, std::shared_ptr<context> SharedPtrCtx,
85
+ const std::string &what_arg);
63
86
};
64
87
65
- class runtime_error : public exception {
88
+ class __SYCL2020_DEPRECATED (
89
+ " use sycl::exception with sycl::errc::runtime instead." ) runtime_error
90
+ : public exception {
66
91
public:
67
92
runtime_error () = default ;
68
93
@@ -71,22 +96,34 @@ class runtime_error : public exception {
71
96
72
97
runtime_error (const std::string &Msg, cl_int Err) : exception (Msg, Err) {}
73
98
};
74
- class kernel_error : public runtime_error {
99
+ class __SYCL2020_DEPRECATED (" use sycl::exception with sycl::errc::kernel or "
100
+ " errc::kernel_argument instead." ) kernel_error
101
+ : public runtime_error {
75
102
using runtime_error::runtime_error;
76
103
};
77
- class accessor_error : public runtime_error {
104
+ class __SYCL2020_DEPRECATED (
105
+ " use sycl::exception with sycl::errc::accessor instead." ) accessor_error
106
+ : public runtime_error {
78
107
using runtime_error::runtime_error;
79
108
};
80
- class nd_range_error : public runtime_error {
109
+ class __SYCL2020_DEPRECATED (
110
+ " use sycl::exception with sycl::errc::nd_range instead." ) nd_range_error
111
+ : public runtime_error {
81
112
using runtime_error::runtime_error;
82
113
};
83
- class event_error : public runtime_error {
114
+ class __SYCL2020_DEPRECATED (
115
+ " use sycl::exception with sycl::errc::event instead." ) event_error
116
+ : public runtime_error {
84
117
using runtime_error::runtime_error;
85
118
};
86
- class invalid_parameter_error : public runtime_error {
119
+ class __SYCL2020_DEPRECATED (
120
+ " use sycl::exception with a sycl::errc enum value instead." )
121
+ invalid_parameter_error : public runtime_error {
87
122
using runtime_error::runtime_error;
88
123
};
89
- class device_error : public exception {
124
+ class __SYCL2020_DEPRECATED (
125
+ " use sycl::exception with a sycl::errc enum value instead." ) device_error
126
+ : public exception {
90
127
public:
91
128
device_error () = default ;
92
129
@@ -95,25 +132,39 @@ class device_error : public exception {
95
132
96
133
device_error (const std::string &Msg, cl_int Err) : exception (Msg, Err) {}
97
134
};
98
- class compile_program_error : public device_error {
135
+ class __SYCL2020_DEPRECATED (
136
+ " use sycl::exception with a sycl::errc enum value instead." )
137
+ compile_program_error : public device_error {
99
138
using device_error::device_error;
100
139
};
101
- class link_program_error : public device_error {
140
+ class __SYCL2020_DEPRECATED (
141
+ " use sycl::exception with a sycl::errc enum value instead." )
142
+ link_program_error : public device_error {
102
143
using device_error::device_error;
103
144
};
104
- class invalid_object_error : public device_error {
145
+ class __SYCL2020_DEPRECATED (
146
+ " use sycl::exception with a sycl::errc enum value instead." )
147
+ invalid_object_error : public device_error {
105
148
using device_error::device_error;
106
149
};
107
- class memory_allocation_error : public device_error {
150
+ class __SYCL2020_DEPRECATED (
151
+ " use sycl::exception with sycl::errc::memory_allocation instead." )
152
+ memory_allocation_error : public device_error {
108
153
using device_error::device_error;
109
154
};
110
- class platform_error : public device_error {
155
+ class __SYCL2020_DEPRECATED (
156
+ " use sycl::exception with sycl::errc::platform instead." ) platform_error
157
+ : public device_error {
111
158
using device_error::device_error;
112
159
};
113
- class profiling_error : public device_error {
160
+ class __SYCL2020_DEPRECATED (
161
+ " use sycl::exception with sycl::errc::profiling instead." ) profiling_error
162
+ : public device_error {
114
163
using device_error::device_error;
115
164
};
116
- class feature_not_supported : public device_error {
165
+ class __SYCL2020_DEPRECATED (
166
+ " use sycl::exception with sycl::errc::feature_not_supported instead." )
167
+ feature_not_supported : public device_error {
117
168
using device_error::device_error;
118
169
};
119
170
0 commit comments