[glib: 1/3] gmacros: Add G_GNUC_UNUSED for autoptr funcs (notably GLists)
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/3] gmacros: Add G_GNUC_UNUSED for autoptr funcs (notably GLists)
- Date: Fri, 25 May 2018 13:14:25 +0000 (UTC)
commit b41bff1fe928a530ac63601deca8f87cb2e062f8
Author: Colin Walters <walters verbum org>
Date: Tue May 22 21:00:04 2018 +0000
gmacros: Add G_GNUC_UNUSED for autoptr funcs (notably GLists)
In commit f49a93b20761a0be51b22c481503b4cda0f7264f
from bug https://bugzilla.gnome.org/show_bug.cgi?id=791342
we added two new static inline cleanup helpers in case a type was
used inside a list.
These functions will commonly be unused.
In rpm-ostree, we run a build using `CC=clang -Werror=unused` because
it catches `g_autofree char *foo = NULL;` as unused, but GCC doesn't.
When trying to update to F28 with a newer glib, our CI fell over on this.
Mark all of the autocleanups as "maybe unused".
glib/gmacros.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/glib/gmacros.h b/glib/gmacros.h
index 55fb81e5b..03876d8ce 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) func); } \
+ static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_SLIST_FUNC_NAME(TypeName) (GSList **_l) { g_slist_free_full
(*_l, (GDestroyNotify) func); } \
G_GNUC_END_IGNORE_DEPRECATIONS
#define G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(TypeName, func) \
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
\
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]