rust-lang / rust-lang/rust-bindgen
#define + sizeof(...) fails to emit constant
Open
Nobody has claimed this yet.
A-macros
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 829
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 15
Description
Not sure if I'm missing a feature that's not supported yet but I hit issue and narrowed it down when trying to generate bindings for Lua.
Input C/C++ Header
#define SIZEOF_INT sizeof(int)
Bindgen Invokation
bindgen::Builder::default()
.header("test.h")
.generate().unwrap()
.write_to_file("src/out.rs").unwrap();
Actual Results
/* automatically generated by rust-bindgen */
Expected Results
RUST_LOG=bindgen Output
No logging emitted when I set env var
Full repro repo also exists here for easier debugging: https://github.com/vvanders/bindgen_repro
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue from the test.h header using the bindgen::Builder invocation shown, then inspect the generated src/out.rs. Compare the empty output with the expected SIZEOF_INT constant and use the RUST_LOG=bindgen result as a debugging check. Done means the sizeof macro is emitted as a constant in the generated bindings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100