util: Implement unreachable for MSVC using __assume
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 22 Oct 2014 23:41:41 +0000 (16:41 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 5 Nov 2014 17:36:04 +0000 (09:36 -0800)
Based on the description of __assume at:

http://msdn.microsoft.com/en-us/library/1b3fsfxw.aspx

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
src/util/macros.h

index ff37a7d63e6dce4ab660524d114703f5cd4965ff..da5daff9bf8283e6796f85420dc1b170c95a3e24 100644 (file)
@@ -69,6 +69,12 @@ do {                        \
    assert(!str);            \
    __builtin_unreachable(); \
 } while (0)
+#elif _MSC_VER >= 1200
+#define unreachable(str)    \
+do {                        \
+   assert(!str);            \
+   __assume(0);             \
+} while (0)
 #endif
 
 #ifndef unreachable