After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 780903 - Fails to build with -Werror against glib master, use of deprecated g_object_newv()
Fails to build with -Werror against glib master, use of deprecated g_object_n...
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal normal
: 1.11.91
Assigned To: Tim-Philipp Müller
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-04-04 14:19 UTC by Alexander Larsson
Modified: 2017-04-08 09:29 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Don't use deprecated g_object_newv() (15.20 KB, patch)
2017-04-04 16:57 UTC, Tim-Philipp Müller
committed Details | Review

Description Alexander Larsson 2017-04-04 14:19:57 UTC
The nightly git master flatpak build fails:
http://sdkbuilder1.gnome.org//logs/build-2017-04-04-135003/build-gnome-sdk-images-master-x86_64.txt

with:

gstbufferpool.c: In function ‘gst_buffer_pool_new’:
gstbufferpool.c:222:3: error: ‘g_object_newv’ is deprecated: Use 'g_object_new_with_properties' instead [-Werror=deprecated-declarations]
   result = g_object_newv (GST_TYPE_BUFFER_POOL, 0, NULL);
   ^~~~~~
In file included from /usr/include/glib-2.0/gobject/gbinding.h:29:0,
                 from /usr/include/glib-2.0/glib-object.h:23,
                 from ../gst/gstobject.h:29,
                 from ../gst/gstplugin.h:29,
                 from gstregistry.h:28,
                 from gst_private.h:45,
                 from gstbufferpool.c:67:
/usr/include/glib-2.0/gobject/gobject.h:429:10: note: declared here
 gpointer    g_object_newv        (GType           object_type,
          ^~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[4]: *** [Makefile:1149: libgstreamer_1.0_la-gstbufferpool.lo] Error 1
make[4]: *** Waiting for unfinished jobs....
Comment 1 Olivier Crête 2017-04-04 16:11:03 UTC
Should we just remove the the -DG_DISABLE_DEPRECATED until we move to glib 2.52 in a year or two?
Comment 2 Sebastian Dröge (slomo) 2017-04-04 16:15:18 UTC
No, as usual we put there:

#if GLIB_CHECK_VERSION(2,52,0)
... code with new function
#else
... old code
#endif


And once we switch we can directly switch over the code without having to actually port lots of places at the same time.
Comment 3 Tim-Philipp Müller 2017-04-04 16:25:27 UTC
We can just switch to g_object_new() or add a compat macro for the new API guarded by a glib check into gst_private.h
Comment 4 Tim-Philipp Müller 2017-04-04 16:57:55 UTC
Created attachment 349253 [details] [review]
Don't use deprecated g_object_newv()

    Use g_object_new() instead which nowadays has a shortcut for
    the no-properties check. It still does an extra GType in the
    function guard, but there's a pending patch to remove that
    and it's hardly going to be a performance issue in practice,
    even less so on a system that's compiled without run-time checks.
    
    Alternative would be to move to the new g_object_new_properties()
    with a fallback define for older glib versions, but it makes the
    code look more unwieldy and doesn't seem worth it.
    
    Fixes deprecation warnings when building against newer GLib versions.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=780903


For duplicate type check removal see bug #780908.
Comment 5 Tim-Philipp Müller 2017-04-08 09:29:15 UTC
commit 519d64881fad234c9a637c0c1bcc3d8155e46b3f
Author: Tim-Philipp Müller <tim@centricular.com>
Date:   Tue Apr 4 17:53:39 2017 +0100

    Don't use deprecated g_object_newv()
    
    Use g_object_new() instead which nowadays has a shortcut for the
    no-properties check. It still does an extra GType check in the
    function guard, but there's a pending patch to remove that
    and it's hardly going to be a performance issue in practice,
    even less so on a system that's compiled without run-time checks.
    
    Alternative would be to move to the new g_object_new_properties()
    with a fallback define for older glib versions, but it makes the
    code look more unwieldy and doesn't seem worth it.
    
    Fixes deprecation warnings when building against newer GLib versions.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=780903