macros defining integer constants using expressions containing enum values don't work
In Gecko (in gfxFontConstants.h) we have:
enum {
eFeatureAlternates_historical,
eFeatureAlternates_stylistic,
eFeatureAlternates_styleset,
eFeatureAlternates_character_variant,
eFeatureAlternates_swash,
eFeatureAlternates_ornaments,
eFeatureAlternates_annotation,
eFeatureAlternates_numFeatures
};
#define NS_FONT_VARIANT_ALTERNATES_HISTORICAL (1 << eFeatureAlternates_historical)
rust-bindgen doesn't generate anything for NS_FONT_VARIANT_ALTERNATES_HISTORICAL.
cc @emilio
Ugh, this never worked though... I know how to fix it for this case, but it's not pretty, and it's definitely hard to make it work for the general case.
If only clang gave us a way of evaluating an expression in a given context...
Yeah, so I looked into patching libclang so it works, but I can't see a clear way to do this. Basically, clang needs to expand the macro so it knows in what context to evaluate it. You can convert that into a constant, and then I think I can do stuff with it.
FWIW, if those are switched to constants, they'll work properly with #260, even though it's a complex expression.
Just to point out other uses / problems, the same underlying problem happen for "function aliases" defines, such as some functions in monocypher.
I didn't open a new issue since you've already merged #1546, which is the same but with structs, into this one.