-
Notifications
You must be signed in to change notification settings - Fork 37
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
can't alias to existing D type #216
Comments
@chriscamacho The first case is easy to fix - just ignore the alias, but what about the second case? Do you think having dstep to automatically convert |
This looks like a case where DStep doesn't handle D keywords. A quick fix would be to just suffix the alias names with |
although in the C world _ is supposed to be reserved I haven't honestly seen it in practice, I'd say an initial scan to prefix any D keywords in the C source with _ or similar would be a good approach and would probably solve other undiscovered corner cases lurking to catch you out ! |
We're currently adding a suffix, not a prefix, i.e |
Yes, I guess the pragmatic approach with _ is fine. But it doesn't look 'nice', I'm wondering if renaming all bytes to ubytes isn't a better approach... |
what if its not actually unsigned ? |
That seems quite brittle. What if |
Or not corresponding to D's |
If it's not actually unsigned then we can just ignore the alias as in the case of ushort above. |
What about code like this: |
Yes, I would rename it only if it has form like in the current bug. The stupid cases have to be resolved by other means (_ suffix for example). |
Or in case of typedef int byte, rename all the bytes to ints |
I wouldn't worried about the symbols, if naming of the types influenced the mangling we are screwed with any renaming (e.g. adding _). I don't think the aliases to primitive types are exported at all. |
I'm not worried about mangling. What I'm referring to is if the C header defines a symbol called |
I guess the best would be to check all the usages of the typedef and then translate to what the typedef resolves to. This could be bundled in the existing |
Fix #216: can't alias to existing D type
when translating the header from https://github.com/ggambetta/libz80
dstep emitted the following code (in part)
alias ushort = ushort;
alias byte = ubyte;
fortunately its not a large header so I could just comment these alias's out and change any byte to ubyte ...
The text was updated successfully, but these errors were encountered: