Piotr Caban : msvcp90: Introduce throw_failure helper.
Alexandre Julliard
julliard at winehq.org
Fri Aug 27 15:03:34 CDT 2021
Module: wine
Branch: master
Commit: d7e9190032310b7481b2802aaf92148a3b9153bb
URL: https://source.winehq.org/git/wine.git/?a=commit;h=d7e9190032310b7481b2802aaf92148a3b9153bb
Author: Piotr Caban <piotr at codeweavers.com>
Date: Fri Aug 27 13:48:33 2021 +0200
msvcp90: Introduce throw_failure helper.
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/msvcp60/ios.c | 8 ++++----
dlls/msvcp60/msvcp.h | 1 +
dlls/msvcp90/cxx.h | 1 -
dlls/msvcp90/exception.c | 15 ++++++++++-----
dlls/msvcp90/ios.c | 8 ++++----
dlls/msvcp90/msvcp90.h | 1 +
6 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/dlls/msvcp60/ios.c b/dlls/msvcp60/ios.c
index 8657fd9b3e5..495817a54db 100644
--- a/dlls/msvcp60/ios.c
+++ b/dlls/msvcp60/ios.c
@@ -4849,13 +4849,13 @@ void __thiscall ios_base_clear_reraise(ios_base *this, IOSB_iostate state, bool
if(reraise)
_CxxThrowException(NULL, NULL);
else if(this->state & this->except & IOSTATE_eofbit)
- throw_exception(EXCEPTION_FAILURE, "eofbit is set");
+ throw_failure("eofbit is set");
else if(this->state & this->except & IOSTATE_failbit)
- throw_exception(EXCEPTION_FAILURE, "failbit is set");
+ throw_failure("failbit is set");
else if(this->state & this->except & IOSTATE_badbit)
- throw_exception(EXCEPTION_FAILURE, "badbit is set");
+ throw_failure("badbit is set");
else if(this->state & this->except & IOSTATE__Hardfail)
- throw_exception(EXCEPTION_FAILURE, "_Hardfail is set");
+ throw_failure("_Hardfail is set");
}
/* ?clear at ios_base@std@@QAEXH at Z */
diff --git a/dlls/msvcp60/msvcp.h b/dlls/msvcp60/msvcp.h
index bae75855c3a..19078a133e4 100644
--- a/dlls/msvcp60/msvcp.h
+++ b/dlls/msvcp60/msvcp.h
@@ -488,3 +488,4 @@ void WINAPI DECLSPEC_NORETURN _CxxThrowException(void*,const cxx_exception_type*
void __cdecl DECLSPEC_NORETURN _Xlength_error(const char*);
void __cdecl DECLSPEC_NORETURN _Xmem(void);
void __cdecl DECLSPEC_NORETURN _Xout_of_range(const char*);
+void DECLSPEC_NORETURN throw_failure(const char*);
diff --git a/dlls/msvcp90/cxx.h b/dlls/msvcp90/cxx.h
index b8c29921db1..58f6fe43586 100644
--- a/dlls/msvcp90/cxx.h
+++ b/dlls/msvcp90/cxx.h
@@ -319,7 +319,6 @@ typedef enum __exception_type {
EXCEPTION,
EXCEPTION_BAD_CAST,
EXCEPTION_LOGIC_ERROR,
- EXCEPTION_FAILURE,
} exception_type;
void throw_exception(exception_type, const char *);
diff --git a/dlls/msvcp90/exception.c b/dlls/msvcp90/exception.c
index f93d92b601d..977bdff9739 100644
--- a/dlls/msvcp90/exception.c
+++ b/dlls/msvcp90/exception.c
@@ -1086,11 +1086,6 @@ void throw_exception(exception_type et, const char *str)
MSVCP_logic_error_ctor(&e, name);
_CxxThrowException(&e, &logic_error_cxx_type);
}
- case EXCEPTION_FAILURE: {
- failure e;
- MSVCP_failure_ctor(&e, name);
- _CxxThrowException(&e, &failure_cxx_type);
- }
}
}
@@ -1104,6 +1099,16 @@ void DECLSPEC_NORETURN throw_range_error(const char *str)
_CxxThrowException(&e, &range_error_cxx_type);
}
+/* Internal: throws failure exception */
+void DECLSPEC_NORETURN throw_failure(const char *str)
+{
+ exception_name name = EXCEPTION_NAME(str);
+ failure e;
+
+ MSVCP_failure_ctor(&e, name);
+ _CxxThrowException(&e, &failure_cxx_type);
+}
+
void init_exception(void *base)
{
#ifdef __x86_64__
diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c
index 8275635096a..21cf33a505c 100644
--- a/dlls/msvcp90/ios.c
+++ b/dlls/msvcp90/ios.c
@@ -5266,13 +5266,13 @@ void __thiscall ios_base_clear_reraise(ios_base *this, IOSB_iostate state, bool
if(reraise)
_CxxThrowException(NULL, NULL);
else if(this->state & this->except & IOSTATE_eofbit)
- throw_exception(EXCEPTION_FAILURE, "eofbit is set");
+ throw_failure("eofbit is set");
else if(this->state & this->except & IOSTATE_failbit)
- throw_exception(EXCEPTION_FAILURE, "failbit is set");
+ throw_failure("failbit is set");
else if(this->state & this->except & IOSTATE_badbit)
- throw_exception(EXCEPTION_FAILURE, "badbit is set");
+ throw_failure("badbit is set");
else if(this->state & this->except & IOSTATE__Hardfail)
- throw_exception(EXCEPTION_FAILURE, "_Hardfail is set");
+ throw_failure("_Hardfail is set");
}
/* ?clear at ios_base@std@@QAEXH at Z */
diff --git a/dlls/msvcp90/msvcp90.h b/dlls/msvcp90/msvcp90.h
index 63ba36f7b38..e917fad4e28 100644
--- a/dlls/msvcp90/msvcp90.h
+++ b/dlls/msvcp90/msvcp90.h
@@ -669,4 +669,5 @@ void __cdecl DECLSPEC_NORETURN _Xlength_error(const char*);
void __cdecl DECLSPEC_NORETURN _Xmem(void);
void __cdecl DECLSPEC_NORETURN _Xout_of_range(const char*);
void __cdecl DECLSPEC_NORETURN _Xruntime_error(const char*);
+void DECLSPEC_NORETURN throw_failure(const char*);
void DECLSPEC_NORETURN throw_range_error(const char*);
More information about the wine-cvs
mailing list