Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating code that will not compile #46

Closed
russel opened this issue Jan 19, 2016 · 3 comments
Closed

Generating code that will not compile #46

russel opened this issue Jan 19, 2016 · 3 comments

Comments

@russel
Copy link
Contributor

russel commented Jan 19, 2016

This is a one off case but…

The C code:

struct dtv_property {
*u32 cmd;
__u32 reserved[3];
union {
__u32 data;
struct dtv_fe_stats st;
struct {
__u8 data[32];
__u32 len;
__u32 reserved1[3];
void reserved2;
} buffer;
} u;
int result;
} __attribute
((packed));

results in the D code:

struct dtv_property
{
__u32 cmd;
__u32[3] reserved;
union
{
__u32 data;
struct dtv_fe_stats
{
__u8 len;
dtv_stats[4] stat;
}
dtv_fe_stats st;
struct
{
__u8[32] data;
__u32 len;
__u32[3] reserved1;
void* reserved2;
}
}
int result;
}

which is compile error not only because of the __u32 and __u8 types, but because of the field data in the anonymous struct.

I do not have any answers, but I think this marker for the problems needs to be put on record.

@jacob-carlborg
Copy link
Owner

You mean because buffer and u are removed?

@russel
Copy link
Contributor Author

russel commented Jan 20, 2016

Indeed. removal of the buffer and u flattens the name space and creates a conflict over the name data that wasn't there before.

Also __u32 and __u8 are not being converted to their D forms.

@jacob-carlborg
Copy link
Owner

What are __u32 and __u8? If they're #define than they will not be handled.

ciechowoj added a commit to ciechowoj/dstep that referenced this issue Jun 28, 2016
ciechowoj added a commit to ciechowoj/dstep that referenced this issue Jul 6, 2016
ciechowoj added a commit to ciechowoj/dstep that referenced this issue Jul 26, 2016
ciechowoj added a commit to ciechowoj/dstep that referenced this issue Jul 27, 2016
ciechowoj added a commit to ciechowoj/dstep that referenced this issue Jul 27, 2016
ciechowoj added a commit to ciechowoj/dstep that referenced this issue Jul 27, 2016
ciechowoj added a commit to ciechowoj/dstep that referenced this issue Jul 27, 2016
ciechowoj added a commit to ciechowoj/dstep that referenced this issue Jul 27, 2016
ciechowoj added a commit to ciechowoj/dstep that referenced this issue Aug 1, 2016
ciechowoj added a commit to ciechowoj/dstep that referenced this issue Aug 3, 2016
ciechowoj added a commit to ciechowoj/dstep that referenced this issue Aug 6, 2016
ciechowoj added a commit to ciechowoj/dstep that referenced this issue Aug 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants