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

Various fixes from stylo #9

Open
wants to merge 28 commits into
base: sm-hacks
Choose a base branch
from
Open

Conversation

bholley
Copy link

@bholley bholley commented Mar 7, 2016

No description provided.

bholley and others added 8 commits February 18, 2016 12:15
The correct thing to do here is to use env_logger, but that was causing cargo
troubles for me, and this is preferable to swallowing them.
It looks like mwu added this, but I'm pretty sure it's a category error. This
function appears to be designed to reproducibly permute C identifiers so that
they don't conflict with builtin rust types. It's specifically _not_ a type
translator (which would happen at the type level, rather than the string
level), and using it as such with callers like ctypedef_to_rs causes us to
generate things like:

type u64 = u64;

While processing stdint.h, which is clearly wrong.
…s during code generator.

As best as I can tell, it's done this way (rather than my way) because bindgen tries
to recognize struct and enums typedefs of the form:

/* This is a common idiom in C, not so much in C++ */
typdef struct {
 ...
} Foo;

The intention, I think, is to avoid generating rust code for a struct with a placeholder
name followed by a typedef, and just give the struct the right name initially.

This seems like a reasonable goal, though not a particularly important one. However, in
my testing this never actually happens, because we end up calling unnamed_name anyway
during the GComp(ci) case of gen_mod before we get to evaluting the typedef.

So let's just remove that stuff and simplify the code. This lets us remove all the
borrow_mut calls during code generation, which seems necessary for soundness.
@emilio emilio mentioned this pull request Mar 7, 2016
bholley and others added 20 commits March 7, 2016 13:09
gen: Allow empty union bitfield members
We currently generate the modules as expected, but we don't resolve the
names from external namespaces well.
Overall now that they aren't complete still.
Basic C++ namespace support
This way we can share the global map, while having each module custom
globals.
This actually keeps working as before.
We generate almost valid code, we just have to add some use statements.

Or maybe is a better idea to add an unintelligible name to the root
mod, and actually output a root mod plus a use root::* before.
There's just an edge case I've detected, and it's when we remove the
instantiation of C<int>, and another module uses it, because that means
we only know of its existance in that other module.

Probably we might want to use cursor_getSemanticParent to get the real
class instead of the instantiated, but I'm not too confident about that.
This can be annoying if filtering files out.
emilio referenced this pull request in emilio/rust-bindgen Jul 9, 2016
readme: Add a bit more up-to-date information.

r? @nox or @Ms2ger
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

Successfully merging this pull request may close these issues.

2 participants