From d58be1bda9b270a618f341bf7d9b0dd88702482c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 23 Oct 2018 18:02:03 -0500 Subject: [PATCH] gmacros: make _GLIB_DEFINE_AUTOPTR_CHAINUP to define funcs for g_autolist Also chainup to glib_(s)listautoptr_cleanup_* parent functions to make g_autolist work with object defined in this way --- glib/gmacros.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/glib/gmacros.h b/glib/gmacros.h index 1f5788020..28a01a33f 100644 --- a/glib/gmacros.h +++ b/glib/gmacros.h @@ -497,9 +497,17 @@ #define _GLIB_AUTO_FUNC_NAME(TypeName) glib_auto_cleanup_##TypeName #define _GLIB_CLEANUP(func) __attribute__((cleanup(func))) #define _GLIB_DEFINE_AUTOPTR_CHAINUP(ModuleObjName, ParentName) \ - typedef ModuleObjName *_GLIB_AUTOPTR_TYPENAME(ModuleObjName); \ - static inline void _GLIB_AUTOPTR_FUNC_NAME(ModuleObjName) (ModuleObjName **_ptr) { \ - _GLIB_AUTOPTR_FUNC_NAME(ParentName) ((ParentName **) _ptr); } \ + typedef ModuleObjName *_GLIB_AUTOPTR_TYPENAME(ModuleObjName); \ + typedef GList *_GLIB_AUTOPTR_LIST_TYPENAME(ModuleObjName); \ + typedef GSList *_GLIB_AUTOPTR_SLIST_TYPENAME(ModuleObjName); \ + G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ + static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_FUNC_NAME(ModuleObjName) (ModuleObjName **_ptr) { \ + _GLIB_AUTOPTR_FUNC_NAME(ParentName) ((ParentName **) _ptr); } \ + static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_LIST_FUNC_NAME(ModuleObjName) (GList **_l) { \ + _GLIB_AUTOPTR_LIST_FUNC_NAME(ParentName) (_l); } \ + static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_SLIST_FUNC_NAME(ModuleObjName) (GSList **_l) { \ + _GLIB_AUTOPTR_SLIST_FUNC_NAME(ParentName) (_l); } \ + G_GNUC_END_IGNORE_DEPRECATIONS \ /* these macros are API */