[dovecot-cvs] dovecot/src/lib macros.h,1.22,1.23

tss at dovecot.org tss at dovecot.org
Thu Mar 29 14:48:20 EEST 2007


Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv16022

Modified Files:
	macros.h 
Log Message:
Added HAVE_TYPEOF, COMPILE_ERROR_IF_TRUE() and
COMPILE_ERROR_IF_TYPES_NOT_COMPATIBLE() macros.



Index: macros.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/macros.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- macros.h	22 Feb 2007 15:59:54 -0000	1.22
+++ macros.h	29 Mar 2007 11:48:18 -0000	1.23
@@ -142,6 +142,18 @@
 	name(__VA_ARGS__, (callback_type *)callback, context)
 #endif
 
+#ifdef __GNUC__
+#  define HAVE_TYPEOF
+#  define COMPILE_ERROR_IF_TRUE(condition) \
+	(sizeof(char[1 - 2 * !!(condition)]) - 1)
+#  define COMPILE_ERROR_IF_TYPES_NOT_COMPATIBLE(_a, _b) \
+	COMPILE_ERROR_IF_TRUE( \
+		!__builtin_types_compatible_p(typeof(_a), typeof(_b)))
+#else
+#  define COMPILE_ERROR_IF_TRUE(condition) 0
+#  define COMPILE_ERROR_IF_TYPES_NOT_COMPATIBLE(_a, _b) 0
+#endif
+
 /* Wrap the gcc __PRETTY_FUNCTION__ and __FUNCTION__ variables with
    macros, so we can refer to them as strings unconditionally. */
 #ifdef __GNUC__



More information about the dovecot-cvs mailing list