Skip to content

macros: Double-cast func for g_autolist to avoid warning

Jan Alexander Steffens requested to merge heftig/glib:master into master

For g_autolist and g_autoslist, the cleanup func was cast to GDestroyNotify before being passed to g_(s)list_free_full. This cast provokes GCC 8 to emit a warning if the return type is not void:

…/gmacros.h:462:99: warning: cast between incompatible function types
from … to 'void (*)(void *)' [-Wcast-function-type]

Cast to 'void (*)(void)' first, which suppresses the warning as recommended by the GCC documentation. g_autoptr remains untouched.

Fixes #1382 (closed) and #1390 (closed)

Edited by Jan Alexander Steffens

Merge request reports