[glib: 2/3] gmacros: mark functions generated by autoptr macros as unused
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 2/3] gmacros: mark functions generated by autoptr macros as unused
- Date: Fri, 13 Sep 2019 10:59:51 +0000 (UTC)
commit 6971528f65d643f24583697751a817a92ef19bcc
Author: Matthew Waters <matthew centricular com>
Date: Wed Aug 28 18:05:49 2019 +1000
gmacros: mark functions generated by autoptr macros as unused
clang will warn with -Wunused-function if the g_autoptr macros are
ever used inside a .c file. This would break a lot of -Werror builds
with clang.
Mark such functions as explicitly unsed so clang will not warn about
them.
glib/gmacros.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/glib/gmacros.h b/glib/gmacros.h
index 79077e23b..4dad64dc0 100644
--- a/glib/gmacros.h
+++ b/glib/gmacros.h
@@ -1061,11 +1061,11 @@
_GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS(TypeName, TypeName, func)
#define G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(TypeName, func) \
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
\
- static inline void _GLIB_AUTO_FUNC_NAME(TypeName) (TypeName *_ptr) { (func) (_ptr); }
\
+ static G_GNUC_UNUSED inline void _GLIB_AUTO_FUNC_NAME(TypeName) (TypeName *_ptr) { (func) (_ptr); }
\
G_GNUC_END_IGNORE_DEPRECATIONS
#define G_DEFINE_AUTO_CLEANUP_FREE_FUNC(TypeName, func, none) \
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
\
- static inline void _GLIB_AUTO_FUNC_NAME(TypeName) (TypeName *_ptr) { if (*_ptr != none) (func) (*_ptr); }
\
+ static G_GNUC_UNUSED inline void _GLIB_AUTO_FUNC_NAME(TypeName) (TypeName *_ptr) { if (*_ptr != none)
(func) (*_ptr); } \
G_GNUC_END_IGNORE_DEPRECATIONS
#define g_autoptr(TypeName) _GLIB_CLEANUP(_GLIB_AUTOPTR_FUNC_NAME(TypeName)) _GLIB_AUTOPTR_TYPENAME(TypeName)
#define g_autolist(TypeName) _GLIB_CLEANUP(_GLIB_AUTOPTR_LIST_FUNC_NAME(TypeName))
_GLIB_AUTOPTR_LIST_TYPENAME(TypeName)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]