[glib: 1/2] gtestutils: Fix g_assert_not_reached() on MSVC




commit d35a606852be841b6f04c9dfa26a5cdfd61a936b
Author: Ole André Vadla Ravnås <oleavr gmail com>
Date:   Tue Jan 5 19:12:20 2021 +0100

    gtestutils: Fix g_assert_not_reached() on MSVC
    
    When building with G_DISABLE_ASSERT.

 glib/gtestutils.h | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/glib/gtestutils.h b/glib/gtestutils.h
index e93c49067..780b163b9 100644
--- a/glib/gtestutils.h
+++ b/glib/gtestutils.h
@@ -219,6 +219,8 @@ typedef void (*GTestFixtureFunc) (gpointer      fixture,
  * GCC 5 is not a strict lower bound for versions of GCC which provide __builtin_unreachable(). */
 #if __GNUC__ >= 5 || g_macro__has_builtin(__builtin_unreachable)
 #define g_assert_not_reached()          G_STMT_START { (void) 0; __builtin_unreachable (); } G_STMT_END
+#elif defined (_MSC_VER)
+#define g_assert_not_reached()          G_STMT_START { (void) 0; __assume (0); } G_STMT_END
 #else  /* if __builtin_unreachable() is not supported: */
 #define g_assert_not_reached()          G_STMT_START { (void) 0; } G_STMT_END
 #endif


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]