Skip to content

Use c_schar instead of c_char #559

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/codegen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2138,7 +2138,7 @@ impl ToRustTy for Type {
TypeKind::Int(ik) => {
match ik {
IntKind::Bool => aster::ty::TyBuilder::new().bool(),
IntKind::Char => raw_type(ctx, "c_char"),
IntKind::Char => raw_type(ctx, "c_schar"),
IntKind::UChar => raw_type(ctx, "c_uchar"),
IntKind::Short => raw_type(ctx, "c_short"),
IntKind::UShort => raw_type(ctx, "c_ushort"),
Expand Down
2 changes: 1 addition & 1 deletion tests/expectations/tests/arg_keyword.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@

extern "C" {
#[link_name = "_Z3fooPKc"]
pub fn foo(type_: *const ::std::os::raw::c_char);
pub fn foo(type_: *const ::std::os::raw::c_schar);
}
2 changes: 1 addition & 1 deletion tests/expectations/tests/bitfield-enum-basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl ::std::ops::BitOr<Buz> for Buz {
}
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct Buz(pub ::std::os::raw::c_char);
pub struct Buz(pub ::std::os::raw::c_schar);
pub const NS_FOO: _bindgen_ty_1 = _bindgen_ty_1(1);
pub const NS_BAR: _bindgen_ty_1 = _bindgen_ty_1(2);
impl ::std::ops::BitOr<_bindgen_ty_1> for _bindgen_ty_1 {
Expand Down
16 changes: 8 additions & 8 deletions tests/expectations/tests/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
#[repr(C)]
pub struct C {
pub a: ::std::os::raw::c_int,
pub big_array: [::std::os::raw::c_char; 33usize],
pub big_array: [::std::os::raw::c_schar; 33usize],
}
#[test]
fn bindgen_test_layout_C() {
Expand All @@ -88,8 +88,8 @@ impl Default for C {
#[repr(C)]
pub struct C_with_zero_length_array {
pub a: ::std::os::raw::c_int,
pub big_array: [::std::os::raw::c_char; 33usize],
pub zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>,
pub big_array: [::std::os::raw::c_schar; 33usize],
pub zero_length_array: __IncompleteArrayField<::std::os::raw::c_schar>,
}
#[test]
fn bindgen_test_layout_C_with_zero_length_array() {
Expand Down Expand Up @@ -124,8 +124,8 @@ impl Default for C_with_zero_length_array {
#[repr(C)]
pub struct C_with_incomplete_array {
pub a: ::std::os::raw::c_int,
pub big_array: [::std::os::raw::c_char; 33usize],
pub incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>,
pub big_array: [::std::os::raw::c_schar; 33usize],
pub incomplete_array: __IncompleteArrayField<::std::os::raw::c_schar>,
}
#[test]
fn bindgen_test_layout_C_with_incomplete_array() {
Expand All @@ -142,9 +142,9 @@ impl Default for C_with_incomplete_array {
#[repr(C)]
pub struct C_with_zero_length_array_and_incomplete_array {
pub a: ::std::os::raw::c_int,
pub big_array: [::std::os::raw::c_char; 33usize],
pub zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>,
pub incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>,
pub big_array: [::std::os::raw::c_schar; 33usize],
pub zero_length_array: __IncompleteArrayField<::std::os::raw::c_schar>,
pub incomplete_array: __IncompleteArrayField<::std::os::raw::c_schar>,
}
#[test]
fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array() {
Expand Down
2 changes: 1 addition & 1 deletion tests/expectations/tests/class_with_typedef.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub struct C {
pub other_ptr: *mut AnotherInt,
}
pub type C_MyInt = ::std::os::raw::c_int;
pub type C_Lookup = *const ::std::os::raw::c_char;
pub type C_Lookup = *const ::std::os::raw::c_schar;
#[test]
fn bindgen_test_layout_C() {
assert_eq!(::std::mem::size_of::<C>() , 72usize , concat ! (
Expand Down
4 changes: 2 additions & 2 deletions tests/expectations/tests/constant-evaluate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub const k: EasyToOverflow = 2147483648;
pub const k_expr: EasyToOverflow = 0;
pub const BAZ: ::std::os::raw::c_longlong = 24;
pub const fuzz: f64 = 51.;
pub const BAZZ: ::std::os::raw::c_char = 53;
pub const WAT: ::std::os::raw::c_char = 0;
pub const BAZZ: ::std::os::raw::c_schar = 53;
pub const WAT: ::std::os::raw::c_schar = 0;
pub const bytestring: &'static [u8; 4usize] = b"Foo\x00";
pub const NOT_UTF8: [u8; 5usize] = [240, 40, 140, 40, 0];
2 changes: 1 addition & 1 deletion tests/expectations/tests/inline_namespace_whitelist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ pub mod root {
pub mod std {
#[allow(unused_imports)]
use self::super::super::root;
pub type string = *const ::std::os::raw::c_char;
pub type string = *const ::std::os::raw::c_schar;
}
}
2 changes: 1 addition & 1 deletion tests/expectations/tests/issue-493.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub struct basic_string<_CharT, _Traits, _Allocator> {
pub _phantom_2: ::std::marker::PhantomData<_Allocator>,
}
pub type basic_string_size_type = ::std::os::raw::c_ulonglong;
pub type basic_string_value_type = ::std::os::raw::c_char;
pub type basic_string_value_type = ::std::os::raw::c_schar;
pub type basic_string_pointer = *mut basic_string_value_type;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion tests/expectations/tests/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl <T> ::std::marker::Copy for __IncompleteArrayField<T> { }
#[repr(C, packed)]
#[derive(Debug, Default, Copy)]
pub struct header {
pub proto: ::std::os::raw::c_char,
pub proto: ::std::os::raw::c_schar,
pub size: ::std::os::raw::c_uint,
pub data: __IncompleteArrayField<::std::os::raw::c_uchar>,
pub __bindgen_padding_0: [u8; 11usize],
Expand Down
2 changes: 1 addition & 1 deletion tests/expectations/tests/layout_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pub type rte_mempool_get_count =
#[derive(Debug, Copy)]
pub struct rte_mempool_ops {
/**< Name of mempool ops struct. */
pub name: [::std::os::raw::c_char; 32usize],
pub name: [::std::os::raw::c_schar; 32usize],
/**< Allocate private data. */
pub alloc: rte_mempool_alloc_t,
/**< Free the external pool. */
Expand Down
6 changes: 3 additions & 3 deletions tests/expectations/tests/layout_cmdline_token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pub struct cmdline_token_ops {
pub parse: ::std::option::Option<unsafe extern "C" fn(arg1:
*mut cmdline_parse_token_hdr_t,
arg2:
*const ::std::os::raw::c_char,
*const ::std::os::raw::c_schar,
arg3:
*mut ::std::os::raw::c_void,
arg4:
Expand All @@ -80,15 +80,15 @@ pub struct cmdline_token_ops {
arg2:
::std::os::raw::c_int,
arg3:
*mut ::std::os::raw::c_char,
*mut ::std::os::raw::c_schar,
arg4:
::std::os::raw::c_uint)
-> ::std::os::raw::c_int>,
/** get help for this token (token, dstbuf, size) */
pub get_help: ::std::option::Option<unsafe extern "C" fn(arg1:
*mut cmdline_parse_token_hdr_t,
arg2:
*mut ::std::os::raw::c_char,
*mut ::std::os::raw::c_schar,
arg3:
::std::os::raw::c_uint)
-> ::std::os::raw::c_int>,
Expand Down
10 changes: 5 additions & 5 deletions tests/expectations/tests/layout_kni_mbuf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ pub const RTE_CACHE_LINE_SIZE: ::std::os::raw::c_uint = 64;
pub struct rte_kni_mbuf {
pub buf_addr: *mut ::std::os::raw::c_void,
pub buf_physaddr: u64,
pub pad0: [::std::os::raw::c_char; 2usize],
pub pad0: [::std::os::raw::c_schar; 2usize],
/**< Start address of data in segment buffer. */
pub data_off: u16,
pub pad1: [::std::os::raw::c_char; 2usize],
pub pad1: [::std::os::raw::c_schar; 2usize],
/**< Number of segments. */
pub nb_segs: u8,
pub pad4: [::std::os::raw::c_char; 1usize],
pub pad4: [::std::os::raw::c_schar; 1usize],
/**< Offload features. */
pub ol_flags: u64,
pub pad2: [::std::os::raw::c_char; 4usize],
pub pad2: [::std::os::raw::c_schar; 4usize],
/**< Total pkt len: sum of all segment data_len. */
pub pkt_len: u32,
/**< Amount of data in segment buffer. */
pub data_len: u16,
pub __bindgen_padding_0: [u8; 22usize],
pub pad3: [::std::os::raw::c_char; 8usize],
pub pad3: [::std::os::raw::c_schar; 8usize],
pub pool: *mut ::std::os::raw::c_void,
pub next: *mut ::std::os::raw::c_void,
pub __bindgen_padding_1: [u64; 5usize],
Expand Down
4 changes: 2 additions & 2 deletions tests/expectations/tests/objc_method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub trait Foo {
unsafe fn methodWithArg1_andArg2_andArg3_(self,
intvalue: ::std::os::raw::c_int,
ptr:
*mut ::std::os::raw::c_char,
*mut ::std::os::raw::c_schar,
floatvalue: f32);
}
impl Foo for id {
Expand All @@ -40,7 +40,7 @@ impl Foo for id {
unsafe fn methodWithArg1_andArg2_andArg3_(self,
intvalue: ::std::os::raw::c_int,
ptr:
*mut ::std::os::raw::c_char,
*mut ::std::os::raw::c_schar,
floatvalue: f32) {
msg_send!(self ,
methodWithArg1:intvalue andArg2:ptr andArg3:floatvalue )
Expand Down
2 changes: 1 addition & 1 deletion tests/expectations/tests/overloading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

extern "C" {
#[link_name = "_Z8Evaluatec"]
pub fn Evaluate(r: ::std::os::raw::c_char) -> bool;
pub fn Evaluate(r: ::std::os::raw::c_schar) -> bool;
}
extern "C" {
#[link_name = "_Z8Evaluateii"]
Expand Down
2 changes: 1 addition & 1 deletion tests/expectations/tests/struct_with_packing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#[repr(C, packed)]
#[derive(Debug, Default, Copy)]
pub struct a {
pub b: ::std::os::raw::c_char,
pub b: ::std::os::raw::c_schar,
pub c: ::std::os::raw::c_short,
}
#[test]
Expand Down
2 changes: 1 addition & 1 deletion tests/expectations/tests/union_with_big_member.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl Default for WithBigArray {
#[derive(Debug, Default, Copy)]
pub struct WithBigArray2 {
pub a: __BindgenUnionField<::std::os::raw::c_int>,
pub b: __BindgenUnionField<[::std::os::raw::c_char; 33usize]>,
pub b: __BindgenUnionField<[::std::os::raw::c_schar; 33usize]>,
pub bindgen_union_field: [u32; 9usize],
}
#[test]
Expand Down
4 changes: 2 additions & 2 deletions tests/expectations/tests/variadic-method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

extern "C" {
#[link_name = "_Z3fooPKcz"]
pub fn foo(fmt: *const ::std::os::raw::c_char, ...);
pub fn foo(fmt: *const ::std::os::raw::c_schar, ...);
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
Expand All @@ -22,7 +22,7 @@ fn bindgen_test_layout_Bar() {
}
extern "C" {
#[link_name = "_ZN3Bar3fooEPKcz"]
pub fn Bar_foo(this: *mut Bar, fmt: *const ::std::os::raw::c_char, ...);
pub fn Bar_foo(this: *mut Bar, fmt: *const ::std::os::raw::c_schar, ...);
}
impl Clone for Bar {
fn clone(&self) -> Self { *self }
Expand Down