Closed
Description
--clang-macro-fallback
does not work if -include
is passed as a C flag.
For instance, given a header that would benefit from --clang-macro-fallback
, such as:
#define F(n) n
#define N F(4)
Then
bindgen x.h --clang-macro-fallback
generates the expected
pub const N: u32 = 4;
However, if we pass an -include
flag, even with an empty C header, it does not anymore:
bindgen x.h --clang-macro-fallback -- -include empty.h
This was reduced from trying to use the --clang-macro-fallback
feature in the Linux kernel (mailing list post including a kernel patch to test/debug the feature), where we use a couple -include
flags.
A possible workaround is to #include
manually the headers at the top of the input file, and remove the -include
flags.
Cc @jbaublitz