-
Notifications
You must be signed in to change notification settings - Fork 696
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
automatically allow non rust naming conventions #565
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks!
We need to sort out the mangling issue before this can land, however.
@@ -37,6 +37,6 @@ impl Default for JNINativeInterface_ { | |||
fn default() -> Self { unsafe { ::std::mem::zeroed() } } | |||
} | |||
extern "stdcall" { | |||
#[link_name = "_bar@0"] | |||
#[link_name = "bar@0"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is failing in CI. @emilio do you know what's up with this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this is due to us not testing on OSX (where we remove an extra underscore from symbols that clang adds). Of course, this is cross-compiled so a cfg
check is not enough. Let's just remove this change from the PR for now.
We can wait and see if anyone cares enough about these warnings to file an issue requesting configurability :) |
@fitzgen is this ready to land? Looks ok to me. |
Yeah, I didn't get an email about the new commit for whatever reason. @bors-servo r+ Thanks @framlog! If you'd like to continue hacking on bindgen, I can point you at some more things :) Thanks again! |
📌 Commit e0ca632 has been approved by |
automatically allow non rust naming conventions + related issue: #562 I just added those attributes at the root mod. And I'm not sure whether it should be better if we could set this setting in `build.rs`.
I guess one potential issue is that this will only work if one has enabled C++ namespaces, otherwise we won't generate the module definition and its |
☀️ Test successful - status-travis |
@fitzgen ok, I'd like to do more work on it. thx |
I'd suggest looking into how we prepend raw lines to the bindings, and inserting If anything doesn't make sense, don't hesitate to ask a question :) |
@fitzgen Inserting an attribute at the beginning of a generated file is easy. However, I can't find a way to make the generated file can work in integration if I just insert that line. (Seems that rustc doesn't allow |
I'd be hesitant to allow that by default, it could break legit usages of |
Ah, good catch, I didn't think about how it would play out inside an |
Well, I managed to allow non rusty conventions by wrapping the whole generated code in a root mod regardless of enabling c++ namespaces. It doesn't bother the integration I think. And I could make a pr after I fixing the name mangling issue if you think it's ok. |
I guess that's fair, though that's a much more breaking change... |
ok, thanks. |
non_snake_case, non_camel_case_types, non_upper_case_globals
#562I just added those attributes at the root mod. And I'm not sure whether it should be better if we could set this setting in
build.rs
.