#endif
/* Macros to provide type safety for callback functions' context parameters */
-#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3))
+#if ((__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3)) && defined(HAVE_TYPEOF))
# define CALLBACK_TYPECHECK(callback, type) \
(COMPILE_ERROR_IF_TRUE(!__builtin_types_compatible_p( \
typeof(&callback), type)) ? 1 : 0)
#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0)) && !defined(__cplusplus)
# define COMPILE_ERROR_IF_TRUE(condition) \
(sizeof(char[1 - 2 * !!(condition)]) - 1)
+#else
+# define COMPILE_ERROR_IF_TRUE(condition) 0
+#endif
+
+#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0)) && !defined(__cplusplus) && defined(HAVE_TYPEOF)
# define COMPILE_ERROR_IF_TYPES_NOT_COMPATIBLE(_a, _b) \
COMPILE_ERROR_IF_TRUE( \
!__builtin_types_compatible_p(typeof(_a), typeof(_b)))
!__builtin_types_compatible_p(typeof(_a1), typeof(_b)) && \
!__builtin_types_compatible_p(typeof(_a2), typeof(_b)))
#else
-# define COMPILE_ERROR_IF_TRUE(condition) 0
# define COMPILE_ERROR_IF_TYPES_NOT_COMPATIBLE(_a, _b) 0
# define COMPILE_ERROR_IF_TYPES2_NOT_COMPATIBLE(_a1, _a2, _b) 0
#endif