[glib PATCH 2/2] Set desired glib min/max API versions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Setting GLIB_VERSION_MAX_ALLOWED ensures we get warnings if
we use APIs that are newer than our declared minimum glib
version.

Setting GLIB_VERSION_MIN_REQUIRED ensures that we get
warnings if we use APIs deprecated in versions preceeding
this.

If the latter is omitted then we get warnings for all
deprecations in glib, which is undesirable if we want to
keep compat with older versions.

This avoids a build error with latest glib

  ./../libvirt-gconfig/libvirt-gconfig-capabilities-cpu-model.c: In function 'gvir_config_capabilities_cpu_model_init':
  ../../libvirt-gconfig/libvirt-gconfig-capabilities-cpu-model.c:44:13: error: G_ADD_PRIVATE [-Werror]
     44 |     model->priv = GVIR_CONFIG_CAPABILITIES_CPU_MODEL_GET_PRIVATE(model);
        |             ^~~~~~~~~~~~~~~

Caused by G_TYPE_INSTANCE_GET_PRIVATE being deprecated.

Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
 configure.ac                | 2 ++
 libvirt-gconfig/Makefile.am | 2 ++
 libvirt-glib/Makefile.am    | 2 ++
 libvirt-gobject/Makefile.am | 2 ++
 4 files changed, 8 insertions(+)

diff --git a/configure.ac b/configure.ac
index 6b66f5d..bf4d39c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -13,6 +13,8 @@ LIBVIRT_REQUIRED=1.2.5
 AC_SUBST([LIBVIRT_REQUIRED]) dnl used in the .spec file
 GLIB2_REQUIRED=2.38.0
 AC_SUBST([GLIB2_REQUIRED]) dnl used in the .spec file
+GLIB2_VERSION_SYMBOL="GLIB_VERSION_2_38"
+AC_SUBST([GLIB2_VERSION_SYMBOL]) dnl sets glib deprecations
 GOBJECT_INTROSPECTION_REQUIRED=1.36.0
 LIBXML2_REQUIRED=2.0.0
 
diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index 089b42a..daa4239 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -209,6 +209,8 @@ libvirt_gconfig_1_0_la_CFLAGS = \
 			-DG_LOG_DOMAIN="\"Libvirt.GConfig\"" \
 			-DDATADIR="\"$(datadir)\"" \
 			-DLIBVIRT_GCONFIG_BUILD \
+			-DGLIB_VERSION_MIN_REQUIRED=$(GLIB2_VERSION_SYMBOL) \
+			-DGLIB_VERSION_MAX_ALLOWED=$(GLIB2_VERSION_SYMBOL) \
 			$(COVERAGE_CFLAGS) \
 			-I$(top_srcdir) \
 			-I$(top_builddir) \
diff --git a/libvirt-glib/Makefile.am b/libvirt-glib/Makefile.am
index fa52352..1cc145a 100644
--- a/libvirt-glib/Makefile.am
+++ b/libvirt-glib/Makefile.am
@@ -16,6 +16,8 @@ libvirt_glib_1_0_la_SOURCES = \
 			libvirt-glib-main.c
 libvirt_glib_1_0_la_CFLAGS = \
 			-DLIBVIRT_GLIB_BUILD \
+			-DGLIB_VERSION_MIN_REQUIRED=$(GLIB2_VERSION_SYMBOL) \
+			-DGLIB_VERSION_MAX_ALLOWED=$(GLIB2_VERSION_SYMBOL) \
 			-DGETTEXT_PACKAGE="\"libvirt-glib\"" \
 			-DG_LOG_DOMAIN="\"Libvirt.GLib\"" \
 			-DLOCALEDIR="\"$(datadir)/locale\"" \
diff --git a/libvirt-gobject/Makefile.am b/libvirt-gobject/Makefile.am
index 210c753..b03d8f5 100644
--- a/libvirt-gobject/Makefile.am
+++ b/libvirt-gobject/Makefile.am
@@ -70,6 +70,8 @@ libvirt_gobject_1_0_la_CFLAGS = \
 			-DG_LOG_DOMAIN="\"Libvirt.GObject\"" \
 			-DDATADIR="\"$(datadir)\"" \
 			-DLIBVIRT_GOBJECT_BUILD \
+			-DGLIB_VERSION_MIN_REQUIRED=$(GLIB2_VERSION_SYMBOL) \
+			-DGLIB_VERSION_MAX_ALLOWED=$(GLIB2_VERSION_SYMBOL) \
 			$(COVERAGE_CFLAGS) \
 			-I$(top_srcdir) \
 			-I$(top_builddir) \
-- 
2.23.0.rc2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux