[glib] Revert "gmacros: Use _Static_assert when C11 is available"



commit 0c9dab36713636e4b9aef79f3f943eb5d4f2e0b2
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Sat Jun 29 13:48:08 2019 -0500

    Revert "gmacros: Use _Static_assert when C11 is available"
    
    This reverts commit 5d14764a6bcfc970e740a3d83b4a9eb06de5077e.
    
    It broke G_STATIC_ASSERT_EXPR(). See discussion in !955.

 glib/gmacros.h | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
---
diff --git a/glib/gmacros.h b/glib/gmacros.h
index c101da6cd..1c8d64699 100644
--- a/glib/gmacros.h
+++ b/glib/gmacros.h
@@ -734,21 +734,13 @@
 #ifndef __GI_SCANNER__ /* The static assert macro really confuses the introspection parser */
 #define G_PASTE_ARGS(identifier1,identifier2) identifier1 ## identifier2
 #define G_PASTE(identifier1,identifier2)      G_PASTE_ARGS (identifier1, identifier2)
-#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
-#define G_STATIC_ASSERT(expr) _Static_assert (expr, "Expression evaluates to false")
-#define G_STATIC_ASSERT_EXPR(expr) _Static_assert (expr, "Expression evaluates to false")
-#elif defined(__cplusplus) && __cplusplus >= 201103L
-#define G_STATIC_ASSERT(expr) static_assert (expr, "Expression evaluates to false")
-#define G_STATIC_ASSERT_EXPR(expr) static_assert (expr, "Expression evaluates to false")
-#else
 #ifdef __COUNTER__
 #define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) 
? 1 : -1] G_GNUC_UNUSED
 #else
 #define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __LINE__)[(expr) ? 
1 : -1] G_GNUC_UNUSED
 #endif
 #define G_STATIC_ASSERT_EXPR(expr) ((void) sizeof (char[(expr) ? 1 : -1]))
-#endif /* __STDC_VERSION__ */
-#endif /* !__GI_SCANNER__ */
+#endif
 
 /* Provide a string identifying the current code position */
 #if defined(__GNUC__) && (__GNUC__ < 3) && !defined(__cplusplus)


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