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

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Aug 5 11:48:19 PDT 2024


================
@@ -156,19 +229,52 @@ class _LIBCPP_HIDDEN __system_error_category : public __do_message {
 const char* __system_error_category::name() const noexcept { return "system"; }
 
 string __system_error_category::message(int ev) const {
-#ifdef _LIBCPP_ELAST
+#ifdef _LIBCPP_WIN32API
+  std::string result;
+  char* str               = nullptr;
+  unsigned long num_chars = FormatMessageA(
----------------
ldionne wrote:

```suggestion
  unsigned long num_chars = ::FormatMessageA(
```

That makes it clearer that we're calling a Windows system function.

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


More information about the libcxx-commits mailing list