void-packages/srcpkgs/stepmania/patches/gcc-12.patch

71 lines
2.0 KiB
Diff

Backported from
https://github.com/stepmania/stepmania/commit/8ab7c7fab937acc684392b909b6b30b47d9a8c7b
--- a/src/NoteData.h
+++ b/src/NoteData.h
@@ -375,7 +375,13 @@ public:
/** @brief Allow a quick way to swap notedata. */
namespace std
{
- template<> inline void swap<NoteData>( NoteData &nd1, NoteData &nd2 ) { nd1.swap( nd2 ); }
+ template<> inline void swap<NoteData>( NoteData &nd1, NoteData &nd2 )
+#if !defined(_MSC_VER)
+ noexcept(is_nothrow_move_constructible<NoteData>::value && is_nothrow_move_assignable<NoteData>::value)
+#endif
+ {
+ nd1.swap( nd2 );
+ }
}
#endif
--- a/src/arch/ArchHooks/ArchHooks.h
+++ b/src/arch/ArchHooks/ArchHooks.h
@@ -1,6 +1,8 @@
#ifndef ARCH_HOOKS_H
#define ARCH_HOOKS_H
+#include <ctime>
+
struct lua_State;
class ArchHooks
{
--- a/src/archutils/Unix/AssertionHandler.cpp
+++ b/src/archutils/Unix/AssertionHandler.cpp
@@ -46,18 +46,28 @@ extern "C" void __assert_perror_fail( int errnum, const char *file, unsigned int
/* Catch unhandled C++ exceptions. Note that this works in g++ even with -fno-exceptions, in
* which case it'll be called if any exceptions are thrown at all. */
-#include <cxxabi.h>
void UnexpectedExceptionHandler()
{
- type_info *pException = abi::__cxa_current_exception_type();
- char const *pName = pException->name();
- int iStatus = -1;
- char *pDem = abi::__cxa_demangle( pName, 0, 0, &iStatus );
-
- const RString error = ssprintf("Unhandled exception: %s", iStatus? pName:pDem);
+ std::exception_ptr exptr = std::current_exception();
+ try
+ {
+ std::rethrow_exception(exptr);
+ }
+ catch (std::exception &ex)
+ {
+#if defined(CRASH_HANDLER)
+ const RString error = ssprintf("Unhandled exception: %s", ex.what());
+ sm_crash( error );
+#endif
+ }
+ // TODO: Don't throw anything not subclassing std::exception
+ catch(...)
+ {
#if defined(CRASH_HANDLER)
- sm_crash( error );
+ const RString error = ssprintf("Unknown exception.");
+ sm_crash( error );
#endif
+ }
}
void InstallExceptionHandler()