diff options
author | Joao Matos <joao.matos@xamarin.com> | 2014-06-04 22:37:17 +0400 |
---|---|---|
committer | Joao Matos <joao.matos@xamarin.com> | 2014-06-05 00:09:45 +0400 |
commit | 7d93575e587aa2bfa0d57a3b448a8c5716d9e0b2 (patch) | |
tree | 311fb7085b96b08def09d144a4c2611f108979d2 /eglib | |
parent | 956ec8a589b64184f28d8b36706e0158f0abbf59 (diff) |
Added g_unreachable to explicitly notify the compiler of unreachable code.
Diffstat (limited to 'eglib')
-rw-r--r-- | eglib/src/glib.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/eglib/src/glib.h b/eglib/src/glib.h index 6d6dadff448..363a33dfe7d 100644 --- a/eglib/src/glib.h +++ b/eglib/src/glib.h @@ -727,6 +727,14 @@ GUnicodeBreakType g_unichar_break_type (gunichar c); #define G_UNLIKELY(x) (x) #endif +#if defined(_MSC_VER) +#define eg_unreachable() __assume(0) +#elif defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 5))) +#define eg_unreachable() __builtin_unreachable() +#else +#define eg_unreachable() +#endif + #define g_assert(x) G_STMT_START { if (G_UNLIKELY (!(x))) g_assertion_message ("* Assertion at %s:%d, condition `%s' not met\n", __FILE__, __LINE__, #x); } G_STMT_END #define g_assert_not_reached() G_STMT_START { g_assertion_message ("* Assertion: should not be reached at %s:%d\n", __FILE__, __LINE__); } G_STMT_END |