On Fri, May 29, 2015 at 02:57:12PM +0100, Peter Maydell wrote: > On 29 May 2015 at 14:51, Daniel P. Berrange <berra...@redhat.com> wrote: > > Since that caused failure with glib 2.22 could you revert that switch > > to g_assert_null/nonnull. > > BTW, David Gilbert is looking at whether we can use the glib support > to make use of "newer than version X" APIs a compile error everywhere > rather than just on boxes with the older glib, which should help > cut down on this kind of problem in future.
It seem these g_assert_nonnull/null functions are in fact just trivial macros, so we could alternatively add them to our glib-compat.h file #define g_assert_true(expr) G_STMT_START { \ if G_LIKELY (expr) ; else \ g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ "'" #expr "' should be TRUE"); \ } G_STMT_END #define g_assert_false(expr) G_STMT_START { \ if G_LIKELY (!(expr)) ; else \ g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ "'" #expr "' should be FALSE"); \ } G_STMT_END #define g_assert_null(expr) G_STMT_START { if G_LIKELY ((expr) == NULL) ; else \ g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ "'" #expr "' should be NULL"); \ } G_STMT_END #define g_assert_nonnull(expr) G_STMT_START { \ if G_LIKELY ((expr) != NULL) ; else \ g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ "'" #expr "' should not be NULL"); \ Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|