diff --git a/desktop_version/src/Unreachable.h b/desktop_version/src/Unreachable.h new file mode 100644 index 00000000..d37db95d --- /dev/null +++ b/desktop_version/src/Unreachable.h @@ -0,0 +1,17 @@ +#ifndef UNREACHABLE_H +#define UNREACHABLE_H + +#include + +SDL_NORETURN SDL_INLINE void VVV_unreachable(void) +{ + /* __builtin_unreachable() and __assume(0) execute undefined behavior. + * Otherwise, a noreturn function returning is also undefined behavior. */ +#if defined(__has_builtin) && __has_builtin(__builtin_unreachable) + __builtin_unreachable(); +#elif defined(_MSC_VER) + __assume(0); +#endif +} + +#endif /* UNREACHABLE_H */