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 706683 - fails to build with latest stable Vala
fails to build with latest stable Vala
Status: RESOLVED FIXED
Product: folks
Classification: Platform
Component: general
git master
Other Linux
: Normal normal
: Unset
Assigned To: folks-maint
folks-maint
Depends on:
Blocks:
 
 
Reported: 2013-08-23 17:37 UTC by Simon McVittie
Modified: 2013-08-28 10:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
PhoneFieldDetailsTests: make constant static strings unowned (1.00 KB, patch)
2013-08-23 17:37 UTC, Simon McVittie
committed Details | Review

Description Simon McVittie 2013-08-23 17:37:32 UTC
Created attachment 252931 [details] [review]
PhoneFieldDetailsTests: make constant static strings unowned

This works around Vala bug GNOME#646970, which is only fixed in a
development version (0.21). Newer Vala versions automatically make
these strings behave as if unowned anyway.

---

Yes I realize this is a workaround, but it's so easy that it seems worth doing.
Comment 1 Philip Withnall 2013-08-26 04:16:00 UTC
What’s the build failure you get? It’s building fine for me with Vala from a few days ago.
Comment 2 Simon McVittie 2013-08-27 10:45:39 UTC
(In reply to comment #1)
> What’s the build failure you get? It’s building fine for me with Vala from a
> few days ago.

Note that I said "latest stable" - it fails with 0.20.1 (the latest even-numbered release) but works with 0.21.x.

The compiler error with "-g" is:

/home/smcv/src/gnome/folks/tests/folks/phone-field-details.vala: In function ‘phone_field_details_tests_test_normalisation’:
/home/smcv/src/gnome/folks/tests/folks/phone-field-details.vala:42:2: error: initializer element is not constant
       const NormalisationPair[] normalisation_pairs = {
  ^

The generated code is:

void phone_field_details_tests_test_normalisation (PhoneFieldDetailsTests* self) {
        gchar* _tmp0_;
        gchar* _tmp1_;
        gchar* _tmp2_;
        gchar* _tmp3_;
        gchar* _tmp4_;
        gchar* _tmp5_;
#line 42 "/home/smcv/src/gnome/folks/tests/folks/phone-field-details.vala"
        static const PhoneFieldDetailsTestsNormalisationPair normalisation_pairs[] = {{_tmp0_, _tmp1_}, {_tmp2_, _tmp3_}, {_tmp4_, _tmp5_}};
#line 38 "/home/smcv/src/gnome/folks/tests/folks/phone-field-details.vala"
        g_return_if_fail (self != NULL);
#line 42 "/home/smcv/src/gnome/folks/tests/folks/phone-field-details.vala"
        _tmp0_ = g_strdup ("1-800-123-4567");
#line 42 "/home/smcv/src/gnome/folks/tests/folks/phone-field-details.vala"
        _tmp1_ = g_strdup ("18001234567");
#line 42 "/home/smcv/src/gnome/folks/tests/folks/phone-field-details.vala"
        _tmp2_ = g_strdup ("+1-800-123-4567");
#line 42 "/home/smcv/src/gnome/folks/tests/folks/phone-field-details.vala"
#line 42 "/home/smcv/src/gnome/folks/tests/folks/phone-field-details.vala"
        _tmp3_ = g_strdup ("+18001234567");
#line 42 "/home/smcv/src/gnome/folks/tests/folks/phone-field-details.vala"
        _tmp4_ = g_strdup ("+1-800-123-4567P123");
#line 42 "/home/smcv/src/gnome/folks/tests/folks/phone-field-details.vala"
        _tmp5_ = g_strdup ("+18001234567P123");

which clearly isn't going to work (even if these non-constant initializers for a static object were valid C, normalisation_pairs[] contains uninitialized pointers and is never updated to contain the desired strings, so the rest of the function would just crash).
Comment 3 Philip Withnall 2013-08-28 01:37:35 UTC
Comment on attachment 252931 [details] [review]
PhoneFieldDetailsTests: make constant static strings unowned

Sorry, missed that you’d said ‘stable’. Go for it, and don’t forget to update NEWS. Thanks!
Comment 4 Simon McVittie 2013-08-28 10:00:16 UTC
Fixed in git for 0.9.6