Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Ross Burton <ross.burton@arm.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH] glib: backport patch to fix compile warnings with clang
Date: Wed,  9 Sep 2026 12:52:13 +0100	[thread overview]
Message-ID: <20260909115213.3002439-1-ross.burton@arm.com> (raw)

clang 23 added -Wunused-but-set-global, which fires on the
type_name##_parent_class variable that _G_DEFINE_TYPE_EXTENDED_BEGIN_PRE
emits whenever a type never chains up to its parent:

As this causes warnings in all builds which some projects (eg, pango)
then make fatal, backport the patch to silence this warning.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 ..._DEFINE_TYPE-parent_class-variable-a.patch | 44 +++++++++++++++++++
 meta/recipes-core/glib-2.0/glib.inc           |  1 +
 2 files changed, 45 insertions(+)
 create mode 100644 meta/recipes-core/glib-2.0/files/0001-gtype-Mark-the-G_DEFINE_TYPE-parent_class-variable-a.patch

diff --git a/meta/recipes-core/glib-2.0/files/0001-gtype-Mark-the-G_DEFINE_TYPE-parent_class-variable-a.patch b/meta/recipes-core/glib-2.0/files/0001-gtype-Mark-the-G_DEFINE_TYPE-parent_class-variable-a.patch
new file mode 100644
index 00000000000..642e02550bd
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/files/0001-gtype-Mark-the-G_DEFINE_TYPE-parent_class-variable-a.patch
@@ -0,0 +1,44 @@
+From 1567250294e9666747ee63f5c6364bbceadd300b Mon Sep 17 00:00:00 2001
+From: Sunil Dora <sunilkumar.dora@windriver.com>
+Date: Sun, 30 Aug 2026 11:39:28 +0530
+Subject: [PATCH] gtype: Mark the G_DEFINE_TYPE parent_class variable as unused
+
+clang 23 added -Wunused-but-set-global, which fires on the
+type_name##_parent_class variable that _G_DEFINE_TYPE_EXTENDED_BEGIN_PRE
+emits whenever a type never chains up to its parent:
+
+  error: variable 'my_thing_parent_class' set but not used
+  [-Werror,-Wunused-but-set-global]
+
+Projects that promote the unused-but-set group to an error (pango, for
+one) now fail to build with clang 23, and they cannot fix it on their
+side because the variable comes from this macro.
+
+Annotate it G_GNUC_UNUSED, the same treatment the adjacent
+get_instance_private helper already gets.
+
+Signed-off-by: Sunil Dora <sunilkumar.dora@windriver.com>
+Fixes: #4038
+
+Upstream-Status: Backport [1567250294e9666747ee63f5c6364bbceadd300b]
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+---
+ gobject/gtype.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gobject/gtype.h b/gobject/gtype.h
+index 1d383a8ea..de5188f9f 100644
+--- a/gobject/gtype.h
++++ b/gobject/gtype.h
+@@ -2295,7 +2295,7 @@ static void     type_name##_class_intern_init (gpointer klass) \
+ static void     type_name##_init              (TypeName        *self); \
+ static void     type_name##_class_init        (TypeName##Class *klass); \
+ static GType    type_name##_get_type_once     (void); \
+-static gpointer type_name##_parent_class = NULL; \
++G_GNUC_UNUSED static gpointer type_name##_parent_class = NULL; \
+ static gint     TypeName##_private_offset; \
+ \
+ _G_DEFINE_TYPE_EXTENDED_CLASS_INIT(TypeName, type_name) \
+-- 
+2.43.0
+
diff --git a/meta/recipes-core/glib-2.0/glib.inc b/meta/recipes-core/glib-2.0/glib.inc
index 903d56e05fb..d80cf6f2671 100644
--- a/meta/recipes-core/glib-2.0/glib.inc
+++ b/meta/recipes-core/glib-2.0/glib.inc
@@ -239,6 +239,7 @@ SRC_URI += "\
            file://CVE-2026-58016-1.patch \
            file://CVE-2026-58016-2.patch \
            file://0001-gio-tests-services-Fix-installed-service-file-using-.patch \
+           file://0001-gtype-Mark-the-G_DEFINE_TYPE-parent_class-variable-a.patch \
            "
 SRC_URI:append:class-native = " file://relocate-modules.patch \
                                 file://0001-meson.build-do-not-enable-pidfd-features-on-native-g.patch \
-- 
2.43.0



                 reply	other threads:[~2026-09-09 11:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260909115213.3002439-1-ross.burton@arm.com \
    --to=ross.burton@arm.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox