Skip to content
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

build script: adjust build for ppcle64 #410

Merged
merged 2 commits into from
Dec 2, 2019
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
119 changes: 115 additions & 4 deletions grpc-sys/bindings/x86_64-unknown-linux-gnu-bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,6 @@ pub const GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR: &'static [u8; 33usize] =
pub const GRPC_GOOGLE_CREDENTIALS_ENV_VAR: &'static [u8; 31usize] =
b"GOOGLE_APPLICATION_CREDENTIALS\0";
pub const GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX: u32 = 4;
pub type __uint8_t = ::std::os::raw::c_uchar;
pub type __int32_t = ::std::os::raw::c_int;
pub type __uint32_t = ::std::os::raw::c_uint;
pub type __int64_t = ::std::os::raw::c_long;
#[repr(u32)]
#[doc = " The various compression algorithms supported by gRPC"]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
Expand Down Expand Up @@ -636,6 +632,11 @@ fn bindgen_test_layout_grpc_slice_grpc_slice_data() {
)
);
}
impl ::std::fmt::Debug for grpc_slice_grpc_slice_data {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
write!(f, "grpc_slice_grpc_slice_data {{ union }}")
}
}
#[test]
fn bindgen_test_layout_grpc_slice() {
assert_eq!(
Expand Down Expand Up @@ -669,6 +670,15 @@ fn bindgen_test_layout_grpc_slice() {
)
);
}
impl ::std::fmt::Debug for grpc_slice {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
write!(
f,
"grpc_slice {{ refcount: {:?}, data: {:?} }}",
self.refcount, self.data
)
}
}
#[doc = " Represents an expandable array of slices, to be interpreted as a"]
#[doc = "single item."]
#[repr(C)]
Expand Down Expand Up @@ -762,6 +772,11 @@ fn bindgen_test_layout_grpc_slice_buffer() {
)
);
}
impl ::std::fmt::Debug for grpc_slice_buffer {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
write ! ( f , "grpc_slice_buffer {{ base_slices: {:?}, slices: {:?}, count: {:?}, capacity: {:?}, length: {:?}, inlined: {:?} }}" , self . base_slices , self . slices , self . count , self . capacity , self . length , self . inlined )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The format looks weird.

}
}
#[repr(u32)]
#[doc = " The clocks we support."]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
Expand Down Expand Up @@ -844,6 +859,7 @@ extern "C" {
) -> gpr_atm;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct gpr_event {
pub state: gpr_atm,
}
Expand Down Expand Up @@ -871,6 +887,7 @@ fn bindgen_test_layout_gpr_event() {
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct gpr_refcount {
pub count: gpr_atm,
}
Expand Down Expand Up @@ -898,6 +915,7 @@ fn bindgen_test_layout_gpr_refcount() {
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct gpr_stats_counter {
pub value: gpr_atm,
}
Expand Down Expand Up @@ -1468,6 +1486,11 @@ fn bindgen_test_layout_grpc_byte_buffer_grpc_byte_buffer_data_grpc_compressed_bu
)
);
}
impl ::std::fmt::Debug for grpc_byte_buffer_grpc_byte_buffer_data_grpc_compressed_buffer {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
write ! ( f , "grpc_byte_buffer_grpc_byte_buffer_data_grpc_compressed_buffer {{ compression: {:?}, slice_buffer: {:?} }}" , self . compression , self . slice_buffer )
}
}
#[test]
fn bindgen_test_layout_grpc_byte_buffer_grpc_byte_buffer_data() {
assert_eq!(
Expand Down Expand Up @@ -1513,6 +1536,11 @@ fn bindgen_test_layout_grpc_byte_buffer_grpc_byte_buffer_data() {
)
);
}
impl ::std::fmt::Debug for grpc_byte_buffer_grpc_byte_buffer_data {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
write!(f, "grpc_byte_buffer_grpc_byte_buffer_data {{ union }}")
}
}
#[test]
fn bindgen_test_layout_grpc_byte_buffer() {
assert_eq!(
Expand Down Expand Up @@ -1556,6 +1584,15 @@ fn bindgen_test_layout_grpc_byte_buffer() {
)
);
}
impl ::std::fmt::Debug for grpc_byte_buffer {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
write!(
f,
"grpc_byte_buffer {{ reserved: {:?}, type: {:?}, data: {:?} }}",
self.reserved, self.type_, self.data
)
}
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct grpc_completion_queue {
Expand Down Expand Up @@ -1777,6 +1814,11 @@ fn bindgen_test_layout_grpc_arg_grpc_arg_value() {
)
);
}
impl ::std::fmt::Debug for grpc_arg_grpc_arg_value {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
write!(f, "grpc_arg_grpc_arg_value {{ union }}")
}
}
#[test]
fn bindgen_test_layout_grpc_arg() {
assert_eq!(
Expand Down Expand Up @@ -1820,6 +1862,15 @@ fn bindgen_test_layout_grpc_arg() {
)
);
}
impl ::std::fmt::Debug for grpc_arg {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
write!(
f,
"grpc_arg {{ type: {:?}, key: {:?}, value: {:?} }}",
self.type_, self.key, self.value
)
}
}
#[doc = " An array of arguments that can be passed around."]
#[doc = ""]
#[doc = "Used to set optional channel-level configuration."]
Expand Down Expand Up @@ -2014,6 +2065,15 @@ fn bindgen_test_layout_grpc_metadata() {
)
);
}
impl ::std::fmt::Debug for grpc_metadata {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
write!(
f,
"grpc_metadata {{ key: {:?}, value: {:?}, flags: {:?}, internal_data: {:?} }}",
self.key, self.value, self.flags, self.internal_data
)
}
}
#[repr(u32)]
#[doc = " The type of completion (for grpc_event)"]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
Expand Down Expand Up @@ -2208,6 +2268,11 @@ fn bindgen_test_layout_grpc_call_details() {
)
);
}
impl ::std::fmt::Debug for grpc_call_details {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
write ! ( f , "grpc_call_details {{ method: {:?}, host: {:?}, deadline: {:?}, flags: {:?}, reserved: {:?} }}" , self . method , self . host , self . deadline , self . flags , self . reserved )
}
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum grpc_op_type {
Expand Down Expand Up @@ -2834,6 +2899,11 @@ fn bindgen_test_layout_grpc_op_grpc_op_data() {
)
);
}
impl ::std::fmt::Debug for grpc_op_grpc_op_data {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
write!(f, "grpc_op_grpc_op_data {{ union }}")
}
}
#[test]
fn bindgen_test_layout_grpc_op() {
assert_eq!(
Expand Down Expand Up @@ -2887,6 +2957,15 @@ fn bindgen_test_layout_grpc_op() {
)
);
}
impl ::std::fmt::Debug for grpc_op {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
write!(
f,
"grpc_op {{ op: {:?}, flags: {:?}, reserved: {:?}, data: {:?} }}",
self.op, self.flags, self.reserved, self.data
)
}
}
#[doc = " Information requested from the channel."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
Expand Down Expand Up @@ -5429,6 +5508,14 @@ fn bindgen_test_layout_grpc_byte_buffer_reader_grpc_byte_buffer_reader_current()
)
);
}
impl ::std::fmt::Debug for grpc_byte_buffer_reader_grpc_byte_buffer_reader_current {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
write!(
f,
"grpc_byte_buffer_reader_grpc_byte_buffer_reader_current {{ union }}"
)
}
}
#[test]
fn bindgen_test_layout_grpc_byte_buffer_reader() {
assert_eq!(
Expand Down Expand Up @@ -5476,6 +5563,15 @@ fn bindgen_test_layout_grpc_byte_buffer_reader() {
)
);
}
impl ::std::fmt::Debug for grpc_byte_buffer_reader {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
write!(
f,
"grpc_byte_buffer_reader {{ buffer_in: {:?}, buffer_out: {:?}, current: {:?} }}",
self.buffer_in, self.buffer_out, self.current
)
}
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct grpcwrap_batch_context {
Expand Down Expand Up @@ -5589,6 +5685,11 @@ fn bindgen_test_layout_grpcwrap_batch_context__bindgen_ty_2() {
)
);
}
impl ::std::fmt::Debug for grpcwrap_batch_context__bindgen_ty_2 {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
write ! ( f , "grpcwrap_batch_context__bindgen_ty_2 {{ trailing_metadata: {:?}, status: {:?}, status_details: {:?} }}" , self . trailing_metadata , self . status , self . status_details )
}
}
#[test]
fn bindgen_test_layout_grpcwrap_batch_context() {
assert_eq!(
Expand Down Expand Up @@ -5691,6 +5792,11 @@ fn bindgen_test_layout_grpcwrap_batch_context() {
)
);
}
impl ::std::fmt::Debug for grpcwrap_batch_context {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
write ! ( f , "grpcwrap_batch_context {{ send_initial_metadata: {:?}, send_message: {:?}, send_status_from_server: {:?}, recv_initial_metadata: {:?}, recv_message: {:?}, recv_status_on_client: {:?}, recv_close_on_server_cancelled: {:?} }}" , self . send_initial_metadata , self . send_message , self . send_status_from_server , self . recv_initial_metadata , self . recv_message , self . recv_status_on_client , self . recv_close_on_server_cancelled )
}
}
extern "C" {
pub fn grpcwrap_batch_context_create() -> *mut grpcwrap_batch_context;
}
Expand Down Expand Up @@ -5752,6 +5858,11 @@ fn bindgen_test_layout_grpcwrap_request_call_context() {
)
);
}
impl ::std::fmt::Debug for grpcwrap_request_call_context {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
write ! ( f , "grpcwrap_request_call_context {{ call: {:?}, call_details: {:?}, request_metadata: {:?} }}" , self . call , self . call_details , self . request_metadata )
}
}
extern "C" {
pub fn grpcwrap_request_call_context_create() -> *mut grpcwrap_request_call_context;
}
Expand Down
9 changes: 3 additions & 6 deletions grpc-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,8 @@ fn bindgen_grpc(mut config: bindgen::Builder, file_path: &PathBuf) {
.clang_arg("-xc++")
.clang_arg("-I./grpc/include")
.clang_arg("-std=c++11")
.whitelist_recursively(false)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does it resolve?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If recusive is false, all basic types have to be whitelisted explicitly due to limitation of rust-lang/rust-bindgen#1454.

.rustfmt_bindings(true)
.impl_debug(true)
.whitelist_function(r"\bgrpc_.*")
.whitelist_function(r"\bgpr_.*")
.whitelist_function(r"\bgrpcwrap_.*")
Expand All @@ -298,11 +299,7 @@ fn bindgen_grpc(mut config: bindgen::Builder, file_path: &PathBuf) {
.whitelist_type(r"\bgrpcwrap_.*")
.whitelist_type(r"\bcensus_context.*")
.whitelist_type(r"\bverify_peer_options.*")
.whitelist_type(r"(__)?uint8_t")
.whitelist_type(r"(__darwin_)?size_t")
.whitelist_type(r"(__)?uint32_t")
.whitelist_type(r"(__)?int64_t")
.whitelist_type(r"(__)?int32_t")
.blacklist_type(r"(__)?pthread.*")
.blacklist_function(r"\bgpr_mu_.*")
.blacklist_function(r"\bgpr_cv_.*")
.blacklist_function(r"\bgpr_once_.*")
Expand Down
3 changes: 3 additions & 0 deletions scripts/generate-bindings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
export UPDATE_BIND=1
cargo build -p grpcio-sys --target x86_64-unknown-linux-gnu
rustfmt grpc-sys/bindings/*
if [ "$(uname -s)" == "Linux" ]; then
sed -i '/pub type .*= ::std::os::raw::.*/d' grpc-sys/bindings/*
fi