From 2085e643eb422eedba887c40ff4c6331f6f247c2 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 6 May 2024 16:04:17 +0200 Subject: walk script wip --- compat/failwith.hpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 compat/failwith.hpp (limited to 'compat') diff --git a/compat/failwith.hpp b/compat/failwith.hpp new file mode 100644 index 00000000..580ed923 --- /dev/null +++ b/compat/failwith.hpp @@ -0,0 +1,21 @@ +#pragma once +#include "compat/assert.hpp" +#if !defined __GNUG__ && !defined _MSC_VER +#include +#endif + +namespace floormat { + +template T failwith(const char* str) +{ + fm_abort("%s", str); +#ifdef __GNUG__ + __builtin_unreachable(); +#elif defined _MSC_VER + __assume(false); +#else + std::unreachable(); +#endif +} + +} // namespace floormat -- cgit v1.2.3