--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
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
--clang-macro-fallbackdoes not work if-includeis passed as a C flag.For instance, given a header that would benefit from
--clang-macro-fallback, such as:Then
generates the expected
However, if we pass an
-includeflag, even with an empty C header, it does not anymore:This was reduced from trying to use the
--clang-macro-fallbackfeature in the Linux kernel (mailing list post including a kernel patch to test/debug the feature), where we use a couple-includeflags.A possible workaround is to
#includemanually the headers at the top of the input file, and remove the-includeflags.Cc @jbaublitz