diff mbox series

[07/11] pango: Don't turn clang 23's -Wunused-but-set-global into an error

Message ID 20260830125853.1139807-8-sunilkumar.dora@windriver.com
State New
Headers show
Series clang/llvm: Upgrade to 23.1.0 | expand

Commit Message

Dora, Sunil Kumar Aug. 30, 2026, 12:58 p.m. UTC
From: Sunil Dora <sunilkumar.dora@windriver.com>

clang 23 added -Wunused-but-set-global to the -Wunused-but-set-variable
group, which pango promotes to an error:

  pango/pango-fontset.c:36:1: error: variable 'pango_fontset_parent_class'
  set but not used [-Werror,-Wunused-but-set-global]

It fires on the parent_class variables emitted by GLib's G_DEFINE_TYPE
macros. Keep the warning visible but not fatal. gcc builds are
unaffected as meson only passes flags the compiler supports.

Reported upstream with patches attached: the meson change as pango
issue #900 and the underlying GLib macro fix as glib issue #4038.

Signed-off-by: Sunil Dora <sunilkumar.dora@windriver.com>
---
 ...ror-on-clang-s-unused-but-set-global.patch | 28 +++++++++++++++++++
 meta/recipes-graphics/pango/pango_1.58.0.bb   |  1 +
 2 files changed, 29 insertions(+)
 create mode 100644 meta/recipes-graphics/pango/pango/0001-meson-don-t-error-on-clang-s-unused-but-set-global.patch
diff mbox series

Patch

diff --git a/meta/recipes-graphics/pango/pango/0001-meson-don-t-error-on-clang-s-unused-but-set-global.patch b/meta/recipes-graphics/pango/pango/0001-meson-don-t-error-on-clang-s-unused-but-set-global.patch
new file mode 100644
index 0000000000..2c3788abdf
--- /dev/null
+++ b/meta/recipes-graphics/pango/pango/0001-meson-don-t-error-on-clang-s-unused-but-set-global.patch
@@ -0,0 +1,28 @@ 
+From: Sunil Dora <sunilkumar.dora@windriver.com>
+Date: Wed, 20 Aug 2026 10:45:00 +0530
+Subject: [PATCH] meson: don't error on clang's -Wunused-but-set-global
+
+clang 23 added -Wunused-but-set-global to the -Wunused-but-set-variable
+group, so the -Werror=unused-but-set-variable in test_cflags now turns
+it into an error. It fires on the <type>_parent_class variables that
+GLib's G_DEFINE_TYPE family of macros emit, which pango cannot fix, and
+on a few deliberately write-only globals in the test suite.
+
+Keep the warning visible but not fatal. gcc does not know this warning
+group, so cc.get_supported_arguments() drops the flag there.
+
+Upstream-Status: Submitted [https://gitlab.gnome.org/GNOME/pango/-/issues/900]
+Signed-off-by: Sunil Dora <sunilkumar.dora@windriver.com>
+---
+--- a/meson.build
++++ b/meson.build
+@@ -148,6 +148,9 @@
+     '-Werror=empty-body',
+     '-Werror=write-strings',
+     '-Werror=unused-but-set-variable',
++    # clang 23 made this part of the group above; it fires on GLib's
++    # G_DEFINE_TYPE boilerplate, which pango cannot fix.
++    '-Wno-error=unused-but-set-global',
+     '-Wundef', # FIXME: https://bugzilla.gnome.org/show_bug.cgi?id=792481
+   ]
+ 
diff --git a/meta/recipes-graphics/pango/pango_1.58.0.bb b/meta/recipes-graphics/pango/pango_1.58.0.bb
index 6e1aebad1d..0c9e26f39c 100644
--- a/meta/recipes-graphics/pango/pango_1.58.0.bb
+++ b/meta/recipes-graphics/pango/pango_1.58.0.bb
@@ -18,6 +18,7 @@  UPSTREAM_CHECK_REGEX = "pango-(?P<pver>\d+\.(?!9\d+)\d+\.\d+)"
 GIR_MESON_ENABLE_FLAG = "enabled"
 GIR_MESON_DISABLE_FLAG = "disabled"
 
+SRC_URI += "file://0001-meson-don-t-error-on-clang-s-unused-but-set-global.patch"
 SRC_URI[archive.sha256sum] = "bc5bad6213ad4886a47d1e80292fd850b64159b50db67917a43d9ea80ee2298a"
 
 DEPENDS = "glib-2.0 glib-2.0-native fontconfig freetype virtual/libiconv cairo harfbuzz fribidi"