Skip to content

Commit

Permalink
Make size_t_is_usize default to true
Browse files Browse the repository at this point in the history
Fixes: rust-lang#1901

(see also: rust-lang#1903)
  • Loading branch information
dkg committed Oct 16, 2020
1 parent a467d3e commit 82086e2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1869,7 +1869,7 @@ impl Default for BindgenOptions {
time_phases: false,
record_matches: true,
rustfmt_bindings: true,
size_t_is_usize: false,
size_t_is_usize: true,
rustfmt_configuration_file: None,
no_partialeq_types: Default::default(),
no_copy_types: Default::default(),
Expand Down
15 changes: 14 additions & 1 deletion src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,10 @@ where
),
Arg::with_name("size_t-is-usize")
.long("size_t-is-usize")
.help("Translate size_t to usize."),
.help("Translate size_t to usize. (this is the default)"),
Arg::with_name("size_t-is-not-usize")
.long("size_t-is-not-usize")
.help("Translate size_t to platform-specific lengths."),
Arg::with_name("no-rustfmt-bindings")
.long("no-rustfmt-bindings")
.help("Do not format the generated bindings with rustfmt."),
Expand Down Expand Up @@ -815,6 +818,16 @@ where

if matches.is_present("size_t-is-usize") {
builder = builder.size_t_is_usize(true);
if matches.is_present("size_t-is-not-usize") {
return Err(Error::new(
ErrorKind::Other,
"Cannot supply both --size_t-is-usize and --size_t-is-not-usize",
));
}
}

if matches.is_present("size_t-is-not-usize") {
builder = builder.size_t_is_usize(false);
}

let no_rustfmt_bindings = matches.is_present("no-rustfmt-bindings");
Expand Down

0 comments on commit 82086e2

Please sign in to comment.