@@ -58,18 +58,18 @@ enum class errc
58
58
no_child_process, // ECHILD
59
59
no_link, // ENOLINK
60
60
no_lock_available, // ENOLCK
61
- no_message_available, // ENODATA
61
+ no_message_available, // ENODATA // deprecated
62
62
no_message, // ENOMSG
63
63
no_protocol_option, // ENOPROTOOPT
64
64
no_space_on_device, // ENOSPC
65
- no_stream_resources, // ENOSR
65
+ no_stream_resources, // ENOSR // deprecated
66
66
no_such_device_or_address, // ENXIO
67
67
no_such_device, // ENODEV
68
68
no_such_file_or_directory, // ENOENT
69
69
no_such_process, // ESRCH
70
70
not_a_directory, // ENOTDIR
71
71
not_a_socket, // ENOTSOCK
72
- not_a_stream, // ENOSTR
72
+ not_a_stream, // ENOSTR // deprecated
73
73
not_connected, // ENOTCONN
74
74
not_enough_memory, // ENOMEM
75
75
not_supported, // ENOTSUP
@@ -87,7 +87,7 @@ enum class errc
87
87
resource_unavailable_try_again, // EAGAIN
88
88
result_out_of_range, // ERANGE
89
89
state_not_recoverable, // ENOTRECOVERABLE
90
- stream_timeout, // ETIME
90
+ stream_timeout, // ETIME // deprecated
91
91
text_file_busy, // ETXTBSY
92
92
timed_out, // ETIMEDOUT
93
93
too_many_files_open_in_system, // ENFILE
@@ -113,6 +113,15 @@ _LIBCPP_BEGIN_NAMESPACE_STD
113
113
// for them:
114
114
115
115
// enum class errc
116
+ //
117
+ // LWG3869 deprecates the UNIX STREAMS macros and enum values.
118
+ // This makes the code clumbersome:
119
+ // - the enum value is deprecated and should show a diagnostic,
120
+ // - the macro is deprecated and should _not_ show a diagnostic in this
121
+ // context, and
122
+ // - the macro is not always available.
123
+ // This leads to the odd pushing and popping of the deprecated
124
+ // diagnostic.
116
125
_LIBCPP_DECLARE_STRONG_ENUM (errc){
117
126
address_family_not_supported = EAFNOSUPPORT,
118
127
address_in_use = EADDRINUSE,
@@ -154,30 +163,48 @@ _LIBCPP_DECLARE_STRONG_ENUM(errc){
154
163
no_child_process = ECHILD,
155
164
no_link = ENOLINK,
156
165
no_lock_available = ENOLCK,
166
+ // clang-format off
167
+ no_message_available _LIBCPP_DEPRECATED =
168
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
157
169
#ifdef ENODATA
158
- no_message_available = ENODATA,
170
+ ENODATA
159
171
#else
160
- no_message_available = ENOMSG,
172
+ ENOMSG
161
173
#endif
174
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
175
+ ,
176
+ // clang-format on
162
177
no_message = ENOMSG,
163
178
no_protocol_option = ENOPROTOOPT,
164
179
no_space_on_device = ENOSPC,
180
+ // clang-format off
181
+ no_stream_resources _LIBCPP_DEPRECATED =
182
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
165
183
#ifdef ENOSR
166
- no_stream_resources = ENOSR,
184
+ ENOSR
167
185
#else
168
- no_stream_resources = ENOMEM,
186
+ ENOMEM
169
187
#endif
188
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
189
+ ,
190
+ // clang-format on
170
191
no_such_device_or_address = ENXIO,
171
192
no_such_device = ENODEV,
172
193
no_such_file_or_directory = ENOENT,
173
194
no_such_process = ESRCH,
174
195
not_a_directory = ENOTDIR,
175
196
not_a_socket = ENOTSOCK,
197
+ // clang-format off
198
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
199
+ not_a_stream _LIBCPP_DEPRECATED =
176
200
#ifdef ENOSTR
177
- not_a_stream = ENOSTR,
201
+ ENOSTR
178
202
#else
179
- not_a_stream = EINVAL,
203
+ EINVAL
180
204
#endif
205
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
206
+ ,
207
+ // clang-format on
181
208
not_connected = ENOTCONN,
182
209
not_enough_memory = ENOMEM,
183
210
not_supported = ENOTSUP,
@@ -195,11 +222,17 @@ _LIBCPP_DECLARE_STRONG_ENUM(errc){
195
222
resource_unavailable_try_again = EAGAIN,
196
223
result_out_of_range = ERANGE,
197
224
state_not_recoverable = ENOTRECOVERABLE,
225
+ // clang-format off
226
+ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
227
+ stream_timeout _LIBCPP_DEPRECATED =
198
228
#ifdef ETIME
199
- stream_timeout = ETIME,
229
+ ETIME
200
230
#else
201
- stream_timeout = ETIMEDOUT,
231
+ ETIMEDOUT
202
232
#endif
233
+ _LIBCPP_SUPPRESS_DEPRECATED_POP
234
+ ,
235
+ // clang-format on
203
236
text_file_busy = ETXTBSY,
204
237
timed_out = ETIMEDOUT,
205
238
too_many_files_open_in_system = ENFILE,
0 commit comments