diff --git a/stepmania/src/global.cpp b/stepmania/src/global.cpp index 9b503ad760..ed276f7ac0 100644 --- a/stepmania/src/global.cpp +++ b/stepmania/src/global.cpp @@ -1,3 +1,23 @@ -/* This is just a dummy file for Win32 pre-compiled headers. */ #include "global.h" +#ifdef _WINDOWS +#include "windows.h" +void NORETURN sm_crash() +{ + // throws an exception that gets caught by the exception handler + DebugBreak(); + + /* Do something after calling DebugBreak, so the call/return isn't optimized + * to a jmp; that way, this function will appear in backtrace stack traces. */ + _asm nop; +} +#else +void NORETURN sm_crash() +{ + *(char*)0=0; + + /* This isn't actually reached. We just do this to convince the compiler that the + * function really doesn't return. */ + while(1); +} +#endif diff --git a/stepmania/src/global.h b/stepmania/src/global.h index e2705932b9..af26255e27 100644 --- a/stepmania/src/global.h +++ b/stepmania/src/global.h @@ -86,13 +86,7 @@ namespace Checkpoints #define NORETURN #endif -/* The infinite loop isn't actually reached; it's just there to shut up a warning. */ -#ifdef _WINDOWS - #include "windows.h" - static inline void NORETURN sm_crash() { DebugBreak(); } // throws an exception that gets caught by the exception handler -#else - static inline void NORETURN sm_crash() { *(char*)0=0; while(1); } -#endif +void NORETURN sm_crash(); /* Assertion that sets an optional message and brings up the crash handler, so * we get a backtrace. This should probably be used instead of throwing an