[vlc-devel] [PATCH] vlc_common: Provide an unreachable() implementation for MSVC
    Hugo Beauzée-Luyssen 
    hugo at beauzee.fr
       
    Fri Dec 18 14:13:09 UTC 2020
    
    
  
---
 include/vlc_common.h | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/include/vlc_common.h b/include/vlc_common.h
index d65a076d45..f62ff86d04 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -203,6 +203,10 @@
 # define likely(p)     __builtin_expect(!!(p), 1)
 # define unlikely(p)   __builtin_expect(!!(p), 0)
 # define unreachable() __builtin_unreachable()
+#elif defined(_MSC_VER)
+# define likely(p)     (!!(p))
+# define unlikely(p)   (!!(p))
+# define unreachable() (__assume(0))
 #else
 /**
  * Predicted true condition
-- 
2.29.2
    
    
More information about the vlc-devel
mailing list