From a7c68c2e0b5aa71a622448d43ada5ca65aa5c8e3 Mon Sep 17 00:00:00 2001 From: Daniel Lehman Date: Tue, 5 Sep 2017 15:40:31 -0700 Subject: [PATCH] msvcp120: Implement concurrent_vector::_Internal_throw_exception. Signed-off-by: Daniel Lehman tested using C++: bool threw; struct { const char *type_name; const char *message; } tests[] = { {"class std::out_of_range", "Index out of range"}, {"class std::out_of_range", "Index out of segments table range"}, {"class std::range_error", "Index is inside segment which failed to be allocated"} }; for (size_t i = 0; i < sizeof(tests)/sizeof(tests[0]); i++) { try { threw = false; _vector_base_v4__Internal_throw_exception(NULL /* unused */, i); } catch (std::exception &e) { ok(!strcmp(tests[i].message, e.what()), "expected: '%s', got: '%s'\n", tests[i].message, e.what()); ok(!strcmp(tests[i].type_name, typeid(e).name()), "expected: '%s', got: '%s'\n", tests[i].type_name, typeid(e).name()); threw = true; } ok(threw, "didn't throw exception for %zu\n", i); } try { size_t i = sizeof(tests)/sizeof(tests[0]); /* index just after last msg */ _vector_base_v4__Internal_throw_exception(NULL /* unused */, i); } catch (std::exception &) { ok(0, "shouldn't throw\n"); } Signed-off-by: Daniel Lehman --- dlls/concrt140/concrt140.spec | 4 ++-- dlls/msvcp100/msvcp100.spec | 4 ++-- dlls/msvcp110/msvcp110.spec | 6 +++--- dlls/msvcp120/msvcp120.spec | 6 +++--- dlls/msvcp120_app/msvcp120_app.spec | 6 +++--- dlls/msvcp90/misc.c | 23 +++++++++++++++++++++++ 6 files changed, 36 insertions(+), 13 deletions(-) diff --git a/dlls/concrt140/concrt140.spec b/dlls/concrt140/concrt140.spec index eb0c9fb..0f96d7e 100644 --- a/dlls/concrt140/concrt140.spec +++ b/dlls/concrt140/concrt140.spec @@ -385,8 +385,8 @@ @ stub -arch=win64 ?_Internal_swap@_Concurrent_vector_base_v4@details@Concurrency@@IEAAXAEAV123@@Z @ stub -arch=i386 ?_Internal_throw_exception@_Concurrent_queue_base_v4@details@Concurrency@@IBEXXZ @ stub -arch=win64 ?_Internal_throw_exception@_Concurrent_queue_base_v4@details@Concurrency@@IEBAXXZ -@ stub -arch=i386 ?_Internal_throw_exception@_Concurrent_vector_base_v4@details@Concurrency@@IBEXI@Z -@ stub -arch=win64 ?_Internal_throw_exception@_Concurrent_vector_base_v4@details@Concurrency@@IEBAX_K@Z +@ thiscall -arch=i386 ?_Internal_throw_exception@_Concurrent_vector_base_v4@details@Concurrency@@IBEXI@Z(ptr long) msvcp120.?_Internal_throw_exception@_Concurrent_vector_base_v4@details@Concurrency@@IBEXI@Z +@ cdecl -arch=win64 ?_Internal_throw_exception@_Concurrent_vector_base_v4@details@Concurrency@@IEBAX_K@Z(ptr long) msvcp120.?_Internal_throw_exception@_Concurrent_vector_base_v4@details@Concurrency@@IEBAX_K@Z @ stub -arch=i386 ?_IsCanceling@_StructuredTaskCollection@details@Concurrency@@QAE_NXZ @ stub -arch=win64 ?_IsCanceling@_StructuredTaskCollection@details@Concurrency@@QEAA_NXZ @ stub -arch=i386 ?_IsCanceling@_TaskCollection@details@Concurrency@@QAE_NXZ diff --git a/dlls/msvcp100/msvcp100.spec b/dlls/msvcp100/msvcp100.spec index 8bffda2..d557a4a 100644 --- a/dlls/msvcp100/msvcp100.spec +++ b/dlls/msvcp100/msvcp100.spec @@ -1061,8 +1061,8 @@ @ stub -arch=win64 ?_Internal_swap@_Concurrent_vector_base_v4@details@Concurrency@@IEAAXAEAV123@@Z @ stub -arch=win32 ?_Internal_throw_exception@_Concurrent_queue_base_v4@details@Concurrency@@IBEXXZ @ stub -arch=win64 ?_Internal_throw_exception@_Concurrent_queue_base_v4@details@Concurrency@@IEBAXXZ -@ stub -arch=win32 ?_Internal_throw_exception@_Concurrent_vector_base_v4@details@Concurrency@@IBEXI@Z -@ stub -arch=win64 ?_Internal_throw_exception@_Concurrent_vector_base_v4@details@Concurrency@@IEBAX_K@Z +@ thiscall -arch=win32 ?_Internal_throw_exception@_Concurrent_vector_base_v4@details@Concurrency@@IBEXI@Z(ptr long) _vector_base_v4__Internal_throw_exception +@ cdecl -arch=win64 ?_Internal_throw_exception@_Concurrent_vector_base_v4@details@Concurrency@@IEBAX_K@Z(ptr long) _vector_base_v4__Internal_throw_exception @ cdecl -arch=win32 ?_Ios_base_dtor@ios_base@std@@CAXPAV12@@Z(ptr) ios_base_Ios_base_dtor @ cdecl -arch=win64 ?_Ios_base_dtor@ios_base@std@@CAXPEAV12@@Z(ptr) ios_base_Ios_base_dtor @ thiscall -arch=win32 ?_Ipfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QAE_N_N@Z(ptr long) basic_istream_char__Ipfx diff --git a/dlls/msvcp110/msvcp110.spec b/dlls/msvcp110/msvcp110.spec index c912202..aa8adaf 100644 --- a/dlls/msvcp110/msvcp110.spec +++ b/dlls/msvcp110/msvcp110.spec @@ -1539,9 +1539,9 @@ @ stub -arch=arm ?_Internal_throw_exception@_Concurrent_queue_base_v4@details@Concurrency@@IBAXXZ @ stub -arch=i386 ?_Internal_throw_exception@_Concurrent_queue_base_v4@details@Concurrency@@IBEXXZ @ stub -arch=win64 ?_Internal_throw_exception@_Concurrent_queue_base_v4@details@Concurrency@@IEBAXXZ -@ stub -arch=arm ?_Internal_throw_exception@_Concurrent_vector_base_v4@details@Concurrency@@IBAXI@Z -@ stub -arch=i386 ?_Internal_throw_exception@_Concurrent_vector_base_v4@details@Concurrency@@IBEXI@Z -@ stub -arch=win64 ?_Internal_throw_exception@_Concurrent_vector_base_v4@details@Concurrency@@IEBAX_K@Z +@ cdecl -arch=arm ?_Internal_throw_exception@_Concurrent_vector_base_v4@details@Concurrency@@IBAXI@Z(ptr long) _vector_base_v4__Internal_throw_exception +@ thiscall -arch=i386 ?_Internal_throw_exception@_Concurrent_vector_base_v4@details@Concurrency@@IBEXI@Z(ptr long) _vector_base_v4__Internal_throw_exception +@ cdecl -arch=win64 ?_Internal_throw_exception@_Concurrent_vector_base_v4@details@Concurrency@@IEBAX_K@Z(ptr long) _vector_base_v4__Internal_throw_exception @ cdecl -arch=win32 ?_Ios_base_dtor@ios_base@std@@CAXPAV12@@Z(ptr) ios_base_Ios_base_dtor @ cdecl -arch=win64 ?_Ios_base_dtor@ios_base@std@@CAXPEAV12@@Z(ptr) ios_base_Ios_base_dtor @ cdecl -arch=arm ?_Ipfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QAA_N_N@Z(ptr long) basic_istream_char__Ipfx diff --git a/dlls/msvcp120/msvcp120.spec b/dlls/msvcp120/msvcp120.spec index 61d7c7d..e26e3cb 100644 --- a/dlls/msvcp120/msvcp120.spec +++ b/dlls/msvcp120/msvcp120.spec @@ -1500,9 +1500,9 @@ @ stub -arch=arm ?_Internal_throw_exception@_Concurrent_queue_base_v4@details@Concurrency@@IBAXXZ @ stub -arch=i386 ?_Internal_throw_exception@_Concurrent_queue_base_v4@details@Concurrency@@IBEXXZ @ stub -arch=win64 ?_Internal_throw_exception@_Concurrent_queue_base_v4@details@Concurrency@@IEBAXXZ -@ stub -arch=arm ?_Internal_throw_exception@_Concurrent_vector_base_v4@details@Concurrency@@IBAXI@Z -@ stub -arch=i386 ?_Internal_throw_exception@_Concurrent_vector_base_v4@details@Concurrency@@IBEXI@Z -@ stub -arch=win64 ?_Internal_throw_exception@_Concurrent_vector_base_v4@details@Concurrency@@IEBAX_K@Z +@ cdecl -arch=arm ?_Internal_throw_exception@_Concurrent_vector_base_v4@details@Concurrency@@IBAXI@Z(ptr long) _vector_base_v4__Internal_throw_exception +@ thiscall -arch=i386 ?_Internal_throw_exception@_Concurrent_vector_base_v4@details@Concurrency@@IBEXI@Z(ptr long) _vector_base_v4__Internal_throw_exception +@ cdecl -arch=win64 ?_Internal_throw_exception@_Concurrent_vector_base_v4@details@Concurrency@@IEBAX_K@Z(ptr long) _vector_base_v4__Internal_throw_exception @ cdecl -arch=win32 ?_Ios_base_dtor@ios_base@std@@CAXPAV12@@Z(ptr) ios_base_Ios_base_dtor @ cdecl -arch=win64 ?_Ios_base_dtor@ios_base@std@@CAXPEAV12@@Z(ptr) ios_base_Ios_base_dtor @ cdecl -arch=arm ?_Ipfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QAA_N_N@Z(ptr long) basic_istream_char__Ipfx diff --git a/dlls/msvcp120_app/msvcp120_app.spec b/dlls/msvcp120_app/msvcp120_app.spec index e63b3f7..03df113 100644 --- a/dlls/msvcp120_app/msvcp120_app.spec +++ b/dlls/msvcp120_app/msvcp120_app.spec @@ -1500,9 +1500,9 @@ @ stub -arch=arm ?_Internal_throw_exception@_Concurrent_queue_base_v4@details@Concurrency@@IBAXXZ @ stub -arch=i386 ?_Internal_throw_exception@_Concurrent_queue_base_v4@details@Concurrency@@IBEXXZ @ stub -arch=win64 ?_Internal_throw_exception@_Concurrent_queue_base_v4@details@Concurrency@@IEBAXXZ -@ stub -arch=arm ?_Internal_throw_exception@_Concurrent_vector_base_v4@details@Concurrency@@IBAXI@Z -@ stub -arch=i386 ?_Internal_throw_exception@_Concurrent_vector_base_v4@details@Concurrency@@IBEXI@Z -@ stub -arch=win64 ?_Internal_throw_exception@_Concurrent_vector_base_v4@details@Concurrency@@IEBAX_K@Z +@ cdecl -arch=arm ?_Internal_throw_exception@_Concurrent_vector_base_v4@details@Concurrency@@IBAXI@Z(ptr long) msvcp120.?_Internal_throw_exception@_Concurrent_vector_base_v4@details@Concurrency@@IBAXI@Z +@ thiscall -arch=i386 ?_Internal_throw_exception@_Concurrent_vector_base_v4@details@Concurrency@@IBEXI@Z(ptr long) msvcp120.?_Internal_throw_exception@_Concurrent_vector_base_v4@details@Concurrency@@IBEXI@Z +@ cdecl -arch=win64 ?_Internal_throw_exception@_Concurrent_vector_base_v4@details@Concurrency@@IEBAX_K@Z(ptr long) msvcp120.?_Internal_throw_exception@_Concurrent_vector_base_v4@details@Concurrency@@IEBAX_K@Z @ cdecl -arch=win32 ?_Ios_base_dtor@ios_base@std@@CAXPAV12@@Z(ptr) msvcp120.?_Ios_base_dtor@ios_base@std@@CAXPAV12@@Z @ cdecl -arch=win64 ?_Ios_base_dtor@ios_base@std@@CAXPEAV12@@Z(ptr) msvcp120.?_Ios_base_dtor@ios_base@std@@CAXPEAV12@@Z @ cdecl -arch=arm ?_Ipfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QAA_N_N@Z(ptr long) msvcp120.?_Ipfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QAA_N_N@Z diff --git a/dlls/msvcp90/misc.c b/dlls/msvcp90/misc.c index 9f26a48..3942c96 100644 --- a/dlls/msvcp90/misc.c +++ b/dlls/msvcp90/misc.c @@ -1656,6 +1656,9 @@ _Ph _Ph_16 = {0}, _Ph_17 = {0}, _Ph_18 = {0}, _Ph_19 = {0}, _Ph_20 = {0}; #endif #if _MSVCP_VER >= 100 +typedef struct { +} _vector_base_v4; + /* based on wined3d_log2i from wined3d.h */ /* Return the integer base-2 logarithm of (x|1). Result is 0 for x == 0. */ static inline unsigned int log2i(unsigned int x) @@ -1702,4 +1705,24 @@ MSVCP_size_t __cdecl _vector_base_v4__Segment_index_of(MSVCP_size_t x) return log2i(x); } + +/* ?_Internal_throw_exception@_Concurrent_vector_base_v4@details@Concurrency@@IBEXI@Z */ +/* ?_Internal_throw_exception@_Concurrent_vector_base_v4@details@Concurrency@@IEBAX_K@Z */ +DEFINE_THISCALL_WRAPPER(_vector_base_v4__Internal_throw_exception, 8) +void __thiscall _vector_base_v4__Internal_throw_exception(_vector_base_v4 *this, MSVCP_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 %lu)\n", this, idx); + + if(idx < sizeof(exceptions)/sizeof(exceptions[0])) + throw_exception(exceptions[idx].type, exceptions[idx].msg); +} #endif -- 1.9.5