Commit 503f3462 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcp90: Don't use throw_exception helper for out_of_range exception.

parent 73c4ae66
...@@ -487,3 +487,4 @@ typedef struct { ...@@ -487,3 +487,4 @@ typedef struct {
void WINAPI DECLSPEC_NORETURN _CxxThrowException(void*,const cxx_exception_type*); void WINAPI DECLSPEC_NORETURN _CxxThrowException(void*,const cxx_exception_type*);
void __cdecl DECLSPEC_NORETURN _Xlength_error(const char*); 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*);
...@@ -46,10 +46,8 @@ typedef struct { ...@@ -46,10 +46,8 @@ typedef struct {
/* ?_Xran@std@@YAXXZ */ /* ?_Xran@std@@YAXXZ */
void __cdecl _Xran(void) void __cdecl _Xran(void)
{ {
static const char msg[] = "invalid string position";
TRACE("\n"); TRACE("\n");
throw_exception(EXCEPTION_OUT_OF_RANGE, msg); _Xout_of_range("invalid string position");
} }
/* ?_Xlen@std@@YAXXZ */ /* ?_Xlen@std@@YAXXZ */
......
...@@ -319,7 +319,6 @@ typedef enum __exception_type { ...@@ -319,7 +319,6 @@ typedef enum __exception_type {
EXCEPTION, EXCEPTION,
EXCEPTION_BAD_CAST, EXCEPTION_BAD_CAST,
EXCEPTION_LOGIC_ERROR, EXCEPTION_LOGIC_ERROR,
EXCEPTION_OUT_OF_RANGE,
EXCEPTION_FAILURE, EXCEPTION_FAILURE,
EXCEPTION_RANGE_ERROR, EXCEPTION_RANGE_ERROR,
} exception_type; } exception_type;
......
...@@ -470,19 +470,14 @@ size_t __cdecl _vector_base_v4__Segment_index_of(size_t x) ...@@ -470,19 +470,14 @@ size_t __cdecl _vector_base_v4__Segment_index_of(size_t x)
DEFINE_THISCALL_WRAPPER(_vector_base_v4__Internal_throw_exception, 8) DEFINE_THISCALL_WRAPPER(_vector_base_v4__Internal_throw_exception, 8)
void __thiscall _vector_base_v4__Internal_throw_exception(void/*_vector_base_v4*/ *this, size_t idx) void __thiscall _vector_base_v4__Internal_throw_exception(void/*_vector_base_v4*/ *this, size_t idx)
{ {
static const struct {
exception_type type;
const char *msg;
} exceptions[] = {
{ EXCEPTION_OUT_OF_RANGE, "Index out of range" },
{ EXCEPTION_OUT_OF_RANGE, "Index out of segments table range" },
{ EXCEPTION_RANGE_ERROR, "Index is inside segment which failed to be allocated" },
};
TRACE("(%p %Iu)\n", this, idx); TRACE("(%p %Iu)\n", this, idx);
if(idx < ARRAY_SIZE(exceptions)) switch(idx) {
throw_exception(exceptions[idx].type, exceptions[idx].msg); case 0: _Xout_of_range("Index out of range");
case 1: _Xout_of_range("Index out of segments table range");
case 2: throw_exception(EXCEPTION_RANGE_ERROR,
"Index is inside segment which failed to be allocated");
}
} }
#ifdef _WIN64 #ifdef _WIN64
......
...@@ -916,10 +916,15 @@ void __cdecl DECLSPEC_NORETURN _Xlength_error(const char *str) ...@@ -916,10 +916,15 @@ void __cdecl DECLSPEC_NORETURN _Xlength_error(const char *str)
/* ?_Xout_of_range@std@@YAXPBD@Z */ /* ?_Xout_of_range@std@@YAXPBD@Z */
/* ?_Xout_of_range@std@@YAXPEBD@Z */ /* ?_Xout_of_range@std@@YAXPEBD@Z */
void __cdecl _Xout_of_range(const char *str) void __cdecl DECLSPEC_NORETURN _Xout_of_range(const char *str)
{ {
exception_name name = EXCEPTION_NAME(str);
out_of_range e;
TRACE("(%s)\n", debugstr_a(str)); TRACE("(%s)\n", debugstr_a(str));
throw_exception(EXCEPTION_OUT_OF_RANGE, str);
MSVCP_out_of_range_ctor(&e, name);
_CxxThrowException(&e, &out_of_range_cxx_type);
} }
/* ?_Xruntime_error@std@@YAXPBD@Z */ /* ?_Xruntime_error@std@@YAXPBD@Z */
...@@ -1081,11 +1086,6 @@ void throw_exception(exception_type et, const char *str) ...@@ -1081,11 +1086,6 @@ void throw_exception(exception_type et, const char *str)
MSVCP_logic_error_ctor(&e, name); MSVCP_logic_error_ctor(&e, name);
_CxxThrowException(&e, &logic_error_cxx_type); _CxxThrowException(&e, &logic_error_cxx_type);
} }
case EXCEPTION_OUT_OF_RANGE: {
out_of_range e;
MSVCP_out_of_range_ctor(&e, name);
_CxxThrowException(&e, &out_of_range_cxx_type);
}
case EXCEPTION_FAILURE: { case EXCEPTION_FAILURE: {
failure e; failure e;
MSVCP_failure_ctor(&e, name); MSVCP_failure_ctor(&e, name);
......
...@@ -1613,7 +1613,7 @@ ctype_base* __thiscall ctype_base_vector_dtor(ctype_base *this, unsigned int fla ...@@ -1613,7 +1613,7 @@ ctype_base* __thiscall ctype_base_vector_dtor(ctype_base *this, unsigned int fla
/* ?_Xran@ctype_base@std@@KAXXZ */ /* ?_Xran@ctype_base@std@@KAXXZ */
void __cdecl ctype_base__Xran(void) void __cdecl ctype_base__Xran(void)
{ {
throw_exception(EXCEPTION_OUT_OF_RANGE, "out of range in ctype<T>"); _Xout_of_range("out of range in ctype<T>");
} }
/* ?id@?$ctype@D@std@@2V0locale@2@A */ /* ?id@?$ctype@D@std@@2V0locale@2@A */
......
...@@ -667,4 +667,5 @@ void WINAPI DECLSPEC_NORETURN _CxxThrowException(void*,const cxx_exception_type* ...@@ -667,4 +667,5 @@ void WINAPI DECLSPEC_NORETURN _CxxThrowException(void*,const cxx_exception_type*
void __cdecl DECLSPEC_NORETURN _Xinvalid_argument(const char*); void __cdecl DECLSPEC_NORETURN _Xinvalid_argument(const char*);
void __cdecl DECLSPEC_NORETURN _Xlength_error(const char*); 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 _Xruntime_error(const char*); void __cdecl DECLSPEC_NORETURN _Xruntime_error(const char*);
...@@ -468,10 +468,8 @@ void __thiscall _String_base__Xlen(const void/*_String_base*/ *this) ...@@ -468,10 +468,8 @@ void __thiscall _String_base__Xlen(const void/*_String_base*/ *this)
/* ?_Xran@_String_base@std@@SAXXZ */ /* ?_Xran@_String_base@std@@SAXXZ */
void CDECL MSVCP__String_base_Xran(void) void CDECL MSVCP__String_base_Xran(void)
{ {
static const char msg[] = "invalid string position";
TRACE("\n"); TRACE("\n");
throw_exception(EXCEPTION_OUT_OF_RANGE, msg); _Xout_of_range("invalid string position");
} }
/* ?_Xran@_String_base@std@@QBEXXZ */ /* ?_Xran@_String_base@std@@QBEXXZ */
......
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