-
Notifications
You must be signed in to change notification settings - Fork 775
Description
This is a regression from 83f729f
Input C/C++ Header
I'm sorry this is not reduced as much as possible, but it's already significantly reduced. The problem does not happen using the output of --dump-preprocessed-input (it does require multiple separate headers, and even worse, it requires that some of them are included multiple times)
The complete set of files involved in this somehow reduced testcase is: https://drive.google.com/file/d/1vldgLGgcslyeUTlcHzMd4r0WVZNY2Wht/view?usp=sharing
Bindgen Invocation
Assuming the testcase.tar.gz archive is extracted to /tmp/testcase, run the cli with
cargo run --release -p bindgen-cli -- /tmp/testcase/mozilla/GeckoBindings.h --allowlist-type nsSimpleContentList --allowlist-type nsSize --enable-cxx-namespaces --no-derive-default --generate types --ignore-methods --rust-target 1.68 -- -x c++ -std=c++17 -fno-sized-deallocation -fno-aligned-new -DTRACING=1 -DIMPL_LIBXUL -DMOZILLA_INTERNAL_API -DRUST_BINDGEN -I/tmp/testcase -I/tmp/testcase/nspr -include /tmp/testcase/mozilla-config.h -include /tmp/testcase/nsStyleStruct.h -include /tmp/testcase/LayoutConstants.h
(using clang 16, I don't know for sure whether the command works with older versions, I know for sure it doesn't work with clang 11, because I have that in a corner)
Actual Results
The output contains the nsSize type in the root::mozilla namespace, although the type is defined in the root namespace.
There are many ways to make this disappear:
- removing
--allowlist-type nsSimpleContentList - in LayoutConstants.h, adding
constexpr nsSize dummy(0, 0);abovenamespace mozilla(because yes, that's where the bogus namespace comes from) - not including nsStyleStruct.h from the command line
- not including nsStyleStruct.h from mozilla/GeckoBindings.h
- using the preprocessed input
- creating a file that includes
mozilla-config.h,nsStyleStruct.h,LayoutConstants.handmozilla/GeckoBindings.h, and using that instead of passing those files on the command line. - etc.