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

newtype-enum regex nigthmare #2195

Closed
Dushistov opened this issue Apr 26, 2022 · 2 comments
Closed

newtype-enum regex nigthmare #2195

Dushistov opened this issue Apr 26, 2022 · 2 comments

Comments

@Dushistov
Copy link
Contributor

Dushistov commented Apr 26, 2022

I want convert all enums that name matches "C4.*" as newtype-enum, except enum C4ReplicatorActivity,
which I want convert as rustified-enum.
Plus I want convert enum FLError as newtype-enum.

I tried several variants (bindgen 0.59.2):

$ bindgen --rustified-enum C4ReplicatorActivity   --newtype-enum '(C4(?!ReplicatorActivity)(.+))|(FLError)' /tmp/test2.hpp -- -x c++

C4ReplicatorActivity ok, FLError and C4Foo are not newtype-enum.

$ bindgen --rustified-enum C4ReplicatorActivity --newtype-enum 'FLError' --newtype-enum 'C4.*' /tmp/test2.hpp -- -x c++

C4ReplicatorActivity not rustfied, FLErrorandC4Foo` are good.

Input C/C++ Header

enum class C4ReplicatorActivity : int { S1, S2, S3 };

enum class FLError { A, B };

enum class C4Foo { C, D };
@kulp
Copy link
Member

kulp commented Jun 2, 2022

Thanks for the report, @Dushistov.

In your first example: if you put an extra set of parentheses around the pattern, resulting in ((C4(?!ReplicatorActivity)(.+))|(FLError)), does it start working as you expect?

Especially if it does (but even if it does not), this issue might overlap with #1755, and could be fixed by #1756 (although there might be a separate bug in your second example).

@pvdrz
Copy link
Contributor

pvdrz commented Nov 14, 2022

Solved via #2345

@pvdrz pvdrz closed this as completed Nov 14, 2022
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

No branches or pull requests

3 participants