[virt-tools-list] [virt-viewer v2 1/5] Use GLIB_VERSION_MAX_ALLOWED

Fabiano Fidêncio fabiano at fidencio.org
Wed Feb 24 08:27:20 UTC 2016


On Wed, Feb 24, 2016 at 8:47 AM, Fabiano Fidêncio <fabiano at fidencio.org> wrote:
> On Wed, Feb 24, 2016 at 8:42 AM, Pavel Grunt <pgrunt at redhat.com> wrote:
>> On Wed, 2016-02-24 at 08:33 +0100, Fabiano Fidêncio wrote:
>>> On Wed, Feb 24, 2016 at 8:26 AM, Pavel Grunt <pgrunt at redhat.com>
>>> wrote:
>>> >
>>> > On Wed, 2016-02-24 at 08:04 +0100, Fabiano Fidêncio wrote:
>>> > >
>>> > > In order to avoid using a too new GLib API.
>>> > >
>>> > > Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
>>> > > ---
>>> > >  acinclude.m4 |  2 +-
>>> > >  configure.ac | 10 +++++++++-
>>> > >  2 files changed, 10 insertions(+), 2 deletions(-)
>>> > >
>>> > > diff --git a/acinclude.m4 b/acinclude.m4
>>> > > index a9561c4..30d5cc1 100644
>>> > > --- a/acinclude.m4
>>> > > +++ b/acinclude.m4
>>> > > @@ -34,7 +34,7 @@ AC_DEFUN([VIRT_VIEWER_COMPILE_WARNINGS],[
>>> > >       try_compiler_flags="$try_compiler_flags -Wall -Wmissing-
>>> > > prototypes -std=c99 -Wnested-externs -Wpointer-arith"
>>> > >          try_compiler_flags="$try_compiler_flags -Wextra -Wshadow
>>> > > -Wcast-align -Wwrite-strings -Waggregate-return"
>>> > >          # Removed -Wstrict-prototypes to avoid GTK bug
>>> > > -     try_compiler_flags="$try_compiler_flags -Winline
>>> > > -Wredundant-decls -Wno-sign-compare -Wno-deprecated-declarations"
>>> > > +     try_compiler_flags="$try_compiler_flags -Winline
>>> > > -Wredundant-decls -Wdeprecated-declarations -Wno-sign-compare"
>>> > >       if test "$enable_compile_warnings" = "error" ; then
>>> > >           try_compiler_flags="$try_compiler_flags -Werror"
>>> > This change should not be here.
>>> Actually, it should.
>>> Any function used from a newer version of glib will be treated as
>>> "deprecated" and then a warning will be thrown saying that the
>>> function is newer than the maximum allowed version.
>>> Without setting the deprecated-declarations warning, this whole
>>> change
>>> is useless. (And took me a while to find out what was going wrong
>>> ...).
>>> Does it make sense for you?
>>
>> Ah sorry, my bad. I only spot the change of the order of the flags.
>> I missed the -Wno -> -W change. Can you keep the order, please.
>
> I can. But I thought would be cleaner if all -Wfoo could come before
> the -Wno-bar flags, instead of mixing them.

So, would you prefer to have this part split in a different patch?

ffidenci at cat ~/src/upstream/virt-viewer $ cat
0001-m4-Use-Wdeprecated-declarations.patch
>From 003a35c7ddf8209272e12dc46f232b14dd21024c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fidencio at redhat.com>
Date: Wed, 24 Feb 2016 09:17:19 +0100
Subject: [PATCH] m4: Use -Wdeprecated-declarations

Let's enable deprecated-declarations warnings as we want to:
1) Avoid insert/maintain deprecated widgets/methods
2) Avoid adding widgets/methods that are too new, what could cause
problems like virt-viewer not being able to build in a specific distro.

Patches for making these two items possible are coming, introducing
_VERSION_MAX_ALLOWED for both GLIB and GDK and removing (as much as
possible) deprecated widgets/methods/structures.
---
 acinclude.m4 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/acinclude.m4 b/acinclude.m4
index a9561c4..30d5cc1 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -34,7 +34,7 @@ AC_DEFUN([VIRT_VIEWER_COMPILE_WARNINGS],[
  try_compiler_flags="$try_compiler_flags -Wall -Wmissing-prototypes
-std=c99 -Wnested-externs -Wpointer-arith"
         try_compiler_flags="$try_compiler_flags -Wextra -Wshadow
-Wcast-align -Wwrite-strings -Waggregate-return"
         # Removed -Wstrict-prototypes to avoid GTK bug
- try_compiler_flags="$try_compiler_flags -Winline -Wredundant-decls
-Wno-sign-compare -Wno-deprecated-declarations"
+ try_compiler_flags="$try_compiler_flags -Winline -Wredundant-decls
-Wdeprecated-declarations -Wno-sign-compare"
  if test "$enable_compile_warnings" = "error" ; then
     try_compiler_flags="$try_compiler_flags -Werror"
  fi
-- 
2.5.0


>
>>
>> Pavel
>>>
>>> >
>>> >
>>> > >
>>> > >       fi
>>> > > diff --git a/configure.ac b/configure.ac
>>> > > index 5503d46..437f6e4 100644
>>> > > --- a/configure.ac
>>> > > +++ b/configure.ac
>>> > > @@ -12,7 +12,10 @@ AC_CANONICAL_HOST
>>> > >  m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])])
>>> > >  AM_SILENT_RULES([yes])
>>> > >
>>> > > -GLIB2_REQUIRED="2.38.0"
>>> > > +# Keep these two definitions in agreement.
>>> > > +GLIB2_REQUIRED="2.38"
>>> > > +GLIB2_ENCODED_VERSION="GLIB_VERSION_2_38"
>>> > > +
>>> > >  LIBXML2_REQUIRED="2.6.0"
>>> > >  LIBVIRT_REQUIRED="0.10.0"
>>> > >  GTK_REQUIRED="3.10"
>>> > > @@ -94,6 +97,11 @@ GLIB_MKENUMS=`$PKG_CONFIG --
>>> > > variable=glib_mkenums
>>> > > glib-2.0`
>>> > >  AC_SUBST(GLIB_MKENUMS)
>>> > >
>>> > >  PKG_CHECK_MODULES(GLIB2, glib-2.0 >= $GLIB2_REQUIRED gio-2.0
>>> > > gthread-2.0 gmodule-export-2.0)
>>> > > +GLIB2_CFLAGS="$GLIB2_CFLAGS
>>> > > -DGLIB_VERSION_MIN_REQUIRED=$GLIB2_ENCODED_VERSION"
>>> > > +GLIB2_CFLAGS="$GLIB2_CFLAGS
>>> > > -DGLIB_VERSION_MAX_ALLOWED=$GLIB2_ENCODED_VERSION"
>>> > > +AC_SUBST(GLIB2_CFLAGS)
>>> > > +AC_SUBST(GLIB2_LIBS)
>>> > > +
>>> > >  PKG_CHECK_MODULES(LIBXML2, libxml-2.0 >= $LIBXML2_REQUIRED)
>>> > >
>>> > >  AC_ARG_WITH([libvirt],
>>> > Ack with the change.
>>> >
>>> > Pavel
>>> >
>>> > _______________________________________________
>>> > virt-tools-list mailing list
>>> > virt-tools-list at redhat.com
>>> > https://www.redhat.com/mailman/listinfo/virt-tools-list
>>>
>>>
>
>
>
> --
> Fabiano Fidêncio



-- 
Fabiano Fidêncio




More information about the virt-tools-list mailing list