Skip to content

Commit 82086e2

Browse files
committed
Make size_t_is_usize default to true
Fixes: #1901 (see also: #1903)
1 parent a467d3e commit 82086e2

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1869,7 +1869,7 @@ impl Default for BindgenOptions {
18691869
time_phases: false,
18701870
record_matches: true,
18711871
rustfmt_bindings: true,
1872-
size_t_is_usize: false,
1872+
size_t_is_usize: true,
18731873
rustfmt_configuration_file: None,
18741874
no_partialeq_types: Default::default(),
18751875
no_copy_types: Default::default(),

src/options.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,10 @@ where
408408
),
409409
Arg::with_name("size_t-is-usize")
410410
.long("size_t-is-usize")
411-
.help("Translate size_t to usize."),
411+
.help("Translate size_t to usize. (this is the default)"),
412+
Arg::with_name("size_t-is-not-usize")
413+
.long("size_t-is-not-usize")
414+
.help("Translate size_t to platform-specific lengths."),
412415
Arg::with_name("no-rustfmt-bindings")
413416
.long("no-rustfmt-bindings")
414417
.help("Do not format the generated bindings with rustfmt."),
@@ -815,6 +818,16 @@ where
815818

816819
if matches.is_present("size_t-is-usize") {
817820
builder = builder.size_t_is_usize(true);
821+
if matches.is_present("size_t-is-not-usize") {
822+
return Err(Error::new(
823+
ErrorKind::Other,
824+
"Cannot supply both --size_t-is-usize and --size_t-is-not-usize",
825+
));
826+
}
827+
}
828+
829+
if matches.is_present("size_t-is-not-usize") {
830+
builder = builder.size_t_is_usize(false);
818831
}
819832

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

0 commit comments

Comments
 (0)