No implementation of unreachable() should allow code execution to
keep going past it.

We can discuss whether we should have a dead loop, abort(), or do
something else, but the current "meh, let's just keep going" is
just wrong.

Cc: mesa-sta...@lists.freedesktop.org
Signed-off-by: Eric Engestrom <eric.engest...@imgtec.com>
---
 src/util/macros.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/util/macros.h b/src/util/macros.h
index a10f1de814..16682bf6e8 100644
--- a/src/util/macros.h
+++ b/src/util/macros.h
@@ -84,7 +84,11 @@ do {                        \
    __assume(0);             \
 } while (0)
 #else
-#define unreachable(str) assert(!str)
+#define unreachable(str)    \
+do {                        \
+   assert(!str);            \
+   while(1);                \
+} while (0)
 #endif
 
 /**
-- 
Cheers,
  Eric

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to