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

Improve support for bitflags. #293

Merged
merged 13 commits into from
Feb 26, 2019
Merged

Improve support for bitflags. #293

merged 13 commits into from
Feb 26, 2019

Conversation

emilio
Copy link
Collaborator

@emilio emilio commented Feb 24, 2019

Manually expand the macro using syn and a bit of custom code.

Also, add a way of using bitflags conveniently in C++ (opt-in, at least for now for now, since it uses inline variables, which are only available from C++17).

This also fixes a couple other bugs related to constants and handling or repr(transparent), and adds tests for those.

Fixes #284.

Fixes mozilla#100.

I want to add some more ergonomic improvements when in C++, but that's better in
another PR.
Opt-in since it uses a C++17 feature, but this allow exactly the same usage in
C++ and Rust, which I think is nice.

This also fixes constants of transparent structs in general, since the initial
version of this patch broke a test (associated constants in enums), so I added a
test for that too.
@emilio
Copy link
Collaborator Author

emilio commented Feb 24, 2019

r? @eqrion

src/bindgen/parser.rs Outdated Show resolved Hide resolved
@emilio emilio merged commit 8b4b9a3 into mozilla:master Feb 26, 2019
@emilio emilio deleted the bitflags branch February 26, 2019 05:39
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.

Special-case the bitflags! macro
2 participants