rust-lang / rust-lang/rust-bindgen

Signedness mismatch

Open
#1,594 11 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted
Dominant language
Rust
Stars
5.3k
Forks
829
Avg merge
1d 1h
Merged PRs (30d)
15

Description

Input C/C++ Header
#define FOO 253
Bindgen Invocation
$ bindgen input.h
Actual Results
/* automatically generated by rust-bindgen */

pub const FOO: u32 = 253;
Expected Results
/* automatically generated by rust-bindgen */

pub const FOO: ::std::os::raw::c_int = 253;
Summary

Bindgen outputs a u32 instead of c_int for defines. This makes them difficult to work with due to signedness mismatch.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the shown input.h containing #define FOO 253 and the bindgen input.h invocation. Trace how bindgen determines the type of generated constants and compare the output with the expected c_int result; done means the signedness mismatch is resolved without changing unrelated generated output.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, rust
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.