Skip to contentSkip to conversation

Use glib 2.26 version macros

PATCH Applied [email protected] 8 participants 14 messages Oct 12, 2015 – Oct 29, 2015

lore
Share & tools
lore
#0 lore raw

cover Use glib 2.26 version macros

From: Marc-André Lureau <[email protected]>

Bump glib requirement to be able to use the GLIB_VERSION macros.

Marc-André Lureau (3):
hw/acpi/aml-build: remove useless glib version check
configure: require glib 2.26
Remove glib < 2.26 compatibility code

 configure               | 5 +++--
 hw/acpi/aml-build.c     | 2 --
 include/glib-compat.h   | 4 ----
 tests/vhost-user-test.c | 4 ----
 4 files changed, 3 insertions(+), 12 deletions(-)
Signature · 1 line
2.4.3
#1 lore raw

PATCH 1/3 hw/acpi/aml-build: remove useless glib version check

From: Marc-André Lureau <[email protected]>

2.22 is the minimum version required

---
 hw/acpi/aml-build.c | 2 --
 1 file changed, 2 deletions(-)
hw/acpi/aml-build.c +0 -2
index 0d4b324..a00a0ab 100644
@@ -1163,9 +1163,7 @@ void *acpi_data_push(GArray *table_data, unsigned size)
 
 unsigned acpi_data_len(GArray *table)
 {
-#if GLIB_CHECK_VERSION(2, 22, 0)
     assert(g_array_get_element_size(table) == 1);
-#endif
     return table->len;
 }
 
Signature · 1 line
2.4.3
#2 lore raw

Re: [Qemu-devel] [PATCH 1/3] hw/acpi/aml-build: remove useless glib version check

to qemu-trivial

Quoted 26 lines · On Mon, Oct 12, 2015 at 12:54 PM, <[email protected]> wrote:

From: Marc-André Lureau <[email protected]>

2.22 is the minimum version required

---
 hw/acpi/aml-build.c | 2 --
 1 file changed, 2 deletions(-)
hw/acpi/aml-build.c +0 -3
index 0d4b324..a00a0ab 100644
@@ -1163,9 +1163,7 @@ void *acpi_data_push(GArray *table_data, unsigned size)
 
 unsigned acpi_data_len(GArray *table)
 {
-#if GLIB_CHECK_VERSION(2, 22, 0)
     assert(g_array_get_element_size(table) == 1);
-#endif
     return table->len;
 }
 
--

2.4.3

Signature · 1 line
Marc-André Lureau
#3 lore raw

Re: [Qemu-devel] [PATCH 1/3] hw/acpi/aml-build: remove useless glib version check

Quoted 6 lines · Marc-André Lureau

to qemu-trivial

Quoted 3 lines · On Mon, Oct 12, 2015 at 12:54 PM, <[email protected]> wrote:

From: Marc-André Lureau <[email protected]>

2.22 is the minimum version required

Applied to -trivial, thank you!

/mjt

#4 lore raw

PATCH 2/3 configure: require glib 2.26

In reply to [email protected]

From: Marc-André Lureau <[email protected]>

This allows to use the GLIB_VERSION macros that will help to ensure the newer symbols are not being used (or with compatibility code).

---
 configure | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
configure +3 -2
index f08327e..1bc832f 100755
@@ -2843,7 +2843,8 @@ fi
 ##########################################
 # glib support probe
 
-glib_req_ver=2.22
+glib_req_ver=2.26
+glib_ver=GLIB_VERSION_2_26
 glib_modules=gthread-2.0
 if test "$modules" = yes; then
     glib_modules="$glib_modules gmodule-2.0"
@@ -2853,7 +2854,7 @@ for i in $glib_modules; do
     if $pkg_config --atleast-version=$glib_req_ver $i; then
         glib_cflags=`$pkg_config --cflags $i`
         glib_libs=`$pkg_config --libs $i`
-        CFLAGS="$glib_cflags $CFLAGS"
+        CFLAGS="$glib_cflags $CFLAGS -DGLIB_VERSION_MIN_REQUIRED=$glib_ver -DGLIB_VERSION_MAX_ALLOWED=$glib_ver"
         LIBS="$glib_libs $LIBS"
         libs_qga="$glib_libs $libs_qga"
     else
Signature · 1 line
2.4.3
#5 lore raw

PATCH 3/3 Remove glib < 2.26 compatibility code

In reply to [email protected]

From: Marc-André Lureau <[email protected]>

Since 2.26 is now the minimum.

---
 include/glib-compat.h   | 4 ----
 tests/vhost-user-test.c | 4 ----
 2 files changed, 8 deletions(-)
include/glib-compat.h +0 -4
index 318e000..46a2bc5 100644
@@ -19,10 +19,6 @@
 #include <glib.h>
 
 /* GLIB version compatibility flags */
-#if !GLIB_CHECK_VERSION(2, 26, 0)
-#define G_TIME_SPAN_SECOND              (G_GINT64_CONSTANT(1000000))
-#endif
-
 #if !GLIB_CHECK_VERSION(2, 28, 0)
 static inline gint64 qemu_g_get_monotonic_time(void)
 {
tests/vhost-user-test.c +0 -4
index 56df5cc..9f2254d 100644
@@ -21,10 +21,6 @@
 #include <qemu/sockets.h>
 
 /* GLIB version compatibility flags */
-#if !GLIB_CHECK_VERSION(2, 26, 0)
-#define G_TIME_SPAN_SECOND              (G_GINT64_CONSTANT(1000000))
-#endif
-
 #if GLIB_CHECK_VERSION(2, 28, 0)
 #define HAVE_MONOTONIC_TIME
 #endif
Signature · 1 line
2.4.3
#6 lore raw
In reply to [email protected]
Quoted 9 lines · On Mon, 12 Oct 2015 12:54:56 +0200 [email protected] wrote:

From: Marc-André Lureau <[email protected]>

Bump glib requirement to be able to use the GLIB_VERSION macros.

Marc-André Lureau (3):
hw/acpi/aml-build: remove useless glib version check
configure: require glib 2.26
Remove glib < 2.26 compatibility code

Quoted 6 lines
 configure               | 5 +++--
 hw/acpi/aml-build.c     | 2 --
 include/glib-compat.h   | 4 ----
 tests/vhost-user-test.c | 4 ----
 4 files changed, 3 insertions(+), 12 deletions(-)

Apologies if I missed some discussions, but isn't SLES 11 still at 2.22? (The SLES 11 system I used has been upgraded to SLES 12, so I can't check myself.)

Do we still aim to be able to build on any still-supported enterprise distro?

#7 lore raw
In reply to [email protected]
Quoted 3 lines · On Mon, Oct 12, 2015 at 12:54:56PM +0200, [email protected] wrote:

From: Marc-André Lureau <[email protected]>

Bump glib requirement to be able to use the GLIB_VERSION macros.

We had a discussion about glib min version a few months back where it was decided 2.22 was the maximum we could use at the current time without us loosing support for certain platforms we care about.

Simply being able to use the GLIB_VERSION macro does not seem like a compelling enough reason to re-vist this min version again right now, as I doubt we've changed our mind on what platforms we wish to target in the last couple of months.

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#8 lore raw

Hi

Quoted 5 lines · Daniel P. Berrange
Quoted 3 lines · On Mon, Oct 12, 2015 at 12:54:56PM +0200, [email protected] wrote:

From: Marc-André Lureau <[email protected]>

Bump glib requirement to be able to use the GLIB_VERSION macros.

Quoted 8 lines

We had a discussion about glib min version a few months back where it was decided 2.22 was the maximum we could use at the current time without us loosing support for certain platforms we care about.

Simply being able to use the GLIB_VERSION macro does not seem like a compelling enough reason to re-vist this min version again right now, as I doubt we've changed our mind on what platforms we wish to target in the last couple of months.

Fair enough, I couldn't find the discussion where 2.22 was decided to be the maximum requirement, but SLES11 seems to be the reason then.

What about just using the macro, but not bumping glib requirement?

Quoted 9 lines

Regards,
Daniel
--

|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
Signature · 1 line
Marc-André Lureau
#9 lore raw
Quoted 17 lines · Marc-André Lureau

