rust-lang / rust-lang/rust-bindgen
Undefined/redefined C macro keeps old value
Open
Nobody has claimed this yet.
bug
E-easy
help wanted
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 829
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 15
Description
Input C/C++ Header
#define A 1
#define B 2
#undef A
#define A 2
#undef B
#define B 1
Bindgen Invocation
bindgen::Builder::default()
.header("input.h")
.generate()
.unwrap()
Actual Results
/* automatically generated by rust-bindgen 0.69.2 */
pub const A: u32 = 1;
pub const B: u32 = 2;
Expected Results
/* automatically generated by rust-bindgen 0.69.2 */
pub const A: u32 = 2;
pub const B: u32 = 1;
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
Start by reproducing the issue with the supplied C++ header and the Rust bindgen::Builder invocation. Trace how bindgen processes undefined and redefined macros, then verify that generated bindings use A = 2 and B = 1 rather than their earlier values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, cpp, rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100