vcl/unx/gtk4/a11y.cxx | 16 ++++++++++++++++ vcl/unx/gtk4/a11y.hxx | 2 -- 2 files changed, 16 insertions(+), 2 deletions(-)
New commits: commit 552a0a0e4daaac6896995b1ce63a44df6582ade2 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Wed Dec 20 10:45:39 2023 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Wed Dec 20 17:37:27 2023 +0100 gtk4 a11y: Silence loplugin:unreffun a different way Including the `a11y.hxx` header in another source file would result in an `--enable-werror` gcc 13.2.0-7 build on Debian testing failing like this (real use case is in a following commit, but this is also reproducible by including the header in `vcl/unx/gtk4/gtkaccessibleeventlistener.cxx`): In file included from .../vcl/unx/gtk4/gtkaccessibleeventlistener.cxx:15: .../vcl/unx/gtk4/a11y.hxx:19:24: error: ‘void* lo_accessible_get_instance_private(LoAccessible*)’ declared ‘static’ but never defined [-Werror=unused-function] 19 | static inline gpointer lo_accessible_get_instance_private(LoAccessible*); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .../vcl/unx/gtk4/a11y.hxx:21:24: error: ‘void* ooo_fixed_get_instance_private(OOoFixed*)’ declared ‘static’ but never defined [-Werror=unused-function] 21 | static inline gpointer ooo_fixed_get_instance_private(OOoFixed*); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1plus: all warnings being treated as errors make[1]: *** [.../solenv/gbuild/LinkTarget.mk:337: .../workdir/CxxObject/vcl/unx/gtk4/gtkaccessibleeventlistener.o] Error 1 make: *** [Makefile:290: build] Error 2 However, just removing the declarations would make loplugin:unreffun unhappy: .../vcl/unx/gtk4/a11y.cxx:568:1: error: Unreferenced externally invisible function definition [loplugin:unreffun] G_DEFINE_TYPE_WITH_CODE(LoAccessible, lo_accessible, G_TYPE_OBJECT, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/glib-2.0/gobject/gtype.h:1842:56: note: expanded from macro 'G_DEFINE_TYPE_WITH_CODE' #define G_DEFINE_TYPE_WITH_CODE(TN, t_n, T_P, _C_) _G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, 0) {_C_;} _G_DEFINE_TYPE_EXTENDED_END() ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/glib-2.0/gobject/gtype.h:2325:3: note: expanded from macro '_G_DEFINE_TYPE_EXTENDED_BEGIN' _G_DEFINE_TYPE_EXTENDED_BEGIN_PRE(TypeName, type_name, TYPE_PARENT) \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/glib-2.0/gobject/gtype.h:2280:24: note: expanded from macro '_G_DEFINE_TYPE_EXTENDED_BEGIN_PRE' static inline gpointer \ ~~~~~~~~~~~~~~~~~~~~~~~^ <scratch space>:101:1: note: expanded from here lo_accessible_get_instance_private ^ .../vcl/unx/gtk4/a11y.cxx:857:1: error: Unreferenced externally invisible function definition [loplugin:unreffun] G_DEFINE_TYPE_WITH_CODE(OOoFixed, ooo_fixed, GTK_TYPE_FIXED, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/glib-2.0/gobject/gtype.h:1842:56: note: expanded from macro 'G_DEFINE_TYPE_WITH_CODE' #define G_DEFINE_TYPE_WITH_CODE(TN, t_n, T_P, _C_) _G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, 0) {_C_;} _G_DEFINE_TYPE_EXTENDED_END() ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/glib-2.0/gobject/gtype.h:2325:3: note: expanded from macro '_G_DEFINE_TYPE_EXTENDED_BEGIN' _G_DEFINE_TYPE_EXTENDED_BEGIN_PRE(TypeName, type_name, TYPE_PARENT) \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/glib-2.0/gobject/gtype.h:2280:24: note: expanded from macro '_G_DEFINE_TYPE_EXTENDED_BEGIN_PRE' static inline gpointer \ ~~~~~~~~~~~~~~~~~~~~~~~^ <scratch space>:131:1: note: expanded from here ooo_fixed_get_instance_private ^ 2 errors generated. make[1]: *** [.../solenv/gbuild/LinkTarget.mk:337: .../workdir/CxxObject/vcl/unx/gtk4/a11y.o] Error 1 make: *** [Makefile:290: build] Error 2 Silence these 2 loplugin:unreffun errors using a different approach instead, as suggested by Stephan Bergmann in [1]. [1] https://gerrit.libreoffice.org/c/core/+/161060/comments/3e6ccbd5_87243200 Change-Id: I4c3a1c34bfaa5ac6c306881e3caff2e04d6992dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161060 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/vcl/unx/gtk4/a11y.cxx b/vcl/unx/gtk4/a11y.cxx index 2b5e64e03947..4107c7ff0b79 100644 --- a/vcl/unx/gtk4/a11y.cxx +++ b/vcl/unx/gtk4/a11y.cxx @@ -565,8 +565,16 @@ static void lo_accessible_range_init(GtkAccessibleRangeInterface* iface) } #endif +// silence loplugin:unreffun +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-function" +#endif G_DEFINE_TYPE_WITH_CODE(LoAccessible, lo_accessible, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE(GTK_TYPE_ACCESSIBLE, lo_accessible_accessible_init)) +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif static void lo_accessible_class_init(LoAccessibleClass* klass) { @@ -854,8 +862,16 @@ static void ooo_fixed_accessible_init(GtkAccessibleInterface* iface) // iface->get_platform_state = get_platform_state; } +// silence loplugin:unreffun +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-function" +#endif G_DEFINE_TYPE_WITH_CODE(OOoFixed, ooo_fixed, GTK_TYPE_FIXED, G_IMPLEMENT_INTERFACE(GTK_TYPE_ACCESSIBLE, ooo_fixed_accessible_init)) +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif static void ooo_fixed_class_init(OOoFixedClass* /*klass*/) {} diff --git a/vcl/unx/gtk4/a11y.hxx b/vcl/unx/gtk4/a11y.hxx index 90711515bceb..3b2e9ce02714 100644 --- a/vcl/unx/gtk4/a11y.hxx +++ b/vcl/unx/gtk4/a11y.hxx @@ -16,9 +16,7 @@ struct LoAccessible; struct LoAccessibleClass; struct OOoFixed; struct OOoFixedClass; -static inline gpointer lo_accessible_get_instance_private(LoAccessible*); GType lo_accessible_get_type(); -static inline gpointer ooo_fixed_get_instance_private(OOoFixed*); GtkWidget* ooo_fixed_new(); /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */