diff options
-rw-r--r-- | glib/gmacros.h | 6 | ||||
-rw-r--r-- | glib/tests/autoptr.c | 6 |
2 files changed, 9 insertions, 3 deletions
diff --git a/glib/gmacros.h b/glib/gmacros.h index 55fb81e5b..0e180bb09 100644 --- a/glib/gmacros.h +++ b/glib/gmacros.h @@ -482,9 +482,9 @@ typedef GList *_GLIB_AUTOPTR_LIST_TYPENAME(TypeName); \ typedef GSList *_GLIB_AUTOPTR_SLIST_TYPENAME(TypeName); \ G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ - static inline void _GLIB_AUTOPTR_FUNC_NAME(TypeName) (TypeName **_ptr) { if (*_ptr) (func) (*_ptr); } \ - static inline void _GLIB_AUTOPTR_LIST_FUNC_NAME(TypeName) (GList **_l) { g_list_free_full (*_l, (GDestroyNotify) func); } \ - static inline void _GLIB_AUTOPTR_SLIST_FUNC_NAME(TypeName) (GSList **_l) { g_slist_free_full (*_l, (GDestroyNotify) func); } \ + static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_FUNC_NAME(TypeName) (TypeName **_ptr) { if (*_ptr) (func) (*_ptr); } \ + static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_LIST_FUNC_NAME(TypeName) (GList **_l) { g_list_free_full (*_l, (GDestroyNotify) (void(*)(void)) func); } \ + static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_SLIST_FUNC_NAME(TypeName) (GSList **_l) { g_slist_free_full (*_l, (GDestroyNotify) (void(*)(void)) func); } \ G_GNUC_END_IGNORE_DEPRECATIONS #define G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(TypeName, func) \ G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ diff --git a/glib/tests/autoptr.c b/glib/tests/autoptr.c index 408f14b6c..c8c130d5c 100644 --- a/glib/tests/autoptr.c +++ b/glib/tests/autoptr.c @@ -1,6 +1,12 @@ #include <glib.h> #include <string.h> +typedef struct _HNVC HasNonVoidCleanup; +HasNonVoidCleanup * non_void_cleanup (HasNonVoidCleanup *); + +/* Should not cause any warnings with -Wextra */ +G_DEFINE_AUTOPTR_CLEANUP_FUNC(HasNonVoidCleanup, non_void_cleanup) + static void test_autofree (void) { |