GNOME Bugzilla – Bug 662810
Valac generates code dependent upon deprecated GLib functions (jhbuild build breaker)
Last modified: 2012-09-16 18:47:32 UTC
Valac can generate C code that uses g_static_rec_mutex* which are deprecated in the latest version of GLib. GLib recommends: g_static_rec_mutex_init -> g_rec_mutex_init g_static_rec_mutex_free -> g_rec_mutex_free Since jhbuild sets -Wdeprecated-declarations, this breaks the build (within jhbuild) for Folks (and any other code that uses lock(), I think). There may be other newly-deprecated functions that Valac uses which Folks doesn't trigger (so I haven't noticed).
*** Bug 663197 has been marked as a duplicate of this bug. ***
Created attachment 200746 [details] [review] glib-2.0: Deprecate several threading symbols Proposed patch, not really complete as Private is very tricky and there's no StaticCond.
(In reply to comment #2) > Created an attachment (id=200746) [details] [review] > glib-2.0: Deprecate several threading symbols > > Proposed patch, not really complete as Private is very tricky and there's > no StaticCond. When targeting GLib >= 2.32, instead of deprecating Mutex I think we should switch it to a struct and deprecate StaticMutex. You would have to target glib >= 2.32, so it shouldn't cause any problems with older software. It keeps us in line with other languages, and Static* is ugly.
A few fixes for this were committed a while ago. Are there still issues left (when targeting GLib >= 2.32)?
This does not appear to be fixed: === test.vala === class Foo { int xyz; public void inc() { lock (xyz) { ++xyz; } } } void main() { new Foo().inc(); } === end === $ valac --version Vala 0.17.6 $ valac --target-glib=2.32 test.vala /home/adam/test/test.vala.c: In function ‘foo_inc’: /home/adam/test/test.vala.c:70:3: warning: ‘g_static_rec_mutex_lock’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:173): Use 'g_rec_mutex_lock' instead [-Wdeprecated-declarations] /home/adam/test/test.vala.c:80:4: warning: ‘g_static_rec_mutex_unlock’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:179): Use 'g_rec_mutex_unlock' instead [-Wdeprecated-declarations] /home/adam/test/test.vala.c: In function ‘foo_instance_init’: /home/adam/test/test.vala.c:222:2: warning: ‘g_static_rec_mutex_init’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:170): Use 'g_rec_mutex_init' instead [-Wdeprecated-declarations] /home/adam/test/test.vala.c: In function ‘foo_finalize’: /home/adam/test/test.vala.c:230:2: warning: ‘g_static_rec_mutex_free’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:189): Use 'g_rec_mutex_free' instead [-Wdeprecated-declarations] $
commit dfb95c8093363a057e52da24929e11b2b72b17f0 Author: Jürg Billeter <j@bitron.ch> Date: Sun Sep 16 20:45:15 2012 +0200 codegen: Do not use deprecated functions for lock statements Fixes bug 662810.