summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-07-25 21:34:57 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-07-25 21:34:57 +0200
commit6e16dfa5e5592e9662f839a9696f2863e2428bc5 (patch)
tree7271aa4493eb4f245e3d9a9182a9f56a75689739 /src
parentc998e946aae7e4633def6e3c7a925d828fbc7fea (diff)
use defines for unreachable
Diffstat (limited to 'src')
-rw-r--r--src/defines.hpp6
-rw-r--r--src/helpers/AnimatedVariable.hpp8
2 files changed, 11 insertions, 3 deletions
diff --git a/src/defines.hpp b/src/defines.hpp
index 375f0119..ecad02aa 100644
--- a/src/defines.hpp
+++ b/src/defines.hpp
@@ -54,6 +54,12 @@
#define ASSERT(expr) RASSERT(expr, "?")
+#if ISDEBUG
+#define UNREACHABLE() { Debug::log(CRIT, "\n\nMEMORY CORRUPTED: Unreachable failed! (Reached an unreachable position, memory corruption!!!)"); *((int*)nullptr) = 1; }
+#else
+#define UNREACHABLE() std::unreachable();
+#endif
+
// git stuff
#ifndef GIT_COMMIT_HASH
#define GIT_COMMIT_HASH "?"
diff --git a/src/helpers/AnimatedVariable.hpp b/src/helpers/AnimatedVariable.hpp
index d8fd3c4c..7b02ba6c 100644
--- a/src/helpers/AnimatedVariable.hpp
+++ b/src/helpers/AnimatedVariable.hpp
@@ -129,10 +129,12 @@ public:
case AVARTYPE_COLOR:
return m_cValue != m_cGoal;
default:
- std::unreachable();
+ UNREACHABLE();
}
- std::unreachable();
+ UNREACHABLE();
+
+ return false; // just so that the warning is suppressed
}
void warp() {
@@ -150,7 +152,7 @@ public:
break;
}
default:
- std::unreachable();
+ UNREACHABLE();
}
}