[glib] Make G_ASSERT_STATIC work with clang



commit e517fb6cb030c678918932aad5c0e63b4e0b1beb
Author: Ryan Lortie <desrt desrt ca>
Date:   Tue Oct 4 11:52:47 2011 -0400

    Make G_ASSERT_STATIC work with clang
    
    A simplified variant of an approach proposed by Behdad.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=660413

 glib/gmacros.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/glib/gmacros.h b/glib/gmacros.h
index f67fbd5..f8ce714 100644
--- a/glib/gmacros.h
+++ b/glib/gmacros.h
@@ -146,7 +146,7 @@
 
 #define G_PASTE_ARGS(identifier1,identifier2) identifier1 ## identifier2
 #define G_PASTE(identifier1,identifier2)      G_PASTE_ARGS (identifier1, identifier2)
-#define G_STATIC_ASSERT(expr) typedef struct { char Compile_Time_Assertion[(expr) ? 1 : -1]; } G_PASTE (_GStaticAssert_, __LINE__)
+#define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __LINE__)[(expr) ? 1 : -1]
 #define G_STATIC_ASSERT_EXPR(expr) ((void) sizeof (char[(expr) ? 1 : -1]))
 
 /* Provide a string identifying the current code position */



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