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 530063 - enum definition should appear before struct using that enum in C code
enum definition should appear before struct using that enum in C code
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Code Generator
0.3.x
Other All
: Normal normal
: ---
Assigned To: Jürg Billeter
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2008-04-26 13:03 UTC by Jaap A. Haitsma
Modified: 2008-05-31 11:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch making sure that enums are defined before structs in a class (529 bytes, patch)
2008-04-26 22:15 UTC, Jaap A. Haitsma
reviewed Details | Review

Description Jaap A. Haitsma 2008-04-26 13:03:28 UTC
Try compiling example below


public class Sample {
	enum Enum {
		A
	}

	struct Struct {
		Enum a;
	}
        static int main (string[] args) {
                return 0;
        }
}

Generated code contains

struct _SampleStruct {
	SampleEnum a;
};
typedef enum  {
	SAMPLE_ENUM_A
} SampleEnum;

while this should be

typedef enum  {
	SAMPLE_ENUM_A
} SampleEnum;
struct _SampleStruct {
	SampleEnum a;
};
Comment 1 Jaap A. Haitsma 2008-04-26 22:15:35 UTC
Created attachment 109965 [details] [review]
Patch making sure that enums are defined before structs in a class
Comment 2 Jaap A. Haitsma 2008-04-28 16:48:38 UTC
Jürg, can I commit the patch above?
Comment 3 Jürg Billeter 2008-05-02 19:06:31 UTC
Thanks for the patch, however, this is just a symptom of a different bug, which I want to fix this in a more general manner. I have an experimental patch in a local branch, can hopefully commit it soon.
Comment 4 Jürg Billeter 2008-05-02 19:06:52 UTC
Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find.


*** This bug has been marked as a duplicate of 471244 ***
Comment 5 Jürg Billeter 2008-05-31 11:25:59 UTC
More general fix for bug 571244 is taking too long, let's first address the specific issue you have here.
Comment 6 Jürg Billeter 2008-05-31 11:28:01 UTC
That should have been bug 471244, of course.
Comment 7 Jürg Billeter 2008-05-31 11:30:10 UTC
2008-05-31  Jürg Billeter  <j@bitron.ch>

	* vala/valaclass.vala:
	* vala/valainterface.vala:

	Emit nested enums before structs,
	based on patch by Jaap A. Haitsma, fixes bug 530063

Fixed in r1514.
Comment 8 Jaap A. Haitsma 2008-05-31 11:43:00 UTC
Thanks :-)