summaryrefslogtreecommitdiffhomepage
path: root/compat
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-05-06 16:04:17 +0200
committerStanislaw Halik <sthalik@misaki.pl>2024-05-06 16:04:17 +0200
commit2085e643eb422eedba887c40ff4c6331f6f247c2 (patch)
treeffc3f75a0dfbe55f361d81166ed0ede6d43f7e36 /compat
parentcb484be64de45ad6529952366273978502a17b6d (diff)
walk script wip
Diffstat (limited to 'compat')
-rw-r--r--compat/failwith.hpp21
1 files changed, 21 insertions, 0 deletions
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 <utility>
+#endif
+
+namespace floormat {
+
+template<typename T> 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