1 Star 0 Fork 71

章北海/libvirt

forked from src-openEuler/libvirt 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
src-workaround-warning-triggered-in-glib-2.69.patch 2.17 KB
一键复制 编辑 原始数据 按行查看 历史
yezengruan 提交于 2022-06-13 14:09 . update patch with openeuler !62!63
From a5566155554ce8a43b1912188ae0879cfe2a26ad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Date: Fri, 23 Jul 2021 13:41:02 +0100
Subject: [PATCH] src: workaround warning triggered in glib 2.69
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Libvirt is using the G_GNUC_FALLTHROUGH macro provided by glib since
version 2.60. Since we need to support older glib, we also have some
compatibility code to define it if missing.
We set the GLIB_VERSION_MAX_ALLOWED macro to ensure we get warnings
when we use an API that dates from a glib version newer than our
minimum benchmark. Historically this didn't get enforced for (most)
macros, but GLib 2.69 has addressed that gap.
This causes our usage of G_GNUC_FALLTHROUGH to trigger warnings.
GLib is right to warn, because it does not know that we have added
our own fallback for older versions.
The only way to squelch this warning though, is to fully undefine
the GLib provided G_GNUC_FALLTHROUGH and use our own in its place.
We'll be able to remove all this compat burden when we finally
update the min glib version to be >= 2.60
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
src/internal.h | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/internal.h b/src/internal.h
index 0a03dfc46f..e1250a59fe 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -147,8 +147,17 @@
*
* silence the compiler warning when falling through a switch case
*
- * TODO: Remove after upgrading to GLib >= 2.60
+ * Note: GLib 2.69.0 introduced version checks on the
+ * macro usage. Thus an app setting GLIB_VERSION_MAX_ALLOWED
+ * to less than 2.60 will trigger a warning using G_GNUC_FALLTHROUGH
+ * Normally the warning is a good thing, but we want to use our
+ * fallback impl, so we have to temporarily cull the GLib macro.
+ *
+ * All this should be removed once updating to min GLib >= 2.60
*/
+#if GLIB_CHECK_VERSION(2, 69, 0)
+# undef G_GNUC_FALLTHROUGH
+#endif
#ifndef G_GNUC_FALLTHROUGH
# if __GNUC_PREREQ (7, 0)
# define G_GNUC_FALLTHROUGH __attribute__((fallthrough))
--
2.27.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/dependent/libvirt.git
git@gitee.com:dependent/libvirt.git
dependent
libvirt
libvirt
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385