[libcxx-commits] [libcxx] [libcxx] Handle windows system error code mapping in std::error_code. (PR #93101)

James Y Knight via libcxx-commits libcxx-commits at lists.llvm.org
Fri Sep 13 15:07:24 PDT 2024


================
@@ -23,8 +24,80 @@
 #  include <android/api-level.h>
 #endif
 
+#if defined(_LIBCPP_WIN32API)
+#  include <windows.h>
+#  include <winerror.h>
+#endif
+
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+#if defined(_LIBCPP_WIN32API)
+
+namespace {
+std::optional<errc> __win_err_to_errc(int err) {
----------------
jyknight wrote:

This code was moved, not added; I don't know why the original author wrote it this way initially.

I don't see why it _shouldn't_ be a switch, though, so I've changed it.

https://github.com/llvm/llvm-project/pull/93101


More information about the libcxx-commits mailing list