Hi

Quoted 5 lines · Daniel P. Berrange
Quoted 3 lines · On Mon, Oct 12, 2015 at 12:54:56PM +0200, [email protected] wrote:

From: Marc-André Lureau <[email protected]>

Bump glib requirement to be able to use the GLIB_VERSION macros.

Quoted 8 lines

We had a discussion about glib min version a few months back where it was decided 2.22 was the maximum we could use at the current time without us loosing support for certain platforms we care about.

Simply being able to use the GLIB_VERSION macro does not seem like a compelling enough reason to re-vist this min version again right now, as I doubt we've changed our mind on what platforms we wish to target in the last couple of months.

Quoted 4 lines

Fair enough, I couldn't find the discussion where 2.22 was decided to be the maximum requirement, but SLES11 seems to be the reason then.

What about just using the macro, but not bumping glib requirement?

It would be desirable - I think someone explored using the GLIB_VERSION macros before, without bumping version. I can't remember what the problem was that made them abandon that though - maybe someone else recalls...

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#10 lore raw
Quoted 6 lines · Daniel P. Berrange
Quoted 1 line · Marc-André Lureau

What about just using the macro, but not bumping glib requirement?

It would be desirable - I think someone explored using the GLIB_VERSION macros before, without bumping version. I can't remember what the problem was that made them abandon that though - maybe someone else recalls...

I think that was David Gilbert, and I vaguely recall there being bad interactions with our glib-compat.h header.

-- PMM

#11 lore raw
Quoted 4 lines · Peter Maydell
Quoted 3 lines · Daniel P. Berrange
Quoted 1 line · Marc-André Lureau

What about just using the macro, but not bumping glib requirement?

Quoted 9 lines
Quoted 3 lines

It would be desirable - I think someone explored using the GLIB_VERSION macros before, without bumping version. I can't remember what the problem was that made them abandon that though - maybe someone else recalls...

I think that was David Gilbert, and I vaguely recall there being bad interactions with our glib-compat.h header.

-- PMM

The version check macros will complain about our back-porting of glib functions as seen in glib-compat, yes. I think David Gilbert and I each had a stab at it.

It's fine if you're running 2.22 or so, but if you are running a more modern version that actually provides the functions we backport/emulate, the version check macros will catch that and set an error.

Not sure if there's some sort of squelch mechanism. "I know I told you to complain if I use a 2.23+ function, but forgive me just this once."

--js

#12 lore raw
In reply to Peter Maydell
Quoted 10 lines · * Peter Maydell ([email protected]) wrote:
Quoted 6 lines · Daniel P. Berrange
Quoted 1 line · Marc-André Lureau

What about just using the macro, but not bumping glib requirement?

It would be desirable - I think someone explored using the GLIB_VERSION macros before, without bumping version. I can't remember what the problem was that made them abandon that though - maybe someone else recalls...

I think that was David Gilbert, and I vaguely recall there being bad interactions with our glib-compat.h header.

My notes and memory are both somewhat fuzzy on it.

I think that the GLIB_VERSION_MIN/MAX macros only went in in 2.32 but then once you have them they offer a range allowing you to state you need a minimum of 2.26; so if we bump the minimum to 2.26 then becareful to check it still works at that.

The interaction of stuff that includes glib.h and others that include glib-compat.h was messy; I was working on the assumption that stuff that included glib-compat.h knew it was using newer things and didn't expect a warning; the problem that Peter pointed out was that glib-compat gets included by qemu-common so actually the warnings get disabled in loads of places.

Dave

Quoted 2 lines

-- PMM

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#13 lore raw
Quoted 6 lines · Dr. David Alan Gilbert

The interaction of stuff that includes glib.h and others that include glib-compat.h was messy; I was working on the assumption that stuff that included glib-compat.h knew it was using newer things and didn't expect a warning; the problem that Peter pointed out was that glib-compat gets included by qemu-common so actually the warnings get disabled in loads of places.

Yep; I also want glib-compat to be included by osdep.h and every .c file to include osdep.h, at which point every source file ends up including it.

-- PMM