glib r7633 - in trunk: . glib



Author: timj
Date: Wed Oct 29 15:14:06 2008
New Revision: 7633
URL: http://svn.gnome.org/viewvc/glib?rev=7633&view=rev

Log:
2008-10-29 16:11:14  Tim Janik  <timj gtk org>

        * glib/gmacros.h: added G_PASTE() and G_STATIC_ASSERT(), based on
        patches by Christian Persch and Christian Dywan. Fixes:
        Bug 558381 - Add support for compile time assertions



Modified:
   trunk/ChangeLog
   trunk/glib/gmacros.h

Modified: trunk/glib/gmacros.h
==============================================================================
--- trunk/glib/gmacros.h	(original)
+++ trunk/glib/gmacros.h	Wed Oct 29 15:14:06 2008
@@ -137,6 +137,10 @@
 #define G_STRINGIFY(macro_or_string)	G_STRINGIFY_ARG (macro_or_string)
 #define	G_STRINGIFY_ARG(contents)	#contents
 
+#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__)
+
 /* Provide a string identifying the current code position */
 #if defined(__GNUC__) && (__GNUC__ < 3) && !defined(__cplusplus)
 #  define G_STRLOC	__FILE__ ":" G_STRINGIFY (__LINE__) ":" __PRETTY_FUNCTION__ "()"



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