gstinfo: Avoid gcc 6 warning that breaks the tests build
authorJan Schmidt <jan@centricular.com>
Fri, 1 Jul 2016 12:34:59 +0000 (22:34 +1000)
committerJan Schmidt <jan@centricular.com>
Fri, 1 Jul 2016 12:38:01 +0000 (22:38 +1000)
gcc 6 has problems detecting and avoiding throwing
a warning for tautological compares in macros (they
should only trigger for compares outside macros).

Avoid them with a nasty cast of one parameter to void *

https://bugzilla.gnome.org/show_bug.cgi?id=764526

gst/gstinfo.h

index 27c3f9d..d2fd7e4 100644 (file)
@@ -415,9 +415,11 @@ gchar * gst_info_strdup_printf          (const gchar *format, ...) G_GNUC_PRINTF
 
 #ifndef GST_DISABLE_GST_DEBUG
 
+/* cast to void * avoids a warning with gcc 6
+ * see https://bugzilla.gnome.org/show_bug.cgi?id=764526 */
 #define gst_debug_add_log_function(func,data,notify) \
 G_STMT_START{                                        \
-  if (func == gst_debug_log_default) {               \
+  if (func == (void *) gst_debug_log_default) {               \
     gst_debug_add_log_function(NULL,data,notify);    \
   } else {                                           \
     gst_debug_add_log_function(func,data,notify);    \
@@ -425,7 +427,7 @@ G_STMT_START{                                        \
 }G_STMT_END
 
 #define gst_debug_remove_log_function(func)   \
-    (func == gst_debug_log_default) ?         \
+    (func == (void *) gst_debug_log_default) ?         \
         gst_debug_remove_log_function(NULL) : \
         gst_debug_remove_log_function(func)