rust-lang / rust-lang/rust-bindgen
C globals with initializers turned into Rust constants
Open
@pvdrz is already working on this.
Since Mar 23, 2023.
I-bogus-codegen
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 829
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 15
Description
Input C/C++ Header
int foo;
int withinit = 123;
Bindgen Invocation
bindgen test.h -- -std=c99
Actual Results
/* automatically generated by rust-bindgen 0.64.0 */
extern "C" {
pub static mut foo: ::std::os::raw::c_int;
}
pub const withinit: ::std::os::raw::c_int = 123;
Expected Results
It should give static in both cases. The C global is not constant just because it has an initializer.
Happens on 0.64.0 and on main(a1216813fa9b4a856f84c086754d9f2c876be794)
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.
Assessment
This issue has not been assessed yet.