Skip to content

Fix for anonymous structs #10

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

Closed
wants to merge 8 commits into from
Closed

Conversation

emilio
Copy link

@emilio emilio commented Mar 7, 2016

This is on top of #9, so probably that should merge before.

Couldn't add a test because I accidentally removed the llvm path so I'm re-installing it, I'll add it to this PR.

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 closed this Mar 7, 2016
emilio referenced this pull request in emilio/rust-bindgen Jul 5, 2016
Update syntex and use clang-sys for path-searching

This is on top of rust-lang#10 because they conflicted, yet I needed clang-sys for one of the tests.

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