rust-lang / rust-lang/rust-bindgen

Bindgen generates different type name for va_list on different systems

Open
#2,631 9 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Input C/C++ Header
typedef __builtin_va_list va_list;
void foo(va_list arg);
Bindgen Invocation
$ bindgen input.h
Actual Results
  • on arm64 macos
/* automatically generated by rust-bindgen 0.68.1 */

pub type va_list = __builtin_va_list;
extern "C" {
    pub fn foo(arg: va_list);
}
pub type __builtin_va_list = *mut ::std::os::raw::c_char;
  • on x64_64 linux
/* automatically generated by rust-bindgen 0.68.1 */

pub type va_list = __builtin_va_list;
extern "C" {
    pub fn foo(arg: *mut __va_list_tag);
}
pub type __builtin_va_list = [__va_list_tag; 1usize];
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct __va_list_tag {
    pub gp_offset: ::std::os::raw::c_uint,
    pub fp_offset: ::std::os::raw::c_uint,
    pub overflow_arg_area: *mut ::std::os::raw::c_void,
    pub reg_save_area: *mut ::std::os::raw::c_void,
}
Expected Results

I expect the name of this type to be the same on both systems regardless of the underlying implementation.

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 with the input.h example and run bindgen input.h on arm64 macOS and x86_64 Linux to reproduce the differing va_list output. Compare the generated bindings and define completion as producing the same type name on both systems without losing the underlying ABI representation.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, rust
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.