Re: [PATCH spice-server 10/10] tests: Avoid to disable all deprecation warnings just for expect functions

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

 



> 
> On Mon, Sep 11, 2017 at 11:15:47AM +0100, Frediano Ziglio wrote:
> > In case GLib don't provide these functions we use replacements so
> > there's no need to have a warning if these functions are called.
> > This potentially capture other compatibility issues in the tests
> > that would be ignored having all deprecation warnings disabled.
> > Tested with GLib 2.28 and 2.52.
> > 
> > Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> > ---
> >  server/tests/Makefile.am        | 12 ------------
> >  server/tests/test-glib-compat.h | 20 ++++++++++++++++++++
> >  2 files changed, 20 insertions(+), 12 deletions(-)
> > 
> > diff --git a/server/tests/Makefile.am b/server/tests/Makefile.am
> > index d50c590c3..2efc136d4 100644
> > --- a/server/tests/Makefile.am
> > +++ b/server/tests/Makefile.am
> > @@ -128,18 +128,6 @@ libtest_stat4_a_CPPFLAGS = $(AM_CPPFLAGS)
> > -DTEST_COMPRESS_STAT=1 -DTEST_RED_WORK
> >  
> >  test_qxl_parsing_LDADD = ../libserver.la $(LDADD)
> >  
> > -# Fallback implementations are provided for older glibs for the recent
> > glib
> > -# methods this test is using, so no need to warn about them
> > -test_vdagent_CPPFLAGS =			\
> > -	$(AM_CPPFLAGS)			\
> > -	-UGLIB_VERSION_MIN_REQUIRED	\
> > -	-UGLIB_VERSION_MAX_ALLOWED	\
> > -	$(NULL)
> > -test_codecs_parsing_CPPFLAGS = $(test_vdagent_CPPFLAGS)
> > -test_qxl_parsing_CPPFLAGS = $(test_vdagent_CPPFLAGS)
> > -test_fail_on_null_core_interface_CPPFLAGS = $(test_vdagent_CPPFLAGS)
> > -test_leaks_CPPFLAGS = $(test_vdagent_CPPFLAGS)
> > -
> >  if HAVE_GSTREAMER
> >  test_gst_SOURCES = test-gst.c \
> >  	$(NULL)
> > diff --git a/server/tests/test-glib-compat.h
> > b/server/tests/test-glib-compat.h
> > index a364012f4..91425cc44 100644
> > --- a/server/tests/test-glib-compat.h
> > +++ b/server/tests/test-glib-compat.h
> > @@ -29,6 +29,26 @@ void g_test_assert_expected_messages_internal(const char
> > *domain,
> >      g_test_assert_expected_messages_internal (G_LOG_DOMAIN, __FILE__,
> >      __LINE__, G_STRFUNC)
> >  void g_test_expect_message(const gchar *log_domain, GLogLevelFlags
> >  log_level,
> >                             const gchar *pattern);
> > +#else
> > +/* this avoids deprecation warning */
> > +static inline void
> > +g_test_expect_message_no_warnings(const gchar *log_domain, GLogLevelFlags
> > log_level,
> > +                                  const gchar *pattern)
> > +{
> > +    G_GNUC_BEGIN_IGNORE_DEPRECATIONS
> > +    g_test_expect_message(log_domain, log_level, pattern);
> > +    G_GNUC_END_IGNORE_DEPRECATIONS
> > +}
> > +static inline void
> > +g_test_assert_expected_messages_internal_no_warnings(const char *domain,
> > +                                                     const char *file, int
> > line, const char *func)
> > +{
> > +    G_GNUC_BEGIN_IGNORE_DEPRECATIONS
> > +    g_test_assert_expected_messages_internal(domain, file, line, func);
> > +    G_GNUC_END_IGNORE_DEPRECATIONS
> > +}
> > +#define g_test_expect_message g_test_expect_message_no_warnings
> > +#define g_test_assert_expected_messages_internal
> > g_test_assert_expected_messages_internal_no_warnings
> 
> I don't understand why you define g_test_assert_expected_messages_internal?
> The glib < 2.34 case has
> #define g_test_assert_expected_messages() \
>     g_test_assert_expected_messages_internal (G_LOG_DOMAIN, __FILE__,
>     __LINE__, G_STRFUNC)
> but I see no such #define in the newer glib case?
> 

Is defined by GLib itself. In this case the macro is fine, it needs to be
a macro and I cannot turn it to a function as __LINE__ and __FILE__ would
refer to the function defined and not to calling code.
That's why I wrap the function used in g_test_assert_expected_messages
instead of redefining/defining the macro.

> Christophe
> 

Frediano
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]