diff --git a/src/lib.rs b/src/lib.rs index 08b9381785..10ad8a12e9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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(), diff --git a/src/options.rs b/src/options.rs index a850dbbbfe..cefe6c03be 100644 --- a/src/options.rs +++ b/src/options.rs @@ -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."), @@ -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");