Commit c57f5d98 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcp110: Add _Throw_C_error implementation.

parent d87d101a
......@@ -1778,7 +1778,7 @@
@ extern ?_Sync@ios_base@std@@0_NA ios_base_Sync
@ cdecl -arch=win32 ?_Syserror_map@std@@YAPBDH@Z(long) _Syserror_map
@ cdecl -arch=win64 ?_Syserror_map@std@@YAPEBDH@Z(long) _Syserror_map
@ stub ?_Throw_C_error@std@@YAXH@Z
@ cdecl ?_Throw_C_error@std@@YAXH@Z(long) _Throw_C_error
@ stub ?_Throw_Cpp_error@std@@YAXH@Z
@ cdecl -arch=win32 ?_Throw_future_error@std@@YAXABVerror_code@1@@Z(ptr) _Throw_future_error
@ cdecl -arch=win64 ?_Throw_future_error@std@@YAXAEBVerror_code@1@@Z(ptr) _Throw_future_error
......
......@@ -1739,7 +1739,7 @@
@ extern ?_Sync@ios_base@std@@0_NA ios_base_Sync
@ cdecl -arch=win32 ?_Syserror_map@std@@YAPBDH@Z(long) _Syserror_map
@ cdecl -arch=win64 ?_Syserror_map@std@@YAPEBDH@Z(long) _Syserror_map
@ stub ?_Throw_C_error@std@@YAXH@Z
@ cdecl ?_Throw_C_error@std@@YAXH@Z(long) _Throw_C_error
@ stub ?_Throw_Cpp_error@std@@YAXH@Z
@ cdecl -arch=win32 ?_Throw_future_error@std@@YAXABVerror_code@1@@Z(ptr) _Throw_future_error
@ cdecl -arch=win64 ?_Throw_future_error@std@@YAXAEBVerror_code@1@@Z(ptr) _Throw_future_error
......
......@@ -1739,7 +1739,7 @@
@ extern ?_Sync@ios_base@std@@0_NA msvcp120.?_Sync@ios_base@std@@0_NA
@ cdecl -arch=win32 ?_Syserror_map@std@@YAPBDH@Z(long) msvcp120.?_Syserror_map@std@@YAPBDH@Z
@ cdecl -arch=win64 ?_Syserror_map@std@@YAPEBDH@Z(long) msvcp120.?_Syserror_map@std@@YAPEBDH@Z
@ stub ?_Throw_C_error@std@@YAXH@Z
@ cdecl ?_Throw_C_error@std@@YAXH@Z(long) msvcp120.?_Throw_C_error@std@@YAXH@Z
@ stub ?_Throw_Cpp_error@std@@YAXH@Z
@ cdecl -arch=win32 ?_Throw_future_error@std@@YAXABVerror_code@1@@Z(ptr) msvcp120.?_Throw_future_error@std@@YAXABVerror_code@1@@Z
@ cdecl -arch=win64 ?_Throw_future_error@std@@YAXAEBVerror_code@1@@Z(ptr) msvcp120.?_Throw_future_error@std@@YAXAEBVerror_code@1@@Z
......
......@@ -1623,7 +1623,7 @@
@ extern ?_Sync@ios_base@std@@0_NA ios_base_Sync
@ cdecl -arch=win32 ?_Syserror_map@std@@YAPBDH@Z(long) _Syserror_map
@ cdecl -arch=win64 ?_Syserror_map@std@@YAPEBDH@Z(long) _Syserror_map
@ stub ?_Throw_C_error@std@@YAXH@Z
@ cdecl ?_Throw_C_error@std@@YAXH@Z(long) _Throw_C_error
@ stub ?_Throw_Cpp_error@std@@YAXH@Z
@ cdecl -arch=win32 ?_Throw_future_error@std@@YAXABVerror_code@1@@Z(ptr) _Throw_future_error
@ cdecl -arch=win64 ?_Throw_future_error@std@@YAXAEBVerror_code@1@@Z(ptr) _Throw_future_error
......
......@@ -16,6 +16,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <errno.h>
#include <stdarg.h>
#include "msvcp90.h"
......@@ -722,7 +723,9 @@ DEFINE_RTTI_DATA4(failure, 0, &system_error_rtti_base_descriptor,
&_System_error_rtti_base_descriptor, &runtime_error_rtti_base_descriptor,
&exception_rtti_base_descriptor, ".?AVfailure@ios_base@std@@")
DEFINE_CXX_TYPE_INFO(_System_error)
DEFINE_CXX_TYPE_INFO(system_error);
DEFINE_CXX_DATA3(system_error, &_System_error_cxx_type_info,
&runtime_error_cxx_type_info, &exception_cxx_type_info,
MSVCP_runtime_error_dtor)
DEFINE_CXX_DATA4(failure, &system_error_cxx_type_info,
&_System_error_cxx_type_info, &runtime_error_cxx_type_info,
&exception_cxx_type_info, MSVCP_runtime_error_dtor)
......@@ -732,7 +735,12 @@ DEFINE_RTTI_DATA2(system_error, 0, &runtime_error_rtti_base_descriptor,
DEFINE_RTTI_DATA3(failure, 0, &system_error_rtti_base_descriptor,
&runtime_error_rtti_base_descriptor, &exception_rtti_base_descriptor,
".?AVfailure@ios_base@std@@")
#if _MSVCP_VER == 100
DEFINE_CXX_TYPE_INFO(system_error);
#else
DEFINE_CXX_DATA2(system_error, &runtime_error_cxx_type_info,
&exception_cxx_type_info, MSVCP_runtime_error_dtor)
#endif
DEFINE_CXX_DATA3(failure, &system_error_cxx_type_info, &runtime_error_cxx_type_info,
&exception_cxx_type_info, MSVCP_runtime_error_dtor)
#else
......@@ -1033,6 +1041,44 @@ void __cdecl _Rethrow_future_exception(const exception_ptr ep)
{
exception_ptr_rethrow(&ep);
}
/* ?_Throw_C_error@std@@YAXH@Z */
void __cdecl _Throw_C_error(int code)
{
system_error se;
const char *msg;
errno_t err;
TRACE("(%d)\n", code);
switch(code)
{
case 1:
case 2:
err = EAGAIN;
break;
case 3:
err = EBUSY;
break;
case 4:
err = EINVAL;
break;
default:
#if _MSVCP_VER >= 140
abort();
#else
return;
#endif
}
msg = strerror(err);
MSVCP_runtime_error_ctor(&se.base, &msg);
se.code.code = err;
se.code.category = std_generic_category();
se.base.e.vtable = &system_error_vtable;
_CxxThrowException(&se, &system_error_cxx_type);
}
#endif
#if _MSVCP_VER >= 140
......@@ -1509,8 +1555,10 @@ void init_exception(void *base)
#if _MSVCP_VER > 110
init__System_error_cxx_type_info(base);
#endif
#if _MSVCP_VER > 90
#if _MSVCP_VER == 100
init_system_error_cxx_type_info(base);
#elif _MSVCP_VER > 100
init_system_error_cxx(base);
#endif
init_failure_cxx(base);
init_range_error_cxx(base);
......
......@@ -1110,13 +1110,6 @@ const char* __thiscall custom_category_name(const custom_category *this)
return this->type;
}
DEFINE_THISCALL_WRAPPER(custom_category_message, 12)
basic_string_char* __thiscall custom_category_message(const custom_category *this,
basic_string_char *ret, int err)
{
return MSVCP_basic_string_char_ctor_cstr(ret, strerror(err));
}
/* ?system_category@std@@YAABVerror_category@1@XZ */
/* ?system_category@std@@YAAEBVerror_category@1@XZ */
const error_category* __cdecl std_system_category(void)
......@@ -1124,7 +1117,9 @@ const error_category* __cdecl std_system_category(void)
TRACE("()\n");
return &system_category.base;
}
#endif
#if _MSVCP_VER >= 100
static custom_category generic_category;
extern const vtable_ptr generic_category_vtable;
......@@ -1132,7 +1127,26 @@ extern const vtable_ptr generic_category_vtable;
static void generic_category_ctor(custom_category *this)
{
this->base.vtable = &generic_category_vtable;
#if _MSVCP_VER == 100
this->type = "generic";
#endif
}
DEFINE_THISCALL_WRAPPER(generic_category_name, 4)
const char* __thiscall generic_category_name(const custom_category *this)
{
#if _MSVCP_VER == 100
return this->type;
#else
return "generic";
#endif
}
DEFINE_THISCALL_WRAPPER(custom_category_message, 12)
basic_string_char* __thiscall custom_category_message(const custom_category *this,
basic_string_char *ret, int err)
{
return MSVCP_basic_string_char_ctor_cstr(ret, strerror(err));
}
/* ?generic_category@std@@YAABVerror_category@1@XZ */
......@@ -1716,14 +1730,14 @@ __ASM_BLOCK_BEGIN(misc_vtables)
VTABLE_ADD_FUNC(custom_category_default_error_condition)
VTABLE_ADD_FUNC(custom_category_equivalent)
VTABLE_ADD_FUNC(custom_category_equivalent_code));
#endif
__ASM_VTABLE(generic_category,
VTABLE_ADD_FUNC(custom_category_vector_dtor)
VTABLE_ADD_FUNC(custom_category_name)
VTABLE_ADD_FUNC(generic_category_name)
VTABLE_ADD_FUNC(custom_category_message)
VTABLE_ADD_FUNC(custom_category_default_error_condition)
VTABLE_ADD_FUNC(custom_category_equivalent)
VTABLE_ADD_FUNC(custom_category_equivalent_code));
#endif
#if _MSVCP_VER >= 110
__ASM_VTABLE(_Pad,
VTABLE_ADD_FUNC(_Pad__Go));
......@@ -1748,11 +1762,11 @@ void init_misc(void *base)
#if _MSVCP_VER >= 100
iostream_category_ctor(&iostream_category);
generic_category_ctor(&generic_category);
#endif
#if _MSVCP_VER == 100
system_category_ctor(&system_category);
generic_category_ctor(&generic_category);
#endif
}
......
......@@ -674,6 +674,7 @@ typedef struct {
} error_category;
const error_category* __cdecl std_iostream_category(void);
const error_category* __cdecl std_generic_category(void);
typedef struct
{
......
......@@ -1623,7 +1623,7 @@
@ extern ?_Sync@ios_base@std@@0_NA msvcp140.?_Sync@ios_base@std@@0_NA
@ cdecl -arch=win32 ?_Syserror_map@std@@YAPBDH@Z(long) msvcp140.?_Syserror_map@std@@YAPBDH@Z
@ cdecl -arch=win64 ?_Syserror_map@std@@YAPEBDH@Z(long) msvcp140.?_Syserror_map@std@@YAPEBDH@Z
@ stub ?_Throw_C_error@std@@YAXH@Z
@ cdecl ?_Throw_C_error@std@@YAXH@Z(long) msvcp140.?_Throw_C_error@std@@YAXH@Z
@ stub ?_Throw_Cpp_error@std@@YAXH@Z
@ cdecl -arch=win32 ?_Throw_future_error@std@@YAXABVerror_code@1@@Z(ptr) msvcp140.?_Throw_future_error@std@@YAXABVerror_code@1@@Z
@ cdecl -arch=win64 ?_Throw_future_error@std@@YAXAEBVerror_code@1@@Z(ptr) msvcp140.?_Throw_future_error@std@@YAXAEBVerror_code@1@@Z
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment