msvcp90: Use throw_exception helper to throw exception object only.
Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
d7e9190032
commit
731dca90c7
|
@ -314,14 +314,6 @@ typedef struct __exception
|
||||||
int do_free; /* Whether to free 'name' in our dtor */
|
int do_free; /* Whether to free 'name' in our dtor */
|
||||||
} exception;
|
} exception;
|
||||||
|
|
||||||
/* Internal: throws selected exception */
|
|
||||||
typedef enum __exception_type {
|
|
||||||
EXCEPTION,
|
|
||||||
EXCEPTION_BAD_CAST,
|
|
||||||
EXCEPTION_LOGIC_ERROR,
|
|
||||||
} exception_type;
|
|
||||||
void throw_exception(exception_type, const char *);
|
|
||||||
|
|
||||||
/* rtti */
|
/* rtti */
|
||||||
typedef struct __type_info
|
typedef struct __type_info
|
||||||
{
|
{
|
||||||
|
|
|
@ -399,7 +399,7 @@ DEFINE_RTTI_DATA1(logic_error, 0, &exception_rtti_base_descriptor, ".?AVlogic_er
|
||||||
#else
|
#else
|
||||||
DEFINE_RTTI_DATA1(logic_error, 0, &exception_rtti_base_descriptor, ".?AVlogic_error@@")
|
DEFINE_RTTI_DATA1(logic_error, 0, &exception_rtti_base_descriptor, ".?AVlogic_error@@")
|
||||||
#endif
|
#endif
|
||||||
DEFINE_CXX_DATA1(logic_error, &exception_cxx_type_info, MSVCP_logic_error_dtor)
|
DEFINE_CXX_TYPE_INFO(logic_error)
|
||||||
|
|
||||||
/* length_error class data */
|
/* length_error class data */
|
||||||
typedef logic_error length_error;
|
typedef logic_error length_error;
|
||||||
|
@ -817,7 +817,6 @@ bad_cast* __thiscall MSVCP_bad_cast_opequals(bad_cast *this, const bad_cast *rhs
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_RTTI_DATA1(bad_cast, 0, &exception_rtti_base_descriptor, ".?AVbad_cast@std@@")
|
DEFINE_RTTI_DATA1(bad_cast, 0, &exception_rtti_base_descriptor, ".?AVbad_cast@std@@")
|
||||||
DEFINE_CXX_DATA1(bad_cast, &exception_cxx_type_info, MSVCP_bad_cast_dtor)
|
|
||||||
|
|
||||||
/* range_error class data */
|
/* range_error class data */
|
||||||
typedef runtime_error range_error;
|
typedef runtime_error range_error;
|
||||||
|
@ -1065,28 +1064,14 @@ __ASM_BLOCK_BEGIN(exception_vtables)
|
||||||
VTABLE_ADD_FUNC(MSVCP_runtime_error_what));
|
VTABLE_ADD_FUNC(MSVCP_runtime_error_what));
|
||||||
__ASM_BLOCK_END
|
__ASM_BLOCK_END
|
||||||
|
|
||||||
/* Internal: throws selected exception */
|
/* Internal: throws exception */
|
||||||
void throw_exception(exception_type et, const char *str)
|
void DECLSPEC_NORETURN throw_exception(const char *str)
|
||||||
{
|
{
|
||||||
exception_name name = EXCEPTION_NAME(str);
|
exception_name name = EXCEPTION_NAME(str);
|
||||||
|
|
||||||
switch(et) {
|
|
||||||
case EXCEPTION: {
|
|
||||||
exception e;
|
exception e;
|
||||||
|
|
||||||
MSVCP_exception_ctor(&e, name);
|
MSVCP_exception_ctor(&e, name);
|
||||||
_CxxThrowException(&e, &exception_cxx_type);
|
_CxxThrowException(&e, &exception_cxx_type);
|
||||||
}
|
|
||||||
case EXCEPTION_BAD_CAST: {
|
|
||||||
bad_cast e;
|
|
||||||
MSVCP_bad_cast_ctor(&e, str);
|
|
||||||
_CxxThrowException(&e, &bad_cast_cxx_type);
|
|
||||||
}
|
|
||||||
case EXCEPTION_LOGIC_ERROR: {
|
|
||||||
logic_error e;
|
|
||||||
MSVCP_logic_error_ctor(&e, name);
|
|
||||||
_CxxThrowException(&e, &logic_error_cxx_type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Internal: throws range_error exception */
|
/* Internal: throws range_error exception */
|
||||||
|
@ -1132,7 +1117,7 @@ void init_exception(void *base)
|
||||||
|
|
||||||
init_exception_cxx(base);
|
init_exception_cxx(base);
|
||||||
init_bad_alloc_cxx(base);
|
init_bad_alloc_cxx(base);
|
||||||
init_logic_error_cxx(base);
|
init_logic_error_cxx_type_info(base);
|
||||||
init_length_error_cxx(base);
|
init_length_error_cxx(base);
|
||||||
init_out_of_range_cxx(base);
|
init_out_of_range_cxx(base);
|
||||||
init_invalid_argument_cxx(base);
|
init_invalid_argument_cxx(base);
|
||||||
|
@ -1144,7 +1129,6 @@ void init_exception(void *base)
|
||||||
init_system_error_cxx_type_info(base);
|
init_system_error_cxx_type_info(base);
|
||||||
#endif
|
#endif
|
||||||
init_failure_cxx(base);
|
init_failure_cxx(base);
|
||||||
init_bad_cast_cxx(base);
|
|
||||||
init_range_error_cxx(base);
|
init_range_error_cxx(base);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -700,7 +700,7 @@ unsigned int __cdecl _Random_device(void)
|
||||||
|
|
||||||
/* TODO: throw correct exception in case of failure */
|
/* TODO: throw correct exception in case of failure */
|
||||||
if(rand_s(&ret))
|
if(rand_s(&ret))
|
||||||
throw_exception(EXCEPTION, "random number generator failed\n");
|
throw_exception("random number generator failed\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -669,5 +669,6 @@ void __cdecl DECLSPEC_NORETURN _Xlength_error(const char*);
|
||||||
void __cdecl DECLSPEC_NORETURN _Xmem(void);
|
void __cdecl DECLSPEC_NORETURN _Xmem(void);
|
||||||
void __cdecl DECLSPEC_NORETURN _Xout_of_range(const char*);
|
void __cdecl DECLSPEC_NORETURN _Xout_of_range(const char*);
|
||||||
void __cdecl DECLSPEC_NORETURN _Xruntime_error(const char*);
|
void __cdecl DECLSPEC_NORETURN _Xruntime_error(const char*);
|
||||||
|
void DECLSPEC_NORETURN throw_exception(const char*);
|
||||||
void DECLSPEC_NORETURN throw_failure(const char*);
|
void DECLSPEC_NORETURN throw_failure(const char*);
|
||||||
void DECLSPEC_NORETURN throw_range_error(const char*);
|
void DECLSPEC_NORETURN throw_range_error(const char*);
|
||||||
|
|
Loading…
Reference in New Issue