1 | //===----------------------------------------------------------------------===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS |
10 | |
11 | // <system_error> |
12 | |
13 | // enum errc {...} |
14 | |
15 | #include <cerrno> |
16 | #include <system_error> |
17 | |
18 | #include "test_macros.h" |
19 | |
20 | int main(int, char**) |
21 | { |
22 | static_assert(static_cast<int>(std::errc::address_family_not_supported) == EAFNOSUPPORT, "" ); |
23 | static_assert(static_cast<int>(std::errc::address_in_use) == EADDRINUSE, "" ); |
24 | static_assert(static_cast<int>(std::errc::address_not_available) == EADDRNOTAVAIL, "" ); |
25 | static_assert(static_cast<int>(std::errc::already_connected) == EISCONN, "" ); |
26 | static_assert(static_cast<int>(std::errc::argument_list_too_long) == E2BIG, "" ); |
27 | static_assert(static_cast<int>(std::errc::argument_out_of_domain) == EDOM, "" ); |
28 | static_assert(static_cast<int>(std::errc::bad_address) == EFAULT, "" ); |
29 | static_assert(static_cast<int>(std::errc::bad_file_descriptor) == EBADF, "" ); |
30 | static_assert(static_cast<int>(std::errc::bad_message) == EBADMSG, "" ); |
31 | static_assert(static_cast<int>(std::errc::broken_pipe) == EPIPE, "" ); |
32 | static_assert(static_cast<int>(std::errc::connection_aborted) == ECONNABORTED, "" ); |
33 | static_assert(static_cast<int>(std::errc::connection_already_in_progress) == EALREADY, "" ); |
34 | static_assert(static_cast<int>(std::errc::connection_refused) == ECONNREFUSED, "" ); |
35 | static_assert(static_cast<int>(std::errc::connection_reset) == ECONNRESET, "" ); |
36 | static_assert(static_cast<int>(std::errc::cross_device_link) == EXDEV, "" ); |
37 | static_assert(static_cast<int>(std::errc::destination_address_required) == EDESTADDRREQ, "" ); |
38 | static_assert(static_cast<int>(std::errc::device_or_resource_busy) == EBUSY, "" ); |
39 | static_assert(static_cast<int>(std::errc::directory_not_empty) == ENOTEMPTY, "" ); |
40 | static_assert(static_cast<int>(std::errc::executable_format_error) == ENOEXEC, "" ); |
41 | static_assert(static_cast<int>(std::errc::file_exists) == EEXIST, "" ); |
42 | static_assert(static_cast<int>(std::errc::file_too_large) == EFBIG, "" ); |
43 | static_assert(static_cast<int>(std::errc::filename_too_long) == ENAMETOOLONG, "" ); |
44 | static_assert(static_cast<int>(std::errc::function_not_supported) == ENOSYS, "" ); |
45 | static_assert(static_cast<int>(std::errc::host_unreachable) == EHOSTUNREACH, "" ); |
46 | static_assert(static_cast<int>(std::errc::identifier_removed) == EIDRM, "" ); |
47 | static_assert(static_cast<int>(std::errc::illegal_byte_sequence) == EILSEQ, "" ); |
48 | static_assert(static_cast<int>(std::errc::inappropriate_io_control_operation) == ENOTTY, "" ); |
49 | static_assert(static_cast<int>(std::errc::interrupted) == EINTR, "" ); |
50 | static_assert(static_cast<int>(std::errc::invalid_argument) == EINVAL, "" ); |
51 | static_assert(static_cast<int>(std::errc::invalid_seek) == ESPIPE, "" ); |
52 | static_assert(static_cast<int>(std::errc::io_error) == EIO, "" ); |
53 | static_assert(static_cast<int>(std::errc::is_a_directory) == EISDIR, "" ); |
54 | static_assert(static_cast<int>(std::errc::message_size) == EMSGSIZE, "" ); |
55 | static_assert(static_cast<int>(std::errc::network_down) == ENETDOWN, "" ); |
56 | static_assert(static_cast<int>(std::errc::network_reset) == ENETRESET, "" ); |
57 | static_assert(static_cast<int>(std::errc::network_unreachable) == ENETUNREACH, "" ); |
58 | static_assert(static_cast<int>(std::errc::no_buffer_space) == ENOBUFS, "" ); |
59 | static_assert(static_cast<int>(std::errc::no_child_process) == ECHILD, "" ); |
60 | static_assert(static_cast<int>(std::errc::no_link) == ENOLINK, "" ); |
61 | static_assert(static_cast<int>(std::errc::no_lock_available) == ENOLCK, "" ); |
62 | #if (defined(_XOPEN_STREAMS) && _XOPEN_STREAMS != -1) |
63 | static_assert(static_cast<int>(std::errc::no_message_available) == ENODATA, "" ); |
64 | #endif |
65 | static_assert(static_cast<int>(std::errc::no_message) == ENOMSG, "" ); |
66 | static_assert(static_cast<int>(std::errc::no_protocol_option) == ENOPROTOOPT, "" ); |
67 | static_assert(static_cast<int>(std::errc::no_space_on_device) == ENOSPC, "" ); |
68 | #if (defined(_XOPEN_STREAMS) && _XOPEN_STREAMS != -1) |
69 | static_assert(static_cast<int>(std::errc::no_stream_resources) == ENOSR, "" ); |
70 | #endif |
71 | static_assert(static_cast<int>(std::errc::no_such_device_or_address) == ENXIO, "" ); |
72 | static_assert(static_cast<int>(std::errc::no_such_device) == ENODEV, "" ); |
73 | static_assert(static_cast<int>(std::errc::no_such_file_or_directory) == ENOENT, "" ); |
74 | static_assert(static_cast<int>(std::errc::no_such_process) == ESRCH, "" ); |
75 | static_assert(static_cast<int>(std::errc::not_a_directory) == ENOTDIR, "" ); |
76 | static_assert(static_cast<int>(std::errc::not_a_socket) == ENOTSOCK, "" ); |
77 | #if (defined(_XOPEN_STREAMS) && _XOPEN_STREAMS != -1) |
78 | static_assert(static_cast<int>(std::errc::not_a_stream) == ENOSTR, "" ); |
79 | #endif |
80 | static_assert(static_cast<int>(std::errc::not_connected) == ENOTCONN, "" ); |
81 | static_assert(static_cast<int>(std::errc::not_enough_memory) == ENOMEM, "" ); |
82 | static_assert(static_cast<int>(std::errc::not_supported) == ENOTSUP, "" ); |
83 | static_assert(static_cast<int>(std::errc::operation_canceled) == ECANCELED, "" ); |
84 | static_assert(static_cast<int>(std::errc::operation_in_progress) == EINPROGRESS, "" ); |
85 | static_assert(static_cast<int>(std::errc::operation_not_permitted) == EPERM, "" ); |
86 | static_assert(static_cast<int>(std::errc::operation_not_supported) == EOPNOTSUPP, "" ); |
87 | static_assert(static_cast<int>(std::errc::operation_would_block) == EWOULDBLOCK, "" ); |
88 | static_assert(static_cast<int>(std::errc::owner_dead) == EOWNERDEAD, "" ); |
89 | static_assert(static_cast<int>(std::errc::permission_denied) == EACCES, "" ); |
90 | static_assert(static_cast<int>(std::errc::protocol_error) == EPROTO, "" ); |
91 | static_assert(static_cast<int>(std::errc::protocol_not_supported) == EPROTONOSUPPORT, "" ); |
92 | static_assert(static_cast<int>(std::errc::read_only_file_system) == EROFS, "" ); |
93 | static_assert(static_cast<int>(std::errc::resource_deadlock_would_occur) == EDEADLK, "" ); |
94 | static_assert(static_cast<int>(std::errc::resource_unavailable_try_again) == EAGAIN, "" ); |
95 | static_assert(static_cast<int>(std::errc::result_out_of_range) == ERANGE, "" ); |
96 | static_assert(static_cast<int>(std::errc::state_not_recoverable) == ENOTRECOVERABLE, "" ); |
97 | #if (defined(_XOPEN_STREAMS) && _XOPEN_STREAMS != -1) |
98 | static_assert(static_cast<int>(std::errc::stream_timeout) == ETIME, "" ); |
99 | #endif |
100 | static_assert(static_cast<int>(std::errc::text_file_busy) == ETXTBSY, "" ); |
101 | static_assert(static_cast<int>(std::errc::timed_out) == ETIMEDOUT, "" ); |
102 | static_assert(static_cast<int>(std::errc::too_many_files_open_in_system) == ENFILE, "" ); |
103 | static_assert(static_cast<int>(std::errc::too_many_files_open) == EMFILE, "" ); |
104 | static_assert(static_cast<int>(std::errc::too_many_links) == EMLINK, "" ); |
105 | static_assert(static_cast<int>(std::errc::too_many_symbolic_link_levels) == ELOOP, "" ); |
106 | static_assert(static_cast<int>(std::errc::value_too_large) == EOVERFLOW, "" ); |
107 | static_assert(static_cast<int>(std::errc::wrong_protocol_type) == EPROTOTYPE, "" ); |
108 | |
109 | return 0; |
110 | } |
111 | |