-
Notifications
You must be signed in to change notification settings - Fork 722
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
Generated tests are not compatible across architectures #1213
Comments
It's pretty hard to do that, it not only depends on architecture but also on compiler flags and what not... |
We support not generating tests of course, but that's not quite a solution... |
Best thing to do is either generate bindings for the current target in There is a lot more gotchas than just pointer width, and the biggest is |
IIRC all of the platform-specific For libraries with stable ABI I prefer to generate bindings once and clean them up by hand, because it also allows me to translate feature-specific |
I think the minimal fix here would be to add Sorting of output to put all tests at the end would be helpful, too. |
But what about generated bindings by itself? #include <stdint.h>
union Foo {
void *p;
uint32_t a;
};
and failed tests indicates that something wrong, and you should generate bindings in May be leave current behaviour as is, because of it prevents errors and bugs? |
In your example I actually don't know why bindgen does it this way, because I'm working under assumption that |
Yeah we could avoid generating the alignment for the union in some cases, I'm happy to accept patches for that as long as there are proper tests. |
Input C/C++ Header
Bindgen Invocation
Run on
x86_64-apple-darwin
:Test with:
cargo test --target=i686-apple-darwin
Actual Results
Expected Results
The tests are valid only on the architecture bindgen was run on. It would be great if bindgen was able to make tests portable, e.g.:
Currently this isn't easy to do even manually, because tests are interleaved with other code, so combining of 32- and 64-bit files requires advanced regex-fu.
The text was updated successfully, but these errors were encountered: