-
Notifications
You must be signed in to change notification settings - Fork 747
Bindgen fails to parse math.h
#2596
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
Comments
This is a rediscovery of #687; A solution was proposed then that looks like this #687 (comment) |
In that thread, someone else has made it known about the regression: #687 (comment) |
I don't think there's a regression. The bindgen invocation you provided is not using any of the options that can fix this. |
I did use the advice of the stuff I found, but isn't it supposed to work? If not, feel free to close this issue then. |
then please include it in the issue description.
what's "it"? If you mean that this should work with the invocation you provided, then it is not supposed to work. The underlying problem here is that C programmers tend to use nameless enum
{
FP_INT_UPWARD =
# define FP_INT_UPWARD 0
FP_INT_UPWARD,
FP_INT_DOWNWARD =
# define FP_INT_DOWNWARD 1
FP_INT_DOWNWARD,
FP_INT_TOWARDZERO =
# define FP_INT_TOWARDZERO 2
FP_INT_TOWARDZERO,
FP_INT_TONEARESTFROMZERO =
# define FP_INT_TONEARESTFROMZERO 3
FP_INT_TONEARESTFROMZERO,
FP_INT_TONEAREST =
# define FP_INT_TONEAREST 4
FP_INT_TONEAREST,
}; As you can see, this defines a C enum without a name where each enumerator uses a macro to define a constant and immeadiately uses that constant. As C enums are treated as constants by bindgen, this causes a collision where Given that people could also write this: enum {
BAR =
#define BAR 0
BAR,
} Foo; it is not immediately clear what to do with each definition as users might want to keep the macro-defined constant and:
So in your particular case, this C enum doesn't have a name, which means that keeping both the macro and the enumerator is irrelevant and you can easily ignore it with the suggestion I linked above: you either use a |
Input C/C++ Header
Bindgen Invocation
Actual Results
This was on wsl, ubuntu, jammy, and using
Ubuntu clang version 14.0.0-1ubuntu1.1
.I tried with
clang-15
, same result.The issue is that this gets generated in the same file:
Expected Results
If I run the same on my Windows installation, I don't get whatever is going on here. In fact, I don't get these
things at all.
The text was updated successfully, but these errors were encountered: