mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-10-15 06:17:16 +00:00
libosinfo: Do not error on clang's -Wunused-but-set-global
clang 23 added -Wunused-but-set-global to the -Wunused warning group, so
the -Werror that meson.build adds for git builds turns it into a hard
error:
osinfo/osinfo_avatar_format.c:24:1: error: variable
'osinfo_avatar_format_parent_class' set but not used
[-Werror,-Wunused-but-set-global]
Add -Wno-error=unused-but-set-global to libosinfo_check_cflags so the
warning stays visible but is not fatal. The flag is placed in the list
that meson.build filters through compiler.has_argument(), so it is
dropped on compilers that do not know the warning group
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
This commit is contained in:
2 files changed
+46
No files matched your search
+45
@@ -0,0 +1,45 @@
|
||||
From ab54bb415451f0b85207867ae2d68c5dcf1a191c Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <khem.raj@oss.qualcomm.com>
|
||||
Date: Mon, 7 Sep 2026 18:39:42 -0700
|
||||
Subject: [PATCH] meson: don't error on clang's -Wunused-but-set-global
|
||||
|
||||
clang 23 added -Wunused-but-set-global to the -Wunused warning group, so
|
||||
the -Werror that meson.build adds for git builds now turns it into a hard
|
||||
error:
|
||||
|
||||
osinfo/osinfo_avatar_format.c:24:1: error: variable
|
||||
'osinfo_avatar_format_parent_class' set but not used
|
||||
[-Werror,-Wunused-but-set-global]
|
||||
|
||||
It fires on the <type>_parent_class variables that GLib's G_DEFINE_TYPE
|
||||
family of macros emit, which libosinfo cannot fix, and on the write-only
|
||||
'format' global in tools/osinfo-detect.c.
|
||||
|
||||
Keep the warning visible but not fatal. gcc does not know this warning
|
||||
group and rejects the flag outright, so compiler.has_argument() drops it
|
||||
there.
|
||||
|
||||
Upstream-Status: Pending
|
||||
|
||||
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
|
||||
---
|
||||
meson.build | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/meson.build b/meson.build
|
||||
index 377539d..7fd9de7 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -246,6 +246,12 @@ if compiler.get_id() == 'clang'
|
||||
libosinfo_check_cflags += [
|
||||
'-Wno-typedef-redefinition',
|
||||
'-Wno-missing-field-initializers',
|
||||
+ # clang 23 added -Wunused-but-set-global to the -Wunused group. It
|
||||
+ # fires on the <type>_parent_class variables that GLib's G_DEFINE_TYPE
|
||||
+ # family of macros emit, which libosinfo cannot fix, and on the
|
||||
+ # deliberately write-only 'format' global in osinfo-detect.
|
||||
+ # Keep the warning visible but not fatal.
|
||||
+ '-Wno-error=unused-but-set-global',
|
||||
]
|
||||
endif
|
||||
|
||||
@@ -9,6 +9,7 @@ SRC_URI = " \
|
||||
git://gitlab.com/libosinfo/libosinfo.git;branch=main;protocol=https \
|
||||
file://0001-meson.build-allow-crosscompiling-gir.patch \
|
||||
file://0adf38535637ec668e658d43f04f60f11f51574f.patch \
|
||||
file://0002-meson-don-t-error-on-clang-s-unused-but-set-global.patch \
|
||||
"
|
||||
|
||||
SRCREV = "b505ef5161d2552102a743acd4ad83298d3d8f99"
|
||||
|
||||
Reference in new issue
Block a user