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 580513 - Delegates typedef'd before enums in generated C code -- problem if delegates use enum
Delegates typedef'd before enums in generated C code -- problem if delegates ...
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Delegates
0.7.x
Other All
: Normal major
: ---
Assigned To: Jürg Billeter
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2009-04-27 21:34 UTC by Jim Nelson
Modified: 2009-05-07 16:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch (1.31 KB, patch)
2009-04-30 14:13 UTC, Levi Bard
committed Details | Review

Description Jim Nelson 2009-04-27 21:34:05 UTC
Please describe the problem:
When compiling with 0.7.1, gcc complains whenever a delegate uses an enum as a parameter or a result value.  Examining the C code, it appears delegates are typedef'd before enums, meaning they cannot reference them without a compile error.

Steps to reproduce:

enum TestEnum {
    foo,
    bar,
    xyzzy,
}

delegate void tdelegate(TestEnum te);

void main() {
}

Actual results:
Compile error:

/home/jim/prj/test/test.c:7: error: expected ‘)’ before ‘te’
error: cc exited with status 256
Compilation failed: 1 error(s), 0 warning(s)
make: *** [test] Error 1


Expected results:
Compile without error.

Does this happen every time?
Yes.

Other information:
Comment 1 Levi Bard 2009-04-30 14:13:50 UTC
Created attachment 133653 [details] [review]
Patch

I confirm as of master commit 507767eee6ab6ef3f34a5053c2cfb824d1008113.

Patch emits delegate typedef statement as a type definition instead of a type declaration.
Comment 2 Jim Nelson 2009-04-30 18:17:18 UTC
Thanks -- this does solve my problem.  As a side note, I could only compile this patched 0.7.1 with an unpatched 0.7.1.  0.6.1 choked.

Thanks!
Comment 3 Jürg Billeter 2009-05-07 16:17:03 UTC
commit 5207f35a645c2623a1adb55f982762b8de2eeae1
Author: Levi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com>
Date:   Thu May 7 18:15:20 2009 +0200

    Move delegate typedef to right position
    
    Fixes bug 580513.