| 1100 | #ifdef GHC_EXPAND_IMPL |
| 1101 | |
| 1102 | GHC_INLINE std::error_code make_error_code(portable_error err) |
| 1103 | { |
| 1104 | #ifdef GHC_OS_WINDOWS |
| 1105 | switch (err) { |
| 1106 | case portable_error::none: |
| 1107 | return std::error_code(); |
| 1108 | case portable_error::exists: |
| 1109 | return std::error_code(ERROR_ALREADY_EXISTS, std::system_category()); |
| 1110 | case portable_error::not_found: |
| 1111 | return std::error_code(ERROR_PATH_NOT_FOUND, std::system_category()); |
| 1112 | case portable_error::not_supported: |
| 1113 | return std::error_code(ERROR_NOT_SUPPORTED, std::system_category()); |
| 1114 | case portable_error::not_implemented: |
| 1115 | return std::error_code(ERROR_CALL_NOT_IMPLEMENTED, std::system_category()); |
| 1116 | case portable_error::invalid_argument: |
| 1117 | return std::error_code(ERROR_INVALID_PARAMETER, std::system_category()); |
| 1118 | case portable_error::is_a_directory: |
| 1119 | #ifdef ERROR_DIRECTORY_NOT_SUPPORTED |
| 1120 | return std::error_code(ERROR_DIRECTORY_NOT_SUPPORTED, std::system_category()); |
| 1121 | #else |
| 1122 | return std::error_code(ERROR_NOT_SUPPORTED, std::system_category()); |
| 1123 | #endif |
| 1124 | } |
| 1125 | #else |
| 1126 | switch (err) { |
| 1127 | case portable_error::none: |
| 1128 | return std::error_code(); |
| 1129 | case portable_error::exists: |
| 1130 | return std::error_code(EEXIST, std::system_category()); |
| 1131 | case portable_error::not_found: |
| 1132 | return std::error_code(ENOENT, std::system_category()); |
| 1133 | case portable_error::not_supported: |
| 1134 | return std::error_code(ENOTSUP, std::system_category()); |
| 1135 | case portable_error::not_implemented: |
| 1136 | return std::error_code(ENOSYS, std::system_category()); |
| 1137 | case portable_error::invalid_argument: |
| 1138 | return std::error_code(EINVAL, std::system_category()); |
| 1139 | case portable_error::is_a_directory: |
| 1140 | return std::error_code(EISDIR, std::system_category()); |
| 1141 | } |
| 1142 | #endif |
| 1143 | return std::error_code(); |
| 1144 | } |
| 1145 | |
| 1146 | #ifdef GHC_OS_WINDOWS |
| 1147 | GHC_INLINE std::error_code make_system_error(uint32_t err) |