g_clear_handle_id: clear_func is nullable, despite documentation, and GCC 6.2.0 complains
The gtkdoc for g_clear_handle_id()
claims:
@clear_func: (not nullable): the function to call to clear the handler
But both the macro and function implementation contain a NULL check for it:
if (clear_func != NULL) \
clear_func (_handle_id); \
This causes GCC 6.2.0, as found in Flatpak org.gnome.Sdk//3.28
, to complain:
c-sources/pcap-monitor.c: In function ‘wait_check_cb’:
/usr/include/glib-2.0/glib/gmain.h:593:24: warning: the comparison will always evaluate as ‘true’ for the address of ‘g_source_remove’ will never be NULL [-Waddress]
if (clear_func != NULL) \
^
c-sources/pcap-monitor.c:489:3: note: in expansion of macro ‘g_clear_handle_id’
g_clear_handle_id (&priv->await_subprocess_error_id, g_source_remove);
^~~~~~~~~~~~~~~~~
Calling this function with NULL clear_func
doesn't really make any sense; you could just assign 0 to the variable, right? And none of the other g_clear_...
functions accept a NULL function. However, this implementation made it into the 2.56 stable series so we may be stuck with it…
(GCC 8.1.1 with -Waddress
does not complain.)