mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-10 01:28:44 +02:00
feat(libc): implement std::_Xrange_error and the range_error type
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -30,12 +30,6 @@ extern "C" {
|
||||
return 0;
|
||||
}
|
||||
|
||||
APS5_EXPORT("Pu0Ecyk-7FU", libcUnknown_Pu0Ecyk_M7FU);
|
||||
int APS5_VABI libcUnknown_Pu0Ecyk_M7FU() {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Dead import of Cyberpunk 2077 (PPSA04029): no call sites, but the
|
||||
// Windows loader resolves imports strictly, so it must be present.
|
||||
APS5_EXPORT("u2tMGOLaqnE", libcUnknown_u2tMGOLaqnE);
|
||||
|
||||
@@ -267,6 +267,12 @@ void APS5_VABI _ZNSt11regex_errorC1ERKS__nid_postfix(LibcException::ExceptionObj
|
||||
void APS5_VABI _ZNSt11regex_errorC2ERKS__nid_postfix(LibcException::ExceptionObject* self, const LibcException::ExceptionObject* source) { LibcException::Copy(self, source, _ZTVSt11regex_error_nid_postfix); }
|
||||
LibcException::ExceptionObject* APS5_VABI _ZNSt11regex_erroraSERKS__nid_postfix(LibcException::ExceptionObject* self, const LibcException::ExceptionObject* source) { return LibcException::Assign(self, source); }
|
||||
|
||||
LibcException::TypeRecord _ZTISt11range_error_nid_postfix {LibcException::SingleTypeVtable + 2, "St11range_error", &_ZTISt13runtime_error_nid_postfix};
|
||||
LibcException::ExceptionVtable _ZTVSt11range_error_nid_postfix {0, &_ZTISt11range_error_nid_postfix, LibcException::DestroyMessage, LibcException::DeleteMessage, LibcException::MessageWhat};
|
||||
void APS5_VABI _ZNSt11range_errorD1Ev_nid_postfix(LibcException::ExceptionObject* self) { LibcException::DestroyMessage(self); }
|
||||
void APS5_VABI _ZNSt11range_errorD2Ev_nid_postfix(LibcException::ExceptionObject* self) { LibcException::DestroyMessage(self); }
|
||||
void APS5_VABI _ZNSt11range_errorD0Ev_nid_postfix(LibcException::ExceptionObject* self) { LibcException::DeleteMessage(self); }
|
||||
|
||||
LibcException::TypeRecord _ZTINSt8ios_base7failureE_nid_postfix {LibcException::SingleTypeVtable + 2, "NSt8ios_base7failureE", &_ZTISt12system_error_nid_postfix};
|
||||
LibcException::ExceptionVtable _ZTVNSt8ios_base7failureE_nid_postfix {0, &_ZTINSt8ios_base7failureE_nid_postfix, LibcException::DestroyMessage, LibcException::DeleteMessage, LibcException::MessageWhat};
|
||||
void APS5_VABI _ZNSt8ios_base7failureD1Ev_nid_postfix(LibcException::ExceptionObject* self) { LibcException::DestroyMessage(self); }
|
||||
@@ -281,6 +287,7 @@ const char* APS5_VABI _ZNKSt8ios_base7failure4whatEv_nid_postfix(const LibcExcep
|
||||
[[noreturn]] void APS5_VABI _ZSt14_Xout_of_rangePKc_nid_postfix(const char* message) { LibcException::ThrowMessage(_ZTVSt12out_of_range_nid_postfix, message); }
|
||||
[[noreturn]] void APS5_VABI _ZSt14_Xlength_errorPKc_nid_postfix(const char* message) { LibcException::ThrowMessage(_ZTVSt12length_error_nid_postfix, message); }
|
||||
[[noreturn]] void APS5_VABI _ZSt18_Xinvalid_argumentPKc_nid_postfix(const char* message) { LibcException::ThrowMessage(_ZTVSt16invalid_argument_nid_postfix, message); }
|
||||
[[noreturn]] void APS5_VABI _ZSt13_Xrange_errorPKc_nid_postfix(const char* message) { LibcException::ThrowMessage(_ZTVSt11range_error_nid_postfix, message); }
|
||||
[[noreturn]] void APS5_VABI _ZSt19_Xbad_function_callv_nid_postfix() { LibcException::ThrowPlain(_ZTVSt17bad_function_call_nid_postfix); }
|
||||
[[noreturn]] void APS5_VABI _ZSt13_Xregex_errorNSt15regex_constants10error_typeE_nid_postfix(std::regex_constants::error_type code) {
|
||||
struct RegexObject { LibcException::ExceptionObject base; std::regex_constants::error_type code; };
|
||||
|
||||
@@ -17,6 +17,7 @@ extern "C" void __cxa_decrement_exception_refcount_nid_postfix(void*);
|
||||
extern "C" void __cxa_rethrow_primary_exception_nid_postfix(void*);
|
||||
|
||||
extern "C" [[noreturn]] void _ZSt14_Xout_of_rangePKc_nid_postfix(const char*);
|
||||
extern "C" [[noreturn]] void _ZSt13_Xrange_errorPKc_nid_postfix(const char*);
|
||||
extern "C" [[noreturn]] void __cxa_bad_cast_nid_postfix();
|
||||
extern "C" [[noreturn]] void _ZNKSt9exception6_RaiseEv_nid_postfix(const void*);
|
||||
extern "C" void* __cxa_vec_new3_nid_postfix(std::size_t, std::size_t, std::size_t, void(*)(void*), void(*)(void*), void*(*)(std::size_t), void(*)(void*, std::size_t));
|
||||
@@ -190,6 +191,13 @@ int main() {
|
||||
try { throw Virtual(); } catch (Base& value) { assert(value.value == 7); }
|
||||
try { _ZSt14_Xout_of_rangePKc_nid_postfix("test message"); }
|
||||
catch (const std::logic_error& value) { assert(std::strcmp(value.what(), "test message") == 0); }
|
||||
try { _ZSt13_Xrange_errorPKc_nid_postfix("range message"); }
|
||||
catch (const std::range_error& value) { if (std::strcmp(value.what(), "range message") != 0) std::abort(); }
|
||||
try { _ZSt13_Xrange_errorPKc_nid_postfix(nullptr); }
|
||||
catch (const std::runtime_error& value) { if (std::strcmp(value.what(), "") != 0) std::abort(); }
|
||||
try { _ZSt13_Xrange_errorPKc_nid_postfix("not a logic error"); }
|
||||
catch (const std::logic_error&) { std::abort(); }
|
||||
catch (const std::range_error&) {}
|
||||
try { __cxa_bad_cast_nid_postfix(); }
|
||||
catch (const std::exception& value) { assert(value.what() != nullptr); }
|
||||
try { _ZNKSt9exception6_RaiseEv_nid_postfix(nullptr); assert(false); }
|
||||
|
||||
Reference in New Issue
Block a user