diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ae2a5e4..be9f1d1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-2019] - features: [default, bundled] + features: [default, bundled, buildtime_bindgen] runs-on: ${{ matrix.os }} steps: - name: Checkout sources @@ -33,6 +33,7 @@ jobs: run: | echo "RUSTFLAGS=-D warnings" >> $GITHUB_ENV echo "RUSTDOCFLAGS=-D warnings" >> $GITHUB_ENV + echo "BINDGEN_EXTRA_CLANG_ARGS=-I./pq-src/source/src/interfaces/libpq/ -I./pq-src/source/src/include/" >> $GITHUB_ENV - name: Install postgres (Linux) if: runner.os == 'Linux' && matrix.features == 'default' run: | diff --git a/Cargo.toml b/Cargo.toml index 43a1b0b..84de9ab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,10 +14,11 @@ members = ["pq-src"] name = "pq_sys" [dependencies] -pq-src = { path = "pq-src", optional = true } +pq-src = { path = "pq-src", version = "0.1", optional = true } [build-dependencies] pkg-config = { version = "0.3.0", optional = true } +bindgen = { version = "0.69.1", optional = true } [target.'cfg(target_env = "msvc")'.build-dependencies] vcpkg = "0.2.6" @@ -25,3 +26,4 @@ vcpkg = "0.2.6" [features] default = [] bundled = ["pq-src"] +buildtime_bindgen = ["dep:bindgen"] diff --git a/build.rs b/build.rs index c91cb04..669353f 100644 --- a/build.rs +++ b/build.rs @@ -1,17 +1,17 @@ -#[cfg(feature="pkg-config")] +#[cfg(feature = "pkg-config")] extern crate pkg_config; #[cfg(target_env = "msvc")] extern crate vcpkg; -use std::process::Command; use std::env; -use std::path::PathBuf; use std::fmt::{self, Display}; +use std::path::PathBuf; +use std::process::Command; enum LinkType { Static, - Dynamic + Dynamic, } impl Display for LinkType { @@ -32,19 +32,19 @@ impl LinkingOptions { fn from_name_and_type(lib_name: &'static str, tpe: LinkType) -> Self { LinkingOptions { linking_type: Some(tpe), - lib_name + lib_name, } } fn from_name(lib_name: &'static str) -> Self { LinkingOptions { linking_type: None, - lib_name + lib_name, } } fn from_env() -> Self { // On Windows-MSVC, always link dynamically - if cfg!(all(windows, target_env="msvc")) { + if cfg!(all(windows, target_env = "msvc")) { return LinkingOptions::from_name_and_type("libpq", LinkType::Dynamic); } @@ -55,7 +55,10 @@ impl LinkingOptions { // Examine the per-target env vars if let Ok(target) = env::var("TARGET") { - let pg_config_for_target = format!("PQ_LIB_STATIC_{}", target.to_ascii_uppercase().replace("-", "_")); + let pg_config_for_target = format!( + "PQ_LIB_STATIC_{}", + target.to_ascii_uppercase().replace("-", "_") + ); println!("cargo:rerun-if-env-changed={}", pg_config_for_target); if env::var_os(&pg_config_for_target).is_some() { return LinkingOptions::from_name_and_type("pq", LinkType::Static); @@ -77,11 +80,28 @@ impl Display for LinkingOptions { } fn main() { + if cfg!(feature = "bundled") && cfg!(feature = "buildtime_bindgen") { + panic!("Combining the `bundled` and `builtime_bindgen` feature is not supported"); + } if cfg!(feature = "bundled") { - // everything else is handled + // everything else is handled // by pq-src return; } + #[cfg(feature = "buildtime_bindgen")] + { + let bindings = bindgen::Builder::default() + .rustified_enum(".*") + .header("wrapper.h") + .parse_callbacks(Box::new(bindgen::CargoCallbacks::new())) + .generate() + .expect("Unable to generate bindings"); + + let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); + bindings + .write_to_file(out_path.join("bindings.rs")) + .expect("Couldn't write bindings!"); + } #[cfg(target_os = "windows")] println!("cargo:rustc-link-lib=libpq"); @@ -92,19 +112,22 @@ fn main() { // if target is specified the more concrete pq_lib_dir overwrites a more general one let lib_dir = if let Ok(target) = env::var("TARGET") { - let pq_lib_dir_for_target = format!("PQ_LIB_DIR_{}", target.to_ascii_uppercase().replace("-", "_")); - check_and_use_lib_dir(&pq_lib_dir_for_target).or_else(|_| check_and_use_lib_dir("PQ_LIB_DIR")) - } - else{ + let pq_lib_dir_for_target = format!( + "PQ_LIB_DIR_{}", + target.to_ascii_uppercase().replace("-", "_") + ); + check_and_use_lib_dir(&pq_lib_dir_for_target) + .or_else(|_| check_and_use_lib_dir("PQ_LIB_DIR")) + } else { check_and_use_lib_dir("PQ_LIB_DIR") }; if let Ok(lib_dir) = lib_dir { println!("cargo:rustc-link-search=native={}", lib_dir); } else if configured_by_pkg_config() { - return // pkg_config does everything for us, including output for cargo + return; // pkg_config does everything for us, including output for cargo } else if configured_by_vcpkg() { - return // vcpkg does everything for us, including output for cargo + return; // vcpkg does everything for us, including output for cargo } else if let Some(path) = pg_config_output("--libdir") { let path = replace_homebrew_path_on_mac(path); println!("cargo:rustc-link-search=native={}", path); @@ -124,14 +147,16 @@ fn configured_by_pkg_config() -> bool { #[cfg(target_env = "msvc")] fn configured_by_vcpkg() -> bool { - vcpkg::find_package("libpq").map(|_| { - println!("cargo:rustc-link-lib=crypt32"); - println!("cargo:rustc-link-lib=gdi32"); - println!("cargo:rustc-link-lib=user32"); - println!("cargo:rustc-link-lib=secur32"); - println!("cargo:rustc-link-lib=shell32"); - println!("cargo:rustc-link-lib=wldap32"); - }).is_ok() + vcpkg::find_package("libpq") + .map(|_| { + println!("cargo:rustc-link-lib=crypt32"); + println!("cargo:rustc-link-lib=gdi32"); + println!("cargo:rustc-link-lib=user32"); + println!("cargo:rustc-link-lib=secur32"); + println!("cargo:rustc-link-lib=shell32"); + println!("cargo:rustc-link-lib=wldap32"); + }) + .is_ok() } #[cfg(not(target_env = "msvc"))] @@ -139,15 +164,18 @@ fn configured_by_vcpkg() -> bool { false } -fn check_and_use_lib_dir(var_name: &str) -> Result{ +fn check_and_use_lib_dir(var_name: &str) -> Result { println!("cargo:rerun-if-env-changed={:?}", var_name); - println!("{:?} = {:?}", var_name , env::var(var_name)); + println!("{:?} = {:?}", var_name, env::var(var_name)); let pq_lib_dir = env::var(var_name); if let Ok(pg_lib_path) = pq_lib_dir.clone() { - let path = PathBuf::from(&pg_lib_path); + let path = PathBuf::from(&pg_lib_path); if !path.exists() { - panic!("Folder {:?} doesn't exist in the configured path: {:?}", var_name, path); + panic!( + "Folder {:?} doesn't exist in the configured path: {:?}", + var_name, path + ); } } pq_lib_dir @@ -155,11 +183,13 @@ fn check_and_use_lib_dir(var_name: &str) -> Result{ fn pg_config_path() -> PathBuf { if let Ok(target) = env::var("TARGET") { - let pg_config_for_target = &format!("PG_CONFIG_{}", target.to_ascii_uppercase().replace("-", "_")); + let pg_config_for_target = &format!( + "PG_CONFIG_{}", + target.to_ascii_uppercase().replace("-", "_") + ); println!("cargo:rerun-if-env-changed={}", pg_config_for_target); if let Some(pg_config_path) = env::var_os(pg_config_for_target) { - - let path = PathBuf::from(&pg_config_path); + let path = PathBuf::from(&pg_config_path); if !path.exists() { panic!("pg_config doesn't exist in the configured path: {:?}", path); diff --git a/src/bindings.rs b/src/bindings.rs index 158cc50..e680cf8 100644 --- a/src/bindings.rs +++ b/src/bindings.rs @@ -1,121 +1,1317 @@ -#![allow(non_camel_case_types, non_snake_case, non_upper_case_globals)] - -/* automatically generated by rust-bindgen */ +/* automatically generated by rust-bindgen 0.69.1 */ +pub const _STDIO_H: u32 = 1; +pub const _FEATURES_H: u32 = 1; +pub const _DEFAULT_SOURCE: u32 = 1; +pub const __GLIBC_USE_ISOC2X: u32 = 0; +pub const __USE_ISOC11: u32 = 1; +pub const __USE_ISOC99: u32 = 1; +pub const __USE_ISOC95: u32 = 1; +pub const __USE_POSIX_IMPLICITLY: u32 = 1; +pub const _POSIX_SOURCE: u32 = 1; +pub const _POSIX_C_SOURCE: u32 = 200809; +pub const __USE_POSIX: u32 = 1; +pub const __USE_POSIX2: u32 = 1; +pub const __USE_POSIX199309: u32 = 1; +pub const __USE_POSIX199506: u32 = 1; +pub const __USE_XOPEN2K: u32 = 1; +pub const __USE_XOPEN2K8: u32 = 1; +pub const _ATFILE_SOURCE: u32 = 1; +pub const __WORDSIZE: u32 = 64; +pub const __WORDSIZE_TIME64_COMPAT32: u32 = 1; +pub const __SYSCALL_WORDSIZE: u32 = 64; +pub const __TIMESIZE: u32 = 64; +pub const __USE_MISC: u32 = 1; +pub const __USE_ATFILE: u32 = 1; +pub const __USE_FORTIFY_LEVEL: u32 = 0; +pub const __GLIBC_USE_DEPRECATED_GETS: u32 = 0; +pub const __GLIBC_USE_DEPRECATED_SCANF: u32 = 0; +pub const __GLIBC_USE_C2X_STRTOL: u32 = 0; +pub const _STDC_PREDEF_H: u32 = 1; +pub const __STDC_IEC_559__: u32 = 1; +pub const __STDC_IEC_60559_BFP__: u32 = 201404; +pub const __STDC_IEC_559_COMPLEX__: u32 = 1; +pub const __STDC_IEC_60559_COMPLEX__: u32 = 201404; +pub const __STDC_ISO_10646__: u32 = 201706; +pub const __GNU_LIBRARY__: u32 = 6; +pub const __GLIBC__: u32 = 2; +pub const __GLIBC_MINOR__: u32 = 38; +pub const _SYS_CDEFS_H: u32 = 1; +pub const __glibc_c99_flexarr_available: u32 = 1; +pub const __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI: u32 = 0; +pub const __HAVE_GENERIC_SELECTION: u32 = 1; +pub const __GLIBC_USE_LIB_EXT2: u32 = 0; +pub const __GLIBC_USE_IEC_60559_BFP_EXT: u32 = 0; +pub const __GLIBC_USE_IEC_60559_BFP_EXT_C2X: u32 = 0; +pub const __GLIBC_USE_IEC_60559_EXT: u32 = 0; +pub const __GLIBC_USE_IEC_60559_FUNCS_EXT: u32 = 0; +pub const __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X: u32 = 0; +pub const __GLIBC_USE_IEC_60559_TYPES_EXT: u32 = 0; +pub const _BITS_TYPES_H: u32 = 1; +pub const _BITS_TYPESIZES_H: u32 = 1; +pub const __OFF_T_MATCHES_OFF64_T: u32 = 1; +pub const __INO_T_MATCHES_INO64_T: u32 = 1; +pub const __RLIM_T_MATCHES_RLIM64_T: u32 = 1; +pub const __STATFS_MATCHES_STATFS64: u32 = 1; +pub const __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64: u32 = 1; +pub const __FD_SETSIZE: u32 = 1024; +pub const _BITS_TIME64_H: u32 = 1; +pub const _____fpos_t_defined: u32 = 1; +pub const ____mbstate_t_defined: u32 = 1; +pub const _____fpos64_t_defined: u32 = 1; +pub const ____FILE_defined: u32 = 1; +pub const __FILE_defined: u32 = 1; +pub const __struct_FILE_defined: u32 = 1; +pub const _IO_EOF_SEEN: u32 = 16; +pub const _IO_ERR_SEEN: u32 = 32; +pub const _IO_USER_LOCK: u32 = 32768; +pub const __cookie_io_functions_t_defined: u32 = 1; +pub const _IOFBF: u32 = 0; +pub const _IOLBF: u32 = 1; +pub const _IONBF: u32 = 2; +pub const BUFSIZ: u32 = 8192; +pub const EOF: i32 = -1; +pub const SEEK_SET: u32 = 0; +pub const SEEK_CUR: u32 = 1; +pub const SEEK_END: u32 = 2; +pub const P_tmpdir: &[u8; 5] = b"/tmp\0"; +pub const L_tmpnam: u32 = 20; +pub const TMP_MAX: u32 = 238328; +pub const _BITS_STDIO_LIM_H: u32 = 1; +pub const FILENAME_MAX: u32 = 4096; +pub const L_ctermid: u32 = 9; +pub const FOPEN_MAX: u32 = 16; +pub const __HAVE_FLOAT128: u32 = 0; +pub const __HAVE_DISTINCT_FLOAT128: u32 = 0; +pub const __HAVE_FLOAT64X: u32 = 1; +pub const __HAVE_FLOAT64X_LONG_DOUBLE: u32 = 1; +pub const __HAVE_FLOAT16: u32 = 0; +pub const __HAVE_FLOAT32: u32 = 1; +pub const __HAVE_FLOAT64: u32 = 1; +pub const __HAVE_FLOAT32X: u32 = 1; +pub const __HAVE_FLOAT128X: u32 = 0; +pub const __HAVE_DISTINCT_FLOAT16: u32 = 0; +pub const __HAVE_DISTINCT_FLOAT32: u32 = 0; +pub const __HAVE_DISTINCT_FLOAT64: u32 = 0; +pub const __HAVE_DISTINCT_FLOAT32X: u32 = 0; +pub const __HAVE_DISTINCT_FLOAT64X: u32 = 0; +pub const __HAVE_DISTINCT_FLOAT128X: u32 = 0; +pub const __HAVE_FLOATN_NOT_TYPEDEF: u32 = 0; +pub const PG_DIAG_SEVERITY: u8 = 83u8; +pub const PG_DIAG_SEVERITY_NONLOCALIZED: u8 = 86u8; +pub const PG_DIAG_SQLSTATE: u8 = 67u8; +pub const PG_DIAG_MESSAGE_PRIMARY: u8 = 77u8; +pub const PG_DIAG_MESSAGE_DETAIL: u8 = 68u8; +pub const PG_DIAG_MESSAGE_HINT: u8 = 72u8; +pub const PG_DIAG_STATEMENT_POSITION: u8 = 80u8; +pub const PG_DIAG_INTERNAL_POSITION: u8 = 112u8; +pub const PG_DIAG_INTERNAL_QUERY: u8 = 113u8; +pub const PG_DIAG_CONTEXT: u8 = 87u8; +pub const PG_DIAG_SCHEMA_NAME: u8 = 115u8; +pub const PG_DIAG_TABLE_NAME: u8 = 116u8; +pub const PG_DIAG_COLUMN_NAME: u8 = 99u8; +pub const PG_DIAG_DATATYPE_NAME: u8 = 100u8; +pub const PG_DIAG_CONSTRAINT_NAME: u8 = 110u8; +pub const PG_DIAG_SOURCE_FILE: u8 = 70u8; +pub const PG_DIAG_SOURCE_LINE: u8 = 76u8; +pub const PG_DIAG_SOURCE_FUNCTION: u8 = 82u8; +pub const LIBPQ_HAS_PIPELINING: u32 = 1; +pub const LIBPQ_HAS_TRACE_FLAGS: u32 = 1; +pub const LIBPQ_HAS_SSL_LIBRARY_DETECTION: u32 = 1; +pub const PG_COPYRES_ATTRS: u32 = 1; +pub const PG_COPYRES_TUPLES: u32 = 2; +pub const PG_COPYRES_EVENTS: u32 = 4; +pub const PG_COPYRES_NOTICEHOOKS: u32 = 8; +pub const PQTRACE_SUPPRESS_TIMESTAMPS: u32 = 1; +pub const PQTRACE_REGRESS_MODE: u32 = 2; +pub const PQ_QUERY_PARAM_MAX_LIMIT: u32 = 65535; +pub const PQnoPasswordSupplied: &[u8; 35] = b"fe_sendauth: no password supplied\n\0"; +pub type __gnuc_va_list = __builtin_va_list; +pub type __u_char = ::std::os::raw::c_uchar; +pub type __u_short = ::std::os::raw::c_ushort; +pub type __u_int = ::std::os::raw::c_uint; +pub type __u_long = ::std::os::raw::c_ulong; +pub type __int8_t = ::std::os::raw::c_schar; +pub type __uint8_t = ::std::os::raw::c_uchar; +pub type __int16_t = ::std::os::raw::c_short; +pub type __uint16_t = ::std::os::raw::c_ushort; +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; +pub type __uint64_t = ::std::os::raw::c_ulong; +pub type __int_least8_t = __int8_t; +pub type __uint_least8_t = __uint8_t; +pub type __int_least16_t = __int16_t; +pub type __uint_least16_t = __uint16_t; +pub type __int_least32_t = __int32_t; +pub type __uint_least32_t = __uint32_t; +pub type __int_least64_t = __int64_t; +pub type __uint_least64_t = __uint64_t; +pub type __quad_t = ::std::os::raw::c_long; +pub type __u_quad_t = ::std::os::raw::c_ulong; +pub type __intmax_t = ::std::os::raw::c_long; +pub type __uintmax_t = ::std::os::raw::c_ulong; +pub type __dev_t = ::std::os::raw::c_ulong; +pub type __uid_t = ::std::os::raw::c_uint; +pub type __gid_t = ::std::os::raw::c_uint; +pub type __ino_t = ::std::os::raw::c_ulong; +pub type __ino64_t = ::std::os::raw::c_ulong; +pub type __mode_t = ::std::os::raw::c_uint; +pub type __nlink_t = ::std::os::raw::c_ulong; +pub type __off_t = ::std::os::raw::c_long; +pub type __off64_t = ::std::os::raw::c_long; +pub type __pid_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __fsid_t { + pub __val: [::std::os::raw::c_int; 2usize], +} +#[test] +fn bindgen_test_layout___fsid_t() { + const UNINIT: ::std::mem::MaybeUninit<__fsid_t> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<__fsid_t>(), + 8usize, + concat!("Size of: ", stringify!(__fsid_t)) + ); + assert_eq!( + ::std::mem::align_of::<__fsid_t>(), + 4usize, + concat!("Alignment of ", stringify!(__fsid_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__val) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__fsid_t), + "::", + stringify!(__val) + ) + ); +} +pub type __clock_t = ::std::os::raw::c_long; +pub type __rlim_t = ::std::os::raw::c_ulong; +pub type __rlim64_t = ::std::os::raw::c_ulong; +pub type __id_t = ::std::os::raw::c_uint; +pub type __time_t = ::std::os::raw::c_long; +pub type __useconds_t = ::std::os::raw::c_uint; +pub type __suseconds_t = ::std::os::raw::c_long; +pub type __suseconds64_t = ::std::os::raw::c_long; +pub type __daddr_t = ::std::os::raw::c_int; +pub type __key_t = ::std::os::raw::c_int; +pub type __clockid_t = ::std::os::raw::c_int; +pub type __timer_t = *mut ::std::os::raw::c_void; +pub type __blksize_t = ::std::os::raw::c_long; +pub type __blkcnt_t = ::std::os::raw::c_long; +pub type __blkcnt64_t = ::std::os::raw::c_long; +pub type __fsblkcnt_t = ::std::os::raw::c_ulong; +pub type __fsblkcnt64_t = ::std::os::raw::c_ulong; +pub type __fsfilcnt_t = ::std::os::raw::c_ulong; +pub type __fsfilcnt64_t = ::std::os::raw::c_ulong; +pub type __fsword_t = ::std::os::raw::c_long; +pub type __ssize_t = ::std::os::raw::c_long; +pub type __syscall_slong_t = ::std::os::raw::c_long; +pub type __syscall_ulong_t = ::std::os::raw::c_ulong; +pub type __loff_t = __off64_t; +pub type __caddr_t = *mut ::std::os::raw::c_char; +pub type __intptr_t = ::std::os::raw::c_long; +pub type __socklen_t = ::std::os::raw::c_uint; +pub type __sig_atomic_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct __mbstate_t { + pub __count: ::std::os::raw::c_int, + pub __value: __mbstate_t__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union __mbstate_t__bindgen_ty_1 { + pub __wch: ::std::os::raw::c_uint, + pub __wchb: [::std::os::raw::c_char; 4usize], +} +#[test] +fn bindgen_test_layout___mbstate_t__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit<__mbstate_t__bindgen_ty_1> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<__mbstate_t__bindgen_ty_1>(), + 4usize, + concat!("Size of: ", stringify!(__mbstate_t__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::<__mbstate_t__bindgen_ty_1>(), + 4usize, + concat!("Alignment of ", stringify!(__mbstate_t__bindgen_ty_1)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__wch) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__mbstate_t__bindgen_ty_1), + "::", + stringify!(__wch) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__wchb) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__mbstate_t__bindgen_ty_1), + "::", + stringify!(__wchb) + ) + ); +} +#[test] +fn bindgen_test_layout___mbstate_t() { + const UNINIT: ::std::mem::MaybeUninit<__mbstate_t> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<__mbstate_t>(), + 8usize, + concat!("Size of: ", stringify!(__mbstate_t)) + ); + assert_eq!( + ::std::mem::align_of::<__mbstate_t>(), + 4usize, + concat!("Alignment of ", stringify!(__mbstate_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__count) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__mbstate_t), + "::", + stringify!(__count) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__value) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(__mbstate_t), + "::", + stringify!(__value) + ) + ); +} #[repr(C)] -pub struct __BindgenUnionField(::std::marker::PhantomData); -impl __BindgenUnionField { - #[inline] - pub fn new() -> Self { __BindgenUnionField(::std::marker::PhantomData) } - #[inline] - pub unsafe fn as_ref(&self) -> &T { ::std::mem::transmute(self) } - #[inline] - pub unsafe fn as_mut(&mut self) -> &mut T { ::std::mem::transmute(self) } -} -impl ::std::default::Default for __BindgenUnionField { - #[inline] - fn default() -> Self { Self::new() } -} -impl ::std::clone::Clone for __BindgenUnionField { - #[inline] - fn clone(&self) -> Self { Self::new() } -} -impl ::std::marker::Copy for __BindgenUnionField { } -impl ::std::fmt::Debug for __BindgenUnionField { - fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - fmt.write_str("__BindgenUnionField") - } -} -pub type __int64_t = ::std::os::raw::c_longlong; -pub type __darwin_size_t = ::std::os::raw::c_ulong; -pub type __darwin_off_t = __int64_t; -pub type fpos_t = __darwin_off_t; +#[derive(Copy, Clone)] +pub struct _G_fpos_t { + pub __pos: __off_t, + pub __state: __mbstate_t, +} +#[test] +fn bindgen_test_layout__G_fpos_t() { + const UNINIT: ::std::mem::MaybeUninit<_G_fpos_t> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<_G_fpos_t>(), + 16usize, + concat!("Size of: ", stringify!(_G_fpos_t)) + ); + assert_eq!( + ::std::mem::align_of::<_G_fpos_t>(), + 8usize, + concat!("Alignment of ", stringify!(_G_fpos_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__pos) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_G_fpos_t), + "::", + stringify!(__pos) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__state) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_G_fpos_t), + "::", + stringify!(__state) + ) + ); +} +pub type __fpos_t = _G_fpos_t; #[repr(C)] -#[derive(Debug, Copy)] -pub struct __sbuf { - pub _base: *mut ::std::os::raw::c_uchar, - pub _size: ::std::os::raw::c_int, +#[derive(Copy, Clone)] +pub struct _G_fpos64_t { + pub __pos: __off64_t, + pub __state: __mbstate_t, } #[test] -fn bindgen_test_layout___sbuf() { - assert_eq!(::std::mem::size_of::<__sbuf>() , 16usize); - assert_eq!(::std::mem::align_of::<__sbuf>() , 8usize); +fn bindgen_test_layout__G_fpos64_t() { + const UNINIT: ::std::mem::MaybeUninit<_G_fpos64_t> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<_G_fpos64_t>(), + 16usize, + concat!("Size of: ", stringify!(_G_fpos64_t)) + ); + assert_eq!( + ::std::mem::align_of::<_G_fpos64_t>(), + 8usize, + concat!("Alignment of ", stringify!(_G_fpos64_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__pos) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_G_fpos64_t), + "::", + stringify!(__pos) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__state) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_G_fpos64_t), + "::", + stringify!(__state) + ) + ); +} +pub type __fpos64_t = _G_fpos64_t; +pub type __FILE = _IO_FILE; +pub type FILE = _IO_FILE; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _IO_marker { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _IO_codecvt { + _unused: [u8; 0], } -impl Clone for __sbuf { - fn clone(&self) -> Self { *self } +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _IO_wide_data { + _unused: [u8; 0], } +pub type _IO_lock_t = ::std::os::raw::c_void; #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct __sFILEX([u8; 0]); +pub struct _IO_FILE { + pub _flags: ::std::os::raw::c_int, + pub _IO_read_ptr: *mut ::std::os::raw::c_char, + pub _IO_read_end: *mut ::std::os::raw::c_char, + pub _IO_read_base: *mut ::std::os::raw::c_char, + pub _IO_write_base: *mut ::std::os::raw::c_char, + pub _IO_write_ptr: *mut ::std::os::raw::c_char, + pub _IO_write_end: *mut ::std::os::raw::c_char, + pub _IO_buf_base: *mut ::std::os::raw::c_char, + pub _IO_buf_end: *mut ::std::os::raw::c_char, + pub _IO_save_base: *mut ::std::os::raw::c_char, + pub _IO_backup_base: *mut ::std::os::raw::c_char, + pub _IO_save_end: *mut ::std::os::raw::c_char, + pub _markers: *mut _IO_marker, + pub _chain: *mut _IO_FILE, + pub _fileno: ::std::os::raw::c_int, + pub _flags2: ::std::os::raw::c_int, + pub _old_offset: __off_t, + pub _cur_column: ::std::os::raw::c_ushort, + pub _vtable_offset: ::std::os::raw::c_schar, + pub _shortbuf: [::std::os::raw::c_char; 1usize], + pub _lock: *mut _IO_lock_t, + pub _offset: __off64_t, + pub _codecvt: *mut _IO_codecvt, + pub _wide_data: *mut _IO_wide_data, + pub _freeres_list: *mut _IO_FILE, + pub _freeres_buf: *mut ::std::os::raw::c_void, + pub __pad5: usize, + pub _mode: ::std::os::raw::c_int, + pub _unused2: [::std::os::raw::c_char; 20usize], +} +#[test] +fn bindgen_test_layout__IO_FILE() { + const UNINIT: ::std::mem::MaybeUninit<_IO_FILE> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<_IO_FILE>(), + 216usize, + concat!("Size of: ", stringify!(_IO_FILE)) + ); + assert_eq!( + ::std::mem::align_of::<_IO_FILE>(), + 8usize, + concat!("Alignment of ", stringify!(_IO_FILE)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._flags) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_flags) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_read_ptr) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_read_ptr) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_read_end) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_read_end) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_read_base) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_read_base) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_write_base) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_write_base) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_write_ptr) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_write_ptr) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_write_end) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_write_end) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_buf_base) as usize - ptr as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_buf_base) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_buf_end) as usize - ptr as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_buf_end) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_save_base) as usize - ptr as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_save_base) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_backup_base) as usize - ptr as usize }, + 80usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_backup_base) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._IO_save_end) as usize - ptr as usize }, + 88usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_IO_save_end) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._markers) as usize - ptr as usize }, + 96usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_markers) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._chain) as usize - ptr as usize }, + 104usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_chain) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._fileno) as usize - ptr as usize }, + 112usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_fileno) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._flags2) as usize - ptr as usize }, + 116usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_flags2) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._old_offset) as usize - ptr as usize }, + 120usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_old_offset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._cur_column) as usize - ptr as usize }, + 128usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_cur_column) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._vtable_offset) as usize - ptr as usize }, + 130usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_vtable_offset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._shortbuf) as usize - ptr as usize }, + 131usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_shortbuf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._lock) as usize - ptr as usize }, + 136usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_lock) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._offset) as usize - ptr as usize }, + 144usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_offset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._codecvt) as usize - ptr as usize }, + 152usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_codecvt) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._wide_data) as usize - ptr as usize }, + 160usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_wide_data) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._freeres_list) as usize - ptr as usize }, + 168usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_freeres_list) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._freeres_buf) as usize - ptr as usize }, + 176usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_freeres_buf) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).__pad5) as usize - ptr as usize }, + 184usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(__pad5) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._mode) as usize - ptr as usize }, + 192usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_mode) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr)._unused2) as usize - ptr as usize }, + 196usize, + concat!( + "Offset of field: ", + stringify!(_IO_FILE), + "::", + stringify!(_unused2) + ) + ); +} +pub type cookie_read_function_t = ::std::option::Option< + unsafe extern "C" fn( + __cookie: *mut ::std::os::raw::c_void, + __buf: *mut ::std::os::raw::c_char, + __nbytes: usize, + ) -> __ssize_t, +>; +pub type cookie_write_function_t = ::std::option::Option< + unsafe extern "C" fn( + __cookie: *mut ::std::os::raw::c_void, + __buf: *const ::std::os::raw::c_char, + __nbytes: usize, + ) -> __ssize_t, +>; +pub type cookie_seek_function_t = ::std::option::Option< + unsafe extern "C" fn( + __cookie: *mut ::std::os::raw::c_void, + __pos: *mut __off64_t, + __w: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int, +>; +pub type cookie_close_function_t = ::std::option::Option< + unsafe extern "C" fn(__cookie: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int, +>; #[repr(C)] -#[derive(Debug, Copy)] -pub struct __sFILE { - pub _p: *mut ::std::os::raw::c_uchar, - pub _r: ::std::os::raw::c_int, - pub _w: ::std::os::raw::c_int, - pub _flags: ::std::os::raw::c_short, - pub _file: ::std::os::raw::c_short, - pub _bf: __sbuf, - pub _lbfsize: ::std::os::raw::c_int, - pub _cookie: *mut ::std::os::raw::c_void, - pub _close: ::std::option::Option ::std::os::raw::c_int>, - pub _read: ::std::option::Option ::std::os::raw::c_int>, - pub _seek: ::std::option::Option ::std::os::raw::c_longlong>, - pub _write: ::std::option::Option ::std::os::raw::c_int>, - pub _ub: __sbuf, - pub _extra: *mut __sFILEX, - pub _ur: ::std::os::raw::c_int, - pub _ubuf: [::std::os::raw::c_uchar; 3usize], - pub _nbuf: [::std::os::raw::c_uchar; 1usize], - pub _lb: __sbuf, - pub _blksize: ::std::os::raw::c_int, - pub _offset: fpos_t, +#[derive(Debug, Copy, Clone)] +pub struct _IO_cookie_io_functions_t { + pub read: cookie_read_function_t, + pub write: cookie_write_function_t, + pub seek: cookie_seek_function_t, + pub close: cookie_close_function_t, } #[test] -fn bindgen_test_layout___sFILE() { - assert_eq!(::std::mem::size_of::<__sFILE>() , 152usize); - assert_eq!(::std::mem::align_of::<__sFILE>() , 8usize); +fn bindgen_test_layout__IO_cookie_io_functions_t() { + const UNINIT: ::std::mem::MaybeUninit<_IO_cookie_io_functions_t> = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<_IO_cookie_io_functions_t>(), + 32usize, + concat!("Size of: ", stringify!(_IO_cookie_io_functions_t)) + ); + assert_eq!( + ::std::mem::align_of::<_IO_cookie_io_functions_t>(), + 8usize, + concat!("Alignment of ", stringify!(_IO_cookie_io_functions_t)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).read) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_IO_cookie_io_functions_t), + "::", + stringify!(read) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).write) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_IO_cookie_io_functions_t), + "::", + stringify!(write) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).seek) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(_IO_cookie_io_functions_t), + "::", + stringify!(seek) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).close) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(_IO_cookie_io_functions_t), + "::", + stringify!(close) + ) + ); +} +pub type cookie_io_functions_t = _IO_cookie_io_functions_t; +pub type va_list = __gnuc_va_list; +pub type off_t = __off_t; +pub type fpos_t = __fpos_t; +extern "C" { + pub static mut stdin: *mut FILE; +} +extern "C" { + pub static mut stdout: *mut FILE; +} +extern "C" { + pub static mut stderr: *mut FILE; +} +extern "C" { + pub fn remove(__filename: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn rename( + __old: *const ::std::os::raw::c_char, + __new: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn renameat( + __oldfd: ::std::os::raw::c_int, + __old: *const ::std::os::raw::c_char, + __newfd: ::std::os::raw::c_int, + __new: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fclose(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn tmpfile() -> *mut FILE; +} +extern "C" { + pub fn tmpnam(arg1: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn tmpnam_r(__s: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn tempnam( + __dir: *const ::std::os::raw::c_char, + __pfx: *const ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn fflush(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fflush_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fopen( + __filename: *const ::std::os::raw::c_char, + __modes: *const ::std::os::raw::c_char, + ) -> *mut FILE; +} +extern "C" { + pub fn freopen( + __filename: *const ::std::os::raw::c_char, + __modes: *const ::std::os::raw::c_char, + __stream: *mut FILE, + ) -> *mut FILE; +} +extern "C" { + pub fn fdopen(__fd: ::std::os::raw::c_int, __modes: *const ::std::os::raw::c_char) + -> *mut FILE; +} +extern "C" { + pub fn fopencookie( + __magic_cookie: *mut ::std::os::raw::c_void, + __modes: *const ::std::os::raw::c_char, + __io_funcs: cookie_io_functions_t, + ) -> *mut FILE; +} +extern "C" { + pub fn fmemopen( + __s: *mut ::std::os::raw::c_void, + __len: usize, + __modes: *const ::std::os::raw::c_char, + ) -> *mut FILE; +} +extern "C" { + pub fn open_memstream( + __bufloc: *mut *mut ::std::os::raw::c_char, + __sizeloc: *mut usize, + ) -> *mut FILE; +} +extern "C" { + pub fn setbuf(__stream: *mut FILE, __buf: *mut ::std::os::raw::c_char); +} +extern "C" { + pub fn setvbuf( + __stream: *mut FILE, + __buf: *mut ::std::os::raw::c_char, + __modes: ::std::os::raw::c_int, + __n: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setbuffer(__stream: *mut FILE, __buf: *mut ::std::os::raw::c_char, __size: usize); +} +extern "C" { + pub fn setlinebuf(__stream: *mut FILE); +} +extern "C" { + pub fn fprintf( + __stream: *mut FILE, + __format: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn printf(__format: *const ::std::os::raw::c_char, ...) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn sprintf( + __s: *mut ::std::os::raw::c_char, + __format: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vfprintf( + __s: *mut FILE, + __format: *const ::std::os::raw::c_char, + __arg: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vprintf( + __format: *const ::std::os::raw::c_char, + __arg: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vsprintf( + __s: *mut ::std::os::raw::c_char, + __format: *const ::std::os::raw::c_char, + __arg: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn snprintf( + __s: *mut ::std::os::raw::c_char, + __maxlen: ::std::os::raw::c_ulong, + __format: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vsnprintf( + __s: *mut ::std::os::raw::c_char, + __maxlen: ::std::os::raw::c_ulong, + __format: *const ::std::os::raw::c_char, + __arg: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vasprintf( + __ptr: *mut *mut ::std::os::raw::c_char, + __f: *const ::std::os::raw::c_char, + __arg: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn __asprintf( + __ptr: *mut *mut ::std::os::raw::c_char, + __fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn asprintf( + __ptr: *mut *mut ::std::os::raw::c_char, + __fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vdprintf( + __fd: ::std::os::raw::c_int, + __fmt: *const ::std::os::raw::c_char, + __arg: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn dprintf( + __fd: ::std::os::raw::c_int, + __fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fscanf( + __stream: *mut FILE, + __format: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn scanf(__format: *const ::std::os::raw::c_char, ...) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn sscanf( + __s: *const ::std::os::raw::c_char, + __format: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +pub type _Float32 = f32; +pub type _Float64 = f64; +pub type _Float32x = f64; +pub type _Float64x = u128; +extern "C" { + #[link_name = "\u{1}__isoc99_fscanf"] + pub fn fscanf1( + __stream: *mut FILE, + __format: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[link_name = "\u{1}__isoc99_scanf"] + pub fn scanf1(__format: *const ::std::os::raw::c_char, ...) -> ::std::os::raw::c_int; +} +extern "C" { + #[link_name = "\u{1}__isoc99_sscanf"] + pub fn sscanf1( + __s: *const ::std::os::raw::c_char, + __format: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vfscanf( + __s: *mut FILE, + __format: *const ::std::os::raw::c_char, + __arg: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vscanf( + __format: *const ::std::os::raw::c_char, + __arg: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vsscanf( + __s: *const ::std::os::raw::c_char, + __format: *const ::std::os::raw::c_char, + __arg: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[link_name = "\u{1}__isoc99_vfscanf"] + pub fn vfscanf1( + __s: *mut FILE, + __format: *const ::std::os::raw::c_char, + __arg: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[link_name = "\u{1}__isoc99_vscanf"] + pub fn vscanf1( + __format: *const ::std::os::raw::c_char, + __arg: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + #[link_name = "\u{1}__isoc99_vsscanf"] + pub fn vsscanf1( + __s: *const ::std::os::raw::c_char, + __format: *const ::std::os::raw::c_char, + __arg: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fgetc(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getc(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getchar() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getc_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getchar_unlocked() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fgetc_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fputc(__c: ::std::os::raw::c_int, __stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn putc(__c: ::std::os::raw::c_int, __stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn putchar(__c: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fputc_unlocked(__c: ::std::os::raw::c_int, __stream: *mut FILE) + -> ::std::os::raw::c_int; +} +extern "C" { + pub fn putc_unlocked(__c: ::std::os::raw::c_int, __stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn putchar_unlocked(__c: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getw(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn putw(__w: ::std::os::raw::c_int, __stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fgets( + __s: *mut ::std::os::raw::c_char, + __n: ::std::os::raw::c_int, + __stream: *mut FILE, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn __getdelim( + __lineptr: *mut *mut ::std::os::raw::c_char, + __n: *mut usize, + __delimiter: ::std::os::raw::c_int, + __stream: *mut FILE, + ) -> __ssize_t; +} +extern "C" { + pub fn getdelim( + __lineptr: *mut *mut ::std::os::raw::c_char, + __n: *mut usize, + __delimiter: ::std::os::raw::c_int, + __stream: *mut FILE, + ) -> __ssize_t; +} +extern "C" { + pub fn getline( + __lineptr: *mut *mut ::std::os::raw::c_char, + __n: *mut usize, + __stream: *mut FILE, + ) -> __ssize_t; +} +extern "C" { + pub fn fputs(__s: *const ::std::os::raw::c_char, __stream: *mut FILE) -> ::std::os::raw::c_int; } -impl Clone for __sFILE { - fn clone(&self) -> Self { *self } +extern "C" { + pub fn puts(__s: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ungetc(__c: ::std::os::raw::c_int, __stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fread( + __ptr: *mut ::std::os::raw::c_void, + __size: ::std::os::raw::c_ulong, + __n: ::std::os::raw::c_ulong, + __stream: *mut FILE, + ) -> ::std::os::raw::c_ulong; +} +extern "C" { + pub fn fwrite( + __ptr: *const ::std::os::raw::c_void, + __size: ::std::os::raw::c_ulong, + __n: ::std::os::raw::c_ulong, + __s: *mut FILE, + ) -> ::std::os::raw::c_ulong; +} +extern "C" { + pub fn fread_unlocked( + __ptr: *mut ::std::os::raw::c_void, + __size: usize, + __n: usize, + __stream: *mut FILE, + ) -> usize; +} +extern "C" { + pub fn fwrite_unlocked( + __ptr: *const ::std::os::raw::c_void, + __size: usize, + __n: usize, + __stream: *mut FILE, + ) -> usize; +} +extern "C" { + pub fn fseek( + __stream: *mut FILE, + __off: ::std::os::raw::c_long, + __whence: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ftell(__stream: *mut FILE) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn rewind(__stream: *mut FILE); +} +extern "C" { + pub fn fseeko( + __stream: *mut FILE, + __off: __off_t, + __whence: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ftello(__stream: *mut FILE) -> __off_t; +} +extern "C" { + pub fn fgetpos(__stream: *mut FILE, __pos: *mut fpos_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fsetpos(__stream: *mut FILE, __pos: *const fpos_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clearerr(__stream: *mut FILE); +} +extern "C" { + pub fn feof(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ferror(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clearerr_unlocked(__stream: *mut FILE); +} +extern "C" { + pub fn feof_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ferror_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn perror(__s: *const ::std::os::raw::c_char); +} +extern "C" { + pub fn fileno(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fileno_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pclose(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn popen( + __command: *const ::std::os::raw::c_char, + __modes: *const ::std::os::raw::c_char, + ) -> *mut FILE; +} +extern "C" { + pub fn ctermid(__s: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn flockfile(__stream: *mut FILE); +} +extern "C" { + pub fn ftrylockfile(__stream: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn funlockfile(__stream: *mut FILE); +} +extern "C" { + pub fn __uflow(arg1: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn __overflow(arg1: *mut FILE, arg2: ::std::os::raw::c_int) -> ::std::os::raw::c_int; } -pub type FILE = __sFILE; pub type Oid = ::std::os::raw::c_uint; -pub const CONNECTION_OK: _bindgen_ty_2 = _bindgen_ty_2::CONNECTION_OK; -pub const CONNECTION_BAD: _bindgen_ty_2 = _bindgen_ty_2::CONNECTION_BAD; -pub const CONNECTION_STARTED: _bindgen_ty_2 = - _bindgen_ty_2::CONNECTION_STARTED; -pub const CONNECTION_MADE: _bindgen_ty_2 = _bindgen_ty_2::CONNECTION_MADE; -pub const CONNECTION_AWAITING_RESPONSE: _bindgen_ty_2 = - _bindgen_ty_2::CONNECTION_AWAITING_RESPONSE; -pub const CONNECTION_AUTH_OK: _bindgen_ty_2 = - _bindgen_ty_2::CONNECTION_AUTH_OK; -pub const CONNECTION_SETENV: _bindgen_ty_2 = _bindgen_ty_2::CONNECTION_SETENV; -pub const CONNECTION_SSL_STARTUP: _bindgen_ty_2 = - _bindgen_ty_2::CONNECTION_SSL_STARTUP; -pub const CONNECTION_NEEDED: _bindgen_ty_2 = _bindgen_ty_2::CONNECTION_NEEDED; +pub type pg_int64 = ::std::os::raw::c_long; #[repr(u32)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _bindgen_ty_2 { +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum ConnStatusType { CONNECTION_OK = 0, CONNECTION_BAD = 1, CONNECTION_STARTED = 2, @@ -125,43 +1321,24 @@ pub enum _bindgen_ty_2 { CONNECTION_SETENV = 6, CONNECTION_SSL_STARTUP = 7, CONNECTION_NEEDED = 8, + CONNECTION_CHECK_WRITABLE = 9, + CONNECTION_CONSUME = 10, + CONNECTION_GSS_STARTUP = 11, + CONNECTION_CHECK_TARGET = 12, + CONNECTION_CHECK_STANDBY = 13, } -pub use self::_bindgen_ty_2 as ConnStatusType; -pub const PGRES_POLLING_FAILED: _bindgen_ty_3 = - _bindgen_ty_3::PGRES_POLLING_FAILED; -pub const PGRES_POLLING_READING: _bindgen_ty_3 = - _bindgen_ty_3::PGRES_POLLING_READING; -pub const PGRES_POLLING_WRITING: _bindgen_ty_3 = - _bindgen_ty_3::PGRES_POLLING_WRITING; -pub const PGRES_POLLING_OK: _bindgen_ty_3 = _bindgen_ty_3::PGRES_POLLING_OK; -pub const PGRES_POLLING_ACTIVE: _bindgen_ty_3 = - _bindgen_ty_3::PGRES_POLLING_ACTIVE; #[repr(u32)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _bindgen_ty_3 { +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum PostgresPollingStatusType { PGRES_POLLING_FAILED = 0, PGRES_POLLING_READING = 1, PGRES_POLLING_WRITING = 2, PGRES_POLLING_OK = 3, PGRES_POLLING_ACTIVE = 4, } -pub use self::_bindgen_ty_3 as PostgresPollingStatusType; -pub const PGRES_EMPTY_QUERY: _bindgen_ty_4 = _bindgen_ty_4::PGRES_EMPTY_QUERY; -pub const PGRES_COMMAND_OK: _bindgen_ty_4 = _bindgen_ty_4::PGRES_COMMAND_OK; -pub const PGRES_TUPLES_OK: _bindgen_ty_4 = _bindgen_ty_4::PGRES_TUPLES_OK; -pub const PGRES_COPY_OUT: _bindgen_ty_4 = _bindgen_ty_4::PGRES_COPY_OUT; -pub const PGRES_COPY_IN: _bindgen_ty_4 = _bindgen_ty_4::PGRES_COPY_IN; -pub const PGRES_BAD_RESPONSE: _bindgen_ty_4 = - _bindgen_ty_4::PGRES_BAD_RESPONSE; -pub const PGRES_NONFATAL_ERROR: _bindgen_ty_4 = - _bindgen_ty_4::PGRES_NONFATAL_ERROR; -pub const PGRES_FATAL_ERROR: _bindgen_ty_4 = _bindgen_ty_4::PGRES_FATAL_ERROR; -pub const PGRES_COPY_BOTH: _bindgen_ty_4 = _bindgen_ty_4::PGRES_COPY_BOTH; -pub const PGRES_SINGLE_TUPLE: _bindgen_ty_4 = - _bindgen_ty_4::PGRES_SINGLE_TUPLE; #[repr(u32)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _bindgen_ty_4 { +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum ExecStatusType { PGRES_EMPTY_QUERY = 0, PGRES_COMMAND_OK = 1, PGRES_TUPLES_OK = 2, @@ -172,62 +1349,68 @@ pub enum _bindgen_ty_4 { PGRES_FATAL_ERROR = 7, PGRES_COPY_BOTH = 8, PGRES_SINGLE_TUPLE = 9, + PGRES_PIPELINE_SYNC = 10, + PGRES_PIPELINE_ABORTED = 11, } -pub use self::_bindgen_ty_4 as ExecStatusType; -pub const PQTRANS_IDLE: _bindgen_ty_5 = _bindgen_ty_5::PQTRANS_IDLE; -pub const PQTRANS_ACTIVE: _bindgen_ty_5 = _bindgen_ty_5::PQTRANS_ACTIVE; -pub const PQTRANS_INTRANS: _bindgen_ty_5 = _bindgen_ty_5::PQTRANS_INTRANS; -pub const PQTRANS_INERROR: _bindgen_ty_5 = _bindgen_ty_5::PQTRANS_INERROR; -pub const PQTRANS_UNKNOWN: _bindgen_ty_5 = _bindgen_ty_5::PQTRANS_UNKNOWN; #[repr(u32)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _bindgen_ty_5 { +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum PGTransactionStatusType { PQTRANS_IDLE = 0, PQTRANS_ACTIVE = 1, PQTRANS_INTRANS = 2, PQTRANS_INERROR = 3, PQTRANS_UNKNOWN = 4, } -pub use self::_bindgen_ty_5 as PGTransactionStatusType; -pub const PQERRORS_TERSE: _bindgen_ty_6 = _bindgen_ty_6::PQERRORS_TERSE; -pub const PQERRORS_DEFAULT: _bindgen_ty_6 = _bindgen_ty_6::PQERRORS_DEFAULT; -pub const PQERRORS_VERBOSE: _bindgen_ty_6 = _bindgen_ty_6::PQERRORS_VERBOSE; #[repr(u32)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _bindgen_ty_6 { +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum PGVerbosity { PQERRORS_TERSE = 0, PQERRORS_DEFAULT = 1, PQERRORS_VERBOSE = 2, + PQERRORS_SQLSTATE = 3, +} +#[repr(u32)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum PGContextVisibility { + PQSHOW_CONTEXT_NEVER = 0, + PQSHOW_CONTEXT_ERRORS = 1, + PQSHOW_CONTEXT_ALWAYS = 2, } -pub use self::_bindgen_ty_6 as PGVerbosity; -pub const PQPING_OK: _bindgen_ty_7 = _bindgen_ty_7::PQPING_OK; -pub const PQPING_REJECT: _bindgen_ty_7 = _bindgen_ty_7::PQPING_REJECT; -pub const PQPING_NO_RESPONSE: _bindgen_ty_7 = - _bindgen_ty_7::PQPING_NO_RESPONSE; -pub const PQPING_NO_ATTEMPT: _bindgen_ty_7 = _bindgen_ty_7::PQPING_NO_ATTEMPT; #[repr(u32)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub enum _bindgen_ty_7 { +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum PGPing { PQPING_OK = 0, PQPING_REJECT = 1, PQPING_NO_RESPONSE = 2, PQPING_NO_ATTEMPT = 3, } -pub use self::_bindgen_ty_7 as PGPing; +#[repr(u32)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum PGpipelineStatus { + PQ_PIPELINE_OFF = 0, + PQ_PIPELINE_ON = 1, + PQ_PIPELINE_ABORTED = 2, +} #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct pg_conn([u8; 0]); +pub struct pg_conn { + _unused: [u8; 0], +} pub type PGconn = pg_conn; #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct pg_result([u8; 0]); +pub struct pg_result { + _unused: [u8; 0], +} pub type PGresult = pg_result; #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct pg_cancel([u8; 0]); +pub struct pg_cancel { + _unused: [u8; 0], +} pub type PGcancel = pg_cancel; #[repr(C)] -#[derive(Debug, Copy)] +#[derive(Debug, Copy, Clone)] pub struct pgNotify { pub relname: *mut ::std::os::raw::c_char, pub be_pid: ::std::os::raw::c_int, @@ -236,25 +1419,69 @@ pub struct pgNotify { } #[test] fn bindgen_test_layout_pgNotify() { - assert_eq!(::std::mem::size_of::() , 32usize); - assert_eq!(::std::mem::align_of::() , 8usize); -} -impl Clone for pgNotify { - fn clone(&self) -> Self { *self } + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(pgNotify)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(pgNotify)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).relname) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pgNotify), + "::", + stringify!(relname) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).be_pid) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(pgNotify), + "::", + stringify!(be_pid) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).extra) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(pgNotify), + "::", + stringify!(extra) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).next) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(pgNotify), + "::", + stringify!(next) + ) + ); } pub type PGnotify = pgNotify; -pub type PQnoticeReceiver = - ::std::option::Option; -pub type PQnoticeProcessor = - ::std::option::Option; +pub type PQnoticeReceiver = ::std::option::Option< + unsafe extern "C" fn(arg: *mut ::std::os::raw::c_void, res: *const PGresult), +>; +pub type PQnoticeProcessor = ::std::option::Option< + unsafe extern "C" fn(arg: *mut ::std::os::raw::c_void, message: *const ::std::os::raw::c_char), +>; pub type pqbool = ::std::os::raw::c_char; #[repr(C)] -#[derive(Debug, Copy)] +#[derive(Debug, Copy, Clone)] pub struct _PQprintOpt { pub header: pqbool, pub align: pqbool, @@ -269,15 +1496,122 @@ pub struct _PQprintOpt { } #[test] fn bindgen_test_layout__PQprintOpt() { - assert_eq!(::std::mem::size_of::<_PQprintOpt>() , 40usize); - assert_eq!(::std::mem::align_of::<_PQprintOpt>() , 8usize); -} -impl Clone for _PQprintOpt { - fn clone(&self) -> Self { *self } + const UNINIT: ::std::mem::MaybeUninit<_PQprintOpt> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<_PQprintOpt>(), + 40usize, + concat!("Size of: ", stringify!(_PQprintOpt)) + ); + assert_eq!( + ::std::mem::align_of::<_PQprintOpt>(), + 8usize, + concat!("Alignment of ", stringify!(_PQprintOpt)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).header) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_PQprintOpt), + "::", + stringify!(header) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).align) as usize - ptr as usize }, + 1usize, + concat!( + "Offset of field: ", + stringify!(_PQprintOpt), + "::", + stringify!(align) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).standard) as usize - ptr as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(_PQprintOpt), + "::", + stringify!(standard) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).html3) as usize - ptr as usize }, + 3usize, + concat!( + "Offset of field: ", + stringify!(_PQprintOpt), + "::", + stringify!(html3) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).expanded) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(_PQprintOpt), + "::", + stringify!(expanded) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).pager) as usize - ptr as usize }, + 5usize, + concat!( + "Offset of field: ", + stringify!(_PQprintOpt), + "::", + stringify!(pager) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).fieldSep) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_PQprintOpt), + "::", + stringify!(fieldSep) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).tableOpt) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(_PQprintOpt), + "::", + stringify!(tableOpt) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).caption) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(_PQprintOpt), + "::", + stringify!(caption) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).fieldName) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(_PQprintOpt), + "::", + stringify!(fieldName) + ) + ); } pub type PQprintOpt = _PQprintOpt; #[repr(C)] -#[derive(Debug, Copy)] +#[derive(Debug, Copy, Clone)] pub struct _PQconninfoOption { pub keyword: *mut ::std::os::raw::c_char, pub envvar: *mut ::std::os::raw::c_char, @@ -289,47 +1623,186 @@ pub struct _PQconninfoOption { } #[test] fn bindgen_test_layout__PQconninfoOption() { - assert_eq!(::std::mem::size_of::<_PQconninfoOption>() , 56usize); - assert_eq!(::std::mem::align_of::<_PQconninfoOption>() , 8usize); -} -impl Clone for _PQconninfoOption { - fn clone(&self) -> Self { *self } + const UNINIT: ::std::mem::MaybeUninit<_PQconninfoOption> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<_PQconninfoOption>(), + 56usize, + concat!("Size of: ", stringify!(_PQconninfoOption)) + ); + assert_eq!( + ::std::mem::align_of::<_PQconninfoOption>(), + 8usize, + concat!("Alignment of ", stringify!(_PQconninfoOption)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).keyword) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_PQconninfoOption), + "::", + stringify!(keyword) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).envvar) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(_PQconninfoOption), + "::", + stringify!(envvar) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).compiled) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(_PQconninfoOption), + "::", + stringify!(compiled) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).val) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(_PQconninfoOption), + "::", + stringify!(val) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).label) as usize - ptr as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(_PQconninfoOption), + "::", + stringify!(label) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).dispchar) as usize - ptr as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(_PQconninfoOption), + "::", + stringify!(dispchar) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).dispsize) as usize - ptr as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(_PQconninfoOption), + "::", + stringify!(dispsize) + ) + ); } pub type PQconninfoOption = _PQconninfoOption; #[repr(C)] -#[derive(Debug, Copy)] -pub struct _bindgen_ty_8 { +#[derive(Copy, Clone)] +pub struct PQArgBlock { pub len: ::std::os::raw::c_int, pub isint: ::std::os::raw::c_int, - pub u: _bindgen_ty_8__bindgen_ty_1, + pub u: PQArgBlock__bindgen_ty_1, } #[repr(C)] -#[derive(Debug, Copy)] -pub struct _bindgen_ty_8__bindgen_ty_1 { - pub ptr: __BindgenUnionField<*mut ::std::os::raw::c_int>, - pub integer: __BindgenUnionField<::std::os::raw::c_int>, - pub bindgen_union_field: u64, +#[derive(Copy, Clone)] +pub union PQArgBlock__bindgen_ty_1 { + pub ptr: *mut ::std::os::raw::c_int, + pub integer: ::std::os::raw::c_int, } #[test] -fn bindgen_test_layout__bindgen_ty_8__bindgen_ty_1() { - assert_eq!(::std::mem::size_of::<_bindgen_ty_8__bindgen_ty_1>() , 8usize); - assert_eq!(::std::mem::align_of::<_bindgen_ty_8__bindgen_ty_1>() , - 8usize); -} -impl Clone for _bindgen_ty_8__bindgen_ty_1 { - fn clone(&self) -> Self { *self } +fn bindgen_test_layout_PQArgBlock__bindgen_ty_1() { + const UNINIT: ::std::mem::MaybeUninit = + ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(PQArgBlock__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(PQArgBlock__bindgen_ty_1)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).ptr) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(PQArgBlock__bindgen_ty_1), + "::", + stringify!(ptr) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).integer) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(PQArgBlock__bindgen_ty_1), + "::", + stringify!(integer) + ) + ); } #[test] -fn bindgen_test_layout__bindgen_ty_8() { - assert_eq!(::std::mem::size_of::<_bindgen_ty_8>() , 16usize); - assert_eq!(::std::mem::align_of::<_bindgen_ty_8>() , 8usize); +fn bindgen_test_layout_PQArgBlock() { + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(PQArgBlock)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(PQArgBlock)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).len) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(PQArgBlock), + "::", + stringify!(len) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).isint) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(PQArgBlock), + "::", + stringify!(isint) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).u) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(PQArgBlock), + "::", + stringify!(u) + ) + ); } -impl Clone for _bindgen_ty_8 { - fn clone(&self) -> Self { *self } -} -pub type PQArgBlock = _bindgen_ty_8; #[repr(C)] -#[derive(Debug, Copy)] +#[derive(Debug, Copy, Clone)] pub struct pgresAttDesc { pub name: *mut ::std::os::raw::c_char, pub tableid: Oid, @@ -341,45 +1814,123 @@ pub struct pgresAttDesc { } #[test] fn bindgen_test_layout_pgresAttDesc() { - assert_eq!(::std::mem::size_of::() , 32usize); - assert_eq!(::std::mem::align_of::() , 8usize); -} -impl Clone for pgresAttDesc { - fn clone(&self) -> Self { *self } + const UNINIT: ::std::mem::MaybeUninit = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(pgresAttDesc)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(pgresAttDesc)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pgresAttDesc), + "::", + stringify!(name) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).tableid) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(pgresAttDesc), + "::", + stringify!(tableid) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).columnid) as usize - ptr as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(pgresAttDesc), + "::", + stringify!(columnid) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).format) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(pgresAttDesc), + "::", + stringify!(format) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).typid) as usize - ptr as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(pgresAttDesc), + "::", + stringify!(typid) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).typlen) as usize - ptr as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(pgresAttDesc), + "::", + stringify!(typlen) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).atttypmod) as usize - ptr as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(pgresAttDesc), + "::", + stringify!(atttypmod) + ) + ); } pub type PGresAttDesc = pgresAttDesc; extern "C" { - pub fn PQconnectStart(conninfo: *const ::std::os::raw::c_char) - -> *mut PGconn; + pub fn PQconnectStart(conninfo: *const ::std::os::raw::c_char) -> *mut PGconn; } extern "C" { - pub fn PQconnectStartParams(keywords: - *const *const ::std::os::raw::c_char, - values: *const *const ::std::os::raw::c_char, - expand_dbname: ::std::os::raw::c_int) - -> *mut PGconn; + pub fn PQconnectStartParams( + keywords: *const *const ::std::os::raw::c_char, + values: *const *const ::std::os::raw::c_char, + expand_dbname: ::std::os::raw::c_int, + ) -> *mut PGconn; } extern "C" { pub fn PQconnectPoll(conn: *mut PGconn) -> PostgresPollingStatusType; } extern "C" { - pub fn PQconnectdb(conninfo: *const ::std::os::raw::c_char) - -> *mut PGconn; + pub fn PQconnectdb(conninfo: *const ::std::os::raw::c_char) -> *mut PGconn; } extern "C" { - pub fn PQconnectdbParams(keywords: *const *const ::std::os::raw::c_char, - values: *const *const ::std::os::raw::c_char, - expand_dbname: ::std::os::raw::c_int) - -> *mut PGconn; + pub fn PQconnectdbParams( + keywords: *const *const ::std::os::raw::c_char, + values: *const *const ::std::os::raw::c_char, + expand_dbname: ::std::os::raw::c_int, + ) -> *mut PGconn; } extern "C" { - pub fn PQsetdbLogin(pghost: *const ::std::os::raw::c_char, - pgport: *const ::std::os::raw::c_char, - pgoptions: *const ::std::os::raw::c_char, - pgtty: *const ::std::os::raw::c_char, - dbName: *const ::std::os::raw::c_char, - login: *const ::std::os::raw::c_char, - pwd: *const ::std::os::raw::c_char) -> *mut PGconn; + pub fn PQsetdbLogin( + pghost: *const ::std::os::raw::c_char, + pgport: *const ::std::os::raw::c_char, + pgoptions: *const ::std::os::raw::c_char, + pgtty: *const ::std::os::raw::c_char, + dbName: *const ::std::os::raw::c_char, + login: *const ::std::os::raw::c_char, + pwd: *const ::std::os::raw::c_char, + ) -> *mut PGconn; } extern "C" { pub fn PQfinish(conn: *mut PGconn); @@ -388,9 +1939,10 @@ extern "C" { pub fn PQconndefaults() -> *mut PQconninfoOption; } extern "C" { - pub fn PQconninfoParse(conninfo: *const ::std::os::raw::c_char, - errmsg: *mut *mut ::std::os::raw::c_char) - -> *mut PQconninfoOption; + pub fn PQconninfoParse( + conninfo: *const ::std::os::raw::c_char, + errmsg: *mut *mut ::std::os::raw::c_char, + ) -> *mut PQconninfoOption; } extern "C" { pub fn PQconninfo(conn: *mut PGconn) -> *mut PQconninfoOption; @@ -414,10 +1966,11 @@ extern "C" { pub fn PQfreeCancel(cancel: *mut PGcancel); } extern "C" { - pub fn PQcancel(cancel: *mut PGcancel, - errbuf: *mut ::std::os::raw::c_char, - errbufsize: ::std::os::raw::c_int) - -> ::std::os::raw::c_int; + pub fn PQcancel( + cancel: *mut PGcancel, + errbuf: *mut ::std::os::raw::c_char, + errbufsize: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; } extern "C" { pub fn PQrequestCancel(conn: *mut PGconn) -> ::std::os::raw::c_int; @@ -434,6 +1987,9 @@ extern "C" { extern "C" { pub fn PQhost(conn: *const PGconn) -> *mut ::std::os::raw::c_char; } +extern "C" { + pub fn PQhostaddr(conn: *const PGconn) -> *mut ::std::os::raw::c_char; +} extern "C" { pub fn PQport(conn: *const PGconn) -> *mut ::std::os::raw::c_char; } @@ -447,13 +2003,13 @@ extern "C" { pub fn PQstatus(conn: *const PGconn) -> ConnStatusType; } extern "C" { - pub fn PQtransactionStatus(conn: *const PGconn) - -> PGTransactionStatusType; + pub fn PQtransactionStatus(conn: *const PGconn) -> PGTransactionStatusType; } extern "C" { - pub fn PQparameterStatus(conn: *const PGconn, - paramName: *const ::std::os::raw::c_char) - -> *const ::std::os::raw::c_char; + pub fn PQparameterStatus( + conn: *const PGconn, + paramName: *const ::std::os::raw::c_char, + ) -> *const ::std::os::raw::c_char; } extern "C" { pub fn PQprotocolVersion(conn: *const PGconn) -> ::std::os::raw::c_int; @@ -471,37 +2027,43 @@ extern "C" { pub fn PQbackendPID(conn: *const PGconn) -> ::std::os::raw::c_int; } extern "C" { - pub fn PQconnectionNeedsPassword(conn: *const PGconn) - -> ::std::os::raw::c_int; + pub fn PQpipelineStatus(conn: *const PGconn) -> PGpipelineStatus; +} +extern "C" { + pub fn PQconnectionNeedsPassword(conn: *const PGconn) -> ::std::os::raw::c_int; } extern "C" { - pub fn PQconnectionUsedPassword(conn: *const PGconn) - -> ::std::os::raw::c_int; + pub fn PQconnectionUsedPassword(conn: *const PGconn) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn PQconnectionUsedGSSAPI(conn: *const PGconn) -> ::std::os::raw::c_int; } extern "C" { pub fn PQclientEncoding(conn: *const PGconn) -> ::std::os::raw::c_int; } extern "C" { - pub fn PQsetClientEncoding(conn: *mut PGconn, - encoding: *const ::std::os::raw::c_char) - -> ::std::os::raw::c_int; + pub fn PQsetClientEncoding( + conn: *mut PGconn, + encoding: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; } extern "C" { pub fn PQsslInUse(conn: *mut PGconn) -> ::std::os::raw::c_int; } extern "C" { - pub fn PQsslStruct(conn: *mut PGconn, - struct_name: *const ::std::os::raw::c_char) - -> *mut ::std::os::raw::c_void; + pub fn PQsslStruct( + conn: *mut PGconn, + struct_name: *const ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_void; } extern "C" { - pub fn PQsslAttribute(conn: *mut PGconn, - attribute_name: *const ::std::os::raw::c_char) - -> *const ::std::os::raw::c_char; + pub fn PQsslAttribute( + conn: *mut PGconn, + attribute_name: *const ::std::os::raw::c_char, + ) -> *const ::std::os::raw::c_char; } extern "C" { - pub fn PQsslAttributeNames(conn: *mut PGconn) - -> *const *const ::std::os::raw::c_char; + pub fn PQsslAttributeNames(conn: *mut PGconn) -> *const *const ::std::os::raw::c_char; } extern "C" { pub fn PQgetssl(conn: *mut PGconn) -> *mut ::std::os::raw::c_void; @@ -510,100 +2072,123 @@ extern "C" { pub fn PQinitSSL(do_init: ::std::os::raw::c_int); } extern "C" { - pub fn PQinitOpenSSL(do_ssl: ::std::os::raw::c_int, - do_crypto: ::std::os::raw::c_int); + pub fn PQinitOpenSSL(do_ssl: ::std::os::raw::c_int, do_crypto: ::std::os::raw::c_int); } extern "C" { - pub fn PQsetErrorVerbosity(conn: *mut PGconn, verbosity: PGVerbosity) - -> PGVerbosity; + pub fn PQgssEncInUse(conn: *mut PGconn) -> ::std::os::raw::c_int; } extern "C" { - pub fn PQtrace(conn: *mut PGconn, debug_port: *mut FILE); + pub fn PQgetgssctx(conn: *mut PGconn) -> *mut ::std::os::raw::c_void; } extern "C" { - pub fn PQuntrace(conn: *mut PGconn); + pub fn PQsetErrorVerbosity(conn: *mut PGconn, verbosity: PGVerbosity) -> PGVerbosity; +} +extern "C" { + pub fn PQsetErrorContextVisibility( + conn: *mut PGconn, + show_context: PGContextVisibility, + ) -> PGContextVisibility; } extern "C" { - pub fn PQsetNoticeReceiver(conn: *mut PGconn, proc_: PQnoticeReceiver, - arg: *mut ::std::os::raw::c_void) - -> PQnoticeReceiver; + pub fn PQsetNoticeReceiver( + conn: *mut PGconn, + proc_: PQnoticeReceiver, + arg: *mut ::std::os::raw::c_void, + ) -> PQnoticeReceiver; } extern "C" { - pub fn PQsetNoticeProcessor(conn: *mut PGconn, proc_: PQnoticeProcessor, - arg: *mut ::std::os::raw::c_void) - -> PQnoticeProcessor; + pub fn PQsetNoticeProcessor( + conn: *mut PGconn, + proc_: PQnoticeProcessor, + arg: *mut ::std::os::raw::c_void, + ) -> PQnoticeProcessor; } pub type pgthreadlock_t = - ::std::option::Option; + ::std::option::Option; extern "C" { pub fn PQregisterThreadLock(newhandler: pgthreadlock_t) -> pgthreadlock_t; } extern "C" { - pub fn PQexec(conn: *mut PGconn, query: *const ::std::os::raw::c_char) - -> *mut PGresult; + pub fn PQtrace(conn: *mut PGconn, debug_port: *mut FILE); +} +extern "C" { + pub fn PQuntrace(conn: *mut PGconn); +} +extern "C" { + pub fn PQsetTraceFlags(conn: *mut PGconn, flags: ::std::os::raw::c_int); } extern "C" { - pub fn PQexecParams(conn: *mut PGconn, - command: *const ::std::os::raw::c_char, - nParams: ::std::os::raw::c_int, - paramTypes: *const Oid, - paramValues: *const *const ::std::os::raw::c_char, - paramLengths: *const ::std::os::raw::c_int, - paramFormats: *const ::std::os::raw::c_int, - resultFormat: ::std::os::raw::c_int) -> *mut PGresult; + pub fn PQexec(conn: *mut PGconn, query: *const ::std::os::raw::c_char) -> *mut PGresult; } extern "C" { - pub fn PQprepare(conn: *mut PGconn, - stmtName: *const ::std::os::raw::c_char, - query: *const ::std::os::raw::c_char, - nParams: ::std::os::raw::c_int, paramTypes: *const Oid) - -> *mut PGresult; + pub fn PQexecParams( + conn: *mut PGconn, + command: *const ::std::os::raw::c_char, + nParams: ::std::os::raw::c_int, + paramTypes: *const Oid, + paramValues: *const *const ::std::os::raw::c_char, + paramLengths: *const ::std::os::raw::c_int, + paramFormats: *const ::std::os::raw::c_int, + resultFormat: ::std::os::raw::c_int, + ) -> *mut PGresult; } extern "C" { - pub fn PQexecPrepared(conn: *mut PGconn, - stmtName: *const ::std::os::raw::c_char, - nParams: ::std::os::raw::c_int, - paramValues: *const *const ::std::os::raw::c_char, - paramLengths: *const ::std::os::raw::c_int, - paramFormats: *const ::std::os::raw::c_int, - resultFormat: ::std::os::raw::c_int) - -> *mut PGresult; + pub fn PQprepare( + conn: *mut PGconn, + stmtName: *const ::std::os::raw::c_char, + query: *const ::std::os::raw::c_char, + nParams: ::std::os::raw::c_int, + paramTypes: *const Oid, + ) -> *mut PGresult; } extern "C" { - pub fn PQsendQuery(conn: *mut PGconn, - query: *const ::std::os::raw::c_char) - -> ::std::os::raw::c_int; + pub fn PQexecPrepared( + conn: *mut PGconn, + stmtName: *const ::std::os::raw::c_char, + nParams: ::std::os::raw::c_int, + paramValues: *const *const ::std::os::raw::c_char, + paramLengths: *const ::std::os::raw::c_int, + paramFormats: *const ::std::os::raw::c_int, + resultFormat: ::std::os::raw::c_int, + ) -> *mut PGresult; } extern "C" { - pub fn PQsendQueryParams(conn: *mut PGconn, - command: *const ::std::os::raw::c_char, - nParams: ::std::os::raw::c_int, - paramTypes: *const Oid, - paramValues: - *const *const ::std::os::raw::c_char, - paramLengths: *const ::std::os::raw::c_int, - paramFormats: *const ::std::os::raw::c_int, - resultFormat: ::std::os::raw::c_int) - -> ::std::os::raw::c_int; + pub fn PQsendQuery( + conn: *mut PGconn, + query: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; } extern "C" { - pub fn PQsendPrepare(conn: *mut PGconn, - stmtName: *const ::std::os::raw::c_char, - query: *const ::std::os::raw::c_char, - nParams: ::std::os::raw::c_int, - paramTypes: *const Oid) -> ::std::os::raw::c_int; + pub fn PQsendQueryParams( + conn: *mut PGconn, + command: *const ::std::os::raw::c_char, + nParams: ::std::os::raw::c_int, + paramTypes: *const Oid, + paramValues: *const *const ::std::os::raw::c_char, + paramLengths: *const ::std::os::raw::c_int, + paramFormats: *const ::std::os::raw::c_int, + resultFormat: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; } extern "C" { - pub fn PQsendQueryPrepared(conn: *mut PGconn, - stmtName: *const ::std::os::raw::c_char, - nParams: ::std::os::raw::c_int, - paramValues: - *const *const ::std::os::raw::c_char, - paramLengths: *const ::std::os::raw::c_int, - paramFormats: *const ::std::os::raw::c_int, - resultFormat: ::std::os::raw::c_int) - -> ::std::os::raw::c_int; + pub fn PQsendPrepare( + conn: *mut PGconn, + stmtName: *const ::std::os::raw::c_char, + query: *const ::std::os::raw::c_char, + nParams: ::std::os::raw::c_int, + paramTypes: *const Oid, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn PQsendQueryPrepared( + conn: *mut PGconn, + stmtName: *const ::std::os::raw::c_char, + nParams: ::std::os::raw::c_int, + paramValues: *const *const ::std::os::raw::c_char, + paramLengths: *const ::std::os::raw::c_int, + paramFormats: *const ::std::os::raw::c_int, + resultFormat: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; } extern "C" { pub fn PQsetSingleRowMode(conn: *mut PGconn) -> ::std::os::raw::c_int; @@ -617,52 +2202,74 @@ extern "C" { extern "C" { pub fn PQconsumeInput(conn: *mut PGconn) -> ::std::os::raw::c_int; } +extern "C" { + pub fn PQenterPipelineMode(conn: *mut PGconn) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn PQexitPipelineMode(conn: *mut PGconn) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn PQpipelineSync(conn: *mut PGconn) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn PQsendFlushRequest(conn: *mut PGconn) -> ::std::os::raw::c_int; +} extern "C" { pub fn PQnotifies(conn: *mut PGconn) -> *mut PGnotify; } extern "C" { - pub fn PQputCopyData(conn: *mut PGconn, - buffer: *const ::std::os::raw::c_char, - nbytes: ::std::os::raw::c_int) - -> ::std::os::raw::c_int; + pub fn PQputCopyData( + conn: *mut PGconn, + buffer: *const ::std::os::raw::c_char, + nbytes: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; } extern "C" { - pub fn PQputCopyEnd(conn: *mut PGconn, - errormsg: *const ::std::os::raw::c_char) - -> ::std::os::raw::c_int; + pub fn PQputCopyEnd( + conn: *mut PGconn, + errormsg: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; } extern "C" { - pub fn PQgetCopyData(conn: *mut PGconn, - buffer: *mut *mut ::std::os::raw::c_char, - async: ::std::os::raw::c_int) - -> ::std::os::raw::c_int; + pub fn PQgetCopyData( + conn: *mut PGconn, + buffer: *mut *mut ::std::os::raw::c_char, + async_: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; } extern "C" { - pub fn PQgetline(conn: *mut PGconn, string: *mut ::std::os::raw::c_char, - length: ::std::os::raw::c_int) -> ::std::os::raw::c_int; + pub fn PQgetline( + conn: *mut PGconn, + buffer: *mut ::std::os::raw::c_char, + length: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; } extern "C" { - pub fn PQputline(conn: *mut PGconn, string: *const ::std::os::raw::c_char) - -> ::std::os::raw::c_int; + pub fn PQputline( + conn: *mut PGconn, + string: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; } extern "C" { - pub fn PQgetlineAsync(conn: *mut PGconn, - buffer: *mut ::std::os::raw::c_char, - bufsize: ::std::os::raw::c_int) - -> ::std::os::raw::c_int; + pub fn PQgetlineAsync( + conn: *mut PGconn, + buffer: *mut ::std::os::raw::c_char, + bufsize: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; } extern "C" { - pub fn PQputnbytes(conn: *mut PGconn, - buffer: *const ::std::os::raw::c_char, - nbytes: ::std::os::raw::c_int) - -> ::std::os::raw::c_int; + pub fn PQputnbytes( + conn: *mut PGconn, + buffer: *const ::std::os::raw::c_char, + nbytes: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; } extern "C" { pub fn PQendcopy(conn: *mut PGconn) -> ::std::os::raw::c_int; } extern "C" { pub fn PQsetnonblocking(conn: *mut PGconn, arg: ::std::os::raw::c_int) - -> ::std::os::raw::c_int; + -> ::std::os::raw::c_int; } extern "C" { pub fn PQisnonblocking(conn: *const PGconn) -> ::std::os::raw::c_int; @@ -674,19 +2281,25 @@ extern "C" { pub fn PQping(conninfo: *const ::std::os::raw::c_char) -> PGPing; } extern "C" { - pub fn PQpingParams(keywords: *const *const ::std::os::raw::c_char, - values: *const *const ::std::os::raw::c_char, - expand_dbname: ::std::os::raw::c_int) -> PGPing; + pub fn PQpingParams( + keywords: *const *const ::std::os::raw::c_char, + values: *const *const ::std::os::raw::c_char, + expand_dbname: ::std::os::raw::c_int, + ) -> PGPing; } extern "C" { pub fn PQflush(conn: *mut PGconn) -> ::std::os::raw::c_int; } extern "C" { - pub fn PQfn(conn: *mut PGconn, fnid: ::std::os::raw::c_int, - result_buf: *mut ::std::os::raw::c_int, - result_len: *mut ::std::os::raw::c_int, - result_is_int: ::std::os::raw::c_int, args: *const PQArgBlock, - nargs: ::std::os::raw::c_int) -> *mut PGresult; + pub fn PQfn( + conn: *mut PGconn, + fnid: ::std::os::raw::c_int, + result_buf: *mut ::std::os::raw::c_int, + result_len: *mut ::std::os::raw::c_int, + result_is_int: ::std::os::raw::c_int, + args: *const PQArgBlock, + nargs: ::std::os::raw::c_int, + ) -> *mut PGresult; } extern "C" { pub fn PQresultStatus(res: *const PGresult) -> ExecStatusType; @@ -695,13 +2308,20 @@ extern "C" { pub fn PQresStatus(status: ExecStatusType) -> *mut ::std::os::raw::c_char; } extern "C" { - pub fn PQresultErrorMessage(res: *const PGresult) - -> *mut ::std::os::raw::c_char; + pub fn PQresultErrorMessage(res: *const PGresult) -> *mut ::std::os::raw::c_char; } extern "C" { - pub fn PQresultErrorField(res: *const PGresult, - fieldcode: ::std::os::raw::c_int) - -> *mut ::std::os::raw::c_char; + pub fn PQresultVerboseErrorMessage( + res: *const PGresult, + verbosity: PGVerbosity, + show_context: PGContextVisibility, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn PQresultErrorField( + res: *const PGresult, + fieldcode: ::std::os::raw::c_int, + ) -> *mut ::std::os::raw::c_char; } extern "C" { pub fn PQntuples(res: *const PGresult) -> ::std::os::raw::c_int; @@ -713,37 +2333,41 @@ extern "C" { pub fn PQbinaryTuples(res: *const PGresult) -> ::std::os::raw::c_int; } extern "C" { - pub fn PQfname(res: *const PGresult, field_num: ::std::os::raw::c_int) - -> *mut ::std::os::raw::c_char; + pub fn PQfname( + res: *const PGresult, + field_num: ::std::os::raw::c_int, + ) -> *mut ::std::os::raw::c_char; } extern "C" { - pub fn PQfnumber(res: *const PGresult, - field_name: *const ::std::os::raw::c_char) - -> ::std::os::raw::c_int; + pub fn PQfnumber( + res: *const PGresult, + field_name: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; } extern "C" { - pub fn PQftable(res: *const PGresult, field_num: ::std::os::raw::c_int) - -> Oid; + pub fn PQftable(res: *const PGresult, field_num: ::std::os::raw::c_int) -> Oid; } extern "C" { - pub fn PQftablecol(res: *const PGresult, field_num: ::std::os::raw::c_int) - -> ::std::os::raw::c_int; + pub fn PQftablecol( + res: *const PGresult, + field_num: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; } extern "C" { - pub fn PQfformat(res: *const PGresult, field_num: ::std::os::raw::c_int) - -> ::std::os::raw::c_int; + pub fn PQfformat( + res: *const PGresult, + field_num: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; } extern "C" { - pub fn PQftype(res: *const PGresult, field_num: ::std::os::raw::c_int) - -> Oid; + pub fn PQftype(res: *const PGresult, field_num: ::std::os::raw::c_int) -> Oid; } extern "C" { pub fn PQfsize(res: *const PGresult, field_num: ::std::os::raw::c_int) - -> ::std::os::raw::c_int; + -> ::std::os::raw::c_int; } extern "C" { - pub fn PQfmod(res: *const PGresult, field_num: ::std::os::raw::c_int) - -> ::std::os::raw::c_int; + pub fn PQfmod(res: *const PGresult, field_num: ::std::os::raw::c_int) -> ::std::os::raw::c_int; } extern "C" { pub fn PQcmdStatus(res: *mut PGresult) -> *mut ::std::os::raw::c_char; @@ -758,46 +2382,55 @@ extern "C" { pub fn PQcmdTuples(res: *mut PGresult) -> *mut ::std::os::raw::c_char; } extern "C" { - pub fn PQgetvalue(res: *const PGresult, tup_num: ::std::os::raw::c_int, - field_num: ::std::os::raw::c_int) - -> *mut ::std::os::raw::c_char; + pub fn PQgetvalue( + res: *const PGresult, + tup_num: ::std::os::raw::c_int, + field_num: ::std::os::raw::c_int, + ) -> *mut ::std::os::raw::c_char; } extern "C" { - pub fn PQgetlength(res: *const PGresult, tup_num: ::std::os::raw::c_int, - field_num: ::std::os::raw::c_int) - -> ::std::os::raw::c_int; + pub fn PQgetlength( + res: *const PGresult, + tup_num: ::std::os::raw::c_int, + field_num: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; } extern "C" { - pub fn PQgetisnull(res: *const PGresult, tup_num: ::std::os::raw::c_int, - field_num: ::std::os::raw::c_int) - -> ::std::os::raw::c_int; + pub fn PQgetisnull( + res: *const PGresult, + tup_num: ::std::os::raw::c_int, + field_num: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; } extern "C" { pub fn PQnparams(res: *const PGresult) -> ::std::os::raw::c_int; } extern "C" { - pub fn PQparamtype(res: *const PGresult, param_num: ::std::os::raw::c_int) - -> Oid; + pub fn PQparamtype(res: *const PGresult, param_num: ::std::os::raw::c_int) -> Oid; } extern "C" { - pub fn PQdescribePrepared(conn: *mut PGconn, - stmt: *const ::std::os::raw::c_char) - -> *mut PGresult; + pub fn PQdescribePrepared( + conn: *mut PGconn, + stmt: *const ::std::os::raw::c_char, + ) -> *mut PGresult; } extern "C" { - pub fn PQdescribePortal(conn: *mut PGconn, - portal: *const ::std::os::raw::c_char) - -> *mut PGresult; + pub fn PQdescribePortal( + conn: *mut PGconn, + portal: *const ::std::os::raw::c_char, + ) -> *mut PGresult; } extern "C" { - pub fn PQsendDescribePrepared(conn: *mut PGconn, - stmt: *const ::std::os::raw::c_char) - -> ::std::os::raw::c_int; + pub fn PQsendDescribePrepared( + conn: *mut PGconn, + stmt: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; } extern "C" { - pub fn PQsendDescribePortal(conn: *mut PGconn, - portal: *const ::std::os::raw::c_char) - -> ::std::os::raw::c_int; + pub fn PQsendDescribePortal( + conn: *mut PGconn, + portal: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; } extern "C" { pub fn PQclear(res: *mut PGresult); @@ -806,100 +2439,322 @@ extern "C" { pub fn PQfreemem(ptr: *mut ::std::os::raw::c_void); } extern "C" { - pub fn PQmakeEmptyPGresult(conn: *mut PGconn, status: ExecStatusType) - -> *mut PGresult; + pub fn PQmakeEmptyPGresult(conn: *mut PGconn, status: ExecStatusType) -> *mut PGresult; +} +extern "C" { + pub fn PQcopyResult(src: *const PGresult, flags: ::std::os::raw::c_int) -> *mut PGresult; +} +extern "C" { + pub fn PQsetResultAttrs( + res: *mut PGresult, + numAttributes: ::std::os::raw::c_int, + attDescs: *mut PGresAttDesc, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn PQresultAlloc(res: *mut PGresult, nBytes: usize) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn PQresultMemorySize(res: *const PGresult) -> usize; +} +extern "C" { + pub fn PQsetvalue( + res: *mut PGresult, + tup_num: ::std::os::raw::c_int, + field_num: ::std::os::raw::c_int, + value: *mut ::std::os::raw::c_char, + len: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn PQescapeStringConn( + conn: *mut PGconn, + to: *mut ::std::os::raw::c_char, + from: *const ::std::os::raw::c_char, + length: usize, + error: *mut ::std::os::raw::c_int, + ) -> usize; +} +extern "C" { + pub fn PQescapeLiteral( + conn: *mut PGconn, + str_: *const ::std::os::raw::c_char, + len: usize, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn PQescapeIdentifier( + conn: *mut PGconn, + str_: *const ::std::os::raw::c_char, + len: usize, + ) -> *mut ::std::os::raw::c_char; } extern "C" { - pub fn PQcopyResult(src: *const PGresult, flags: ::std::os::raw::c_int) - -> *mut PGresult; + pub fn PQescapeByteaConn( + conn: *mut PGconn, + from: *const ::std::os::raw::c_uchar, + from_length: usize, + to_length: *mut usize, + ) -> *mut ::std::os::raw::c_uchar; } extern "C" { - pub fn PQsetResultAttrs(res: *mut PGresult, - numAttributes: ::std::os::raw::c_int, - attDescs: *mut PGresAttDesc) - -> ::std::os::raw::c_int; + pub fn PQunescapeBytea( + strtext: *const ::std::os::raw::c_uchar, + retbuflen: *mut usize, + ) -> *mut ::std::os::raw::c_uchar; } extern "C" { - pub fn PQresultAlloc(res: *mut PGresult, nBytes: usize) - -> *mut ::std::os::raw::c_void; + pub fn PQescapeString( + to: *mut ::std::os::raw::c_char, + from: *const ::std::os::raw::c_char, + length: usize, + ) -> usize; } extern "C" { - pub fn PQsetvalue(res: *mut PGresult, tup_num: ::std::os::raw::c_int, - field_num: ::std::os::raw::c_int, - value: *mut ::std::os::raw::c_char, - len: ::std::os::raw::c_int) -> ::std::os::raw::c_int; + pub fn PQescapeBytea( + from: *const ::std::os::raw::c_uchar, + from_length: usize, + to_length: *mut usize, + ) -> *mut ::std::os::raw::c_uchar; } extern "C" { - pub fn PQescapeStringConn(conn: *mut PGconn, - to: *mut ::std::os::raw::c_char, - from: *const ::std::os::raw::c_char, - length: usize, - error: *mut ::std::os::raw::c_int) -> usize; + pub fn PQprint(fout: *mut FILE, res: *const PGresult, po: *const PQprintOpt); } extern "C" { - pub fn PQescapeLiteral(conn: *mut PGconn, - str: *const ::std::os::raw::c_char, len: usize) - -> *mut ::std::os::raw::c_char; + pub fn PQdisplayTuples( + res: *const PGresult, + fp: *mut FILE, + fillAlign: ::std::os::raw::c_int, + fieldSep: *const ::std::os::raw::c_char, + printHeader: ::std::os::raw::c_int, + quiet: ::std::os::raw::c_int, + ); } extern "C" { - pub fn PQescapeIdentifier(conn: *mut PGconn, - str: *const ::std::os::raw::c_char, len: usize) - -> *mut ::std::os::raw::c_char; + pub fn PQprintTuples( + res: *const PGresult, + fout: *mut FILE, + PrintAttNames: ::std::os::raw::c_int, + TerseOutput: ::std::os::raw::c_int, + colWidth: ::std::os::raw::c_int, + ); } extern "C" { - pub fn PQescapeByteaConn(conn: *mut PGconn, - from: *const ::std::os::raw::c_uchar, - from_length: usize, to_length: *mut usize) - -> *mut ::std::os::raw::c_uchar; + pub fn lo_open( + conn: *mut PGconn, + lobjId: Oid, + mode: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; } extern "C" { - pub fn PQunescapeBytea(strtext: *const ::std::os::raw::c_uchar, - retbuflen: *mut usize) - -> *mut ::std::os::raw::c_uchar; + pub fn lo_close(conn: *mut PGconn, fd: ::std::os::raw::c_int) -> ::std::os::raw::c_int; } extern "C" { - pub fn PQescapeString(to: *mut ::std::os::raw::c_char, - from: *const ::std::os::raw::c_char, length: usize) - -> usize; + pub fn lo_read( + conn: *mut PGconn, + fd: ::std::os::raw::c_int, + buf: *mut ::std::os::raw::c_char, + len: usize, + ) -> ::std::os::raw::c_int; } extern "C" { - pub fn PQescapeBytea(from: *const ::std::os::raw::c_uchar, - from_length: usize, to_length: *mut usize) - -> *mut ::std::os::raw::c_uchar; + pub fn lo_write( + conn: *mut PGconn, + fd: ::std::os::raw::c_int, + buf: *const ::std::os::raw::c_char, + len: usize, + ) -> ::std::os::raw::c_int; } extern "C" { - pub fn PQprint(fout: *mut FILE, res: *const PGresult, - ps: *const PQprintOpt); + pub fn lo_lseek( + conn: *mut PGconn, + fd: ::std::os::raw::c_int, + offset: ::std::os::raw::c_int, + whence: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; } extern "C" { - pub fn PQdisplayTuples(res: *const PGresult, fp: *mut FILE, - fillAlign: ::std::os::raw::c_int, - fieldSep: *const ::std::os::raw::c_char, - printHeader: ::std::os::raw::c_int, - quiet: ::std::os::raw::c_int); + pub fn lo_lseek64( + conn: *mut PGconn, + fd: ::std::os::raw::c_int, + offset: pg_int64, + whence: ::std::os::raw::c_int, + ) -> pg_int64; } extern "C" { - pub fn PQprintTuples(res: *const PGresult, fout: *mut FILE, - printAttName: ::std::os::raw::c_int, - terseOutput: ::std::os::raw::c_int, - width: ::std::os::raw::c_int); + pub fn lo_creat(conn: *mut PGconn, mode: ::std::os::raw::c_int) -> Oid; +} +extern "C" { + pub fn lo_create(conn: *mut PGconn, lobjId: Oid) -> Oid; +} +extern "C" { + pub fn lo_tell(conn: *mut PGconn, fd: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn lo_tell64(conn: *mut PGconn, fd: ::std::os::raw::c_int) -> pg_int64; +} +extern "C" { + pub fn lo_truncate( + conn: *mut PGconn, + fd: ::std::os::raw::c_int, + len: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn lo_truncate64( + conn: *mut PGconn, + fd: ::std::os::raw::c_int, + len: pg_int64, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn lo_unlink(conn: *mut PGconn, lobjId: Oid) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn lo_import(conn: *mut PGconn, filename: *const ::std::os::raw::c_char) -> Oid; +} +extern "C" { + pub fn lo_import_with_oid( + conn: *mut PGconn, + filename: *const ::std::os::raw::c_char, + lobjId: Oid, + ) -> Oid; +} +extern "C" { + pub fn lo_export( + conn: *mut PGconn, + lobjId: Oid, + filename: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; } extern "C" { pub fn PQlibVersion() -> ::std::os::raw::c_int; } extern "C" { - pub fn PQmblen(s: *const ::std::os::raw::c_char, - encoding: ::std::os::raw::c_int) -> ::std::os::raw::c_int; + pub fn PQmblen( + s: *const ::std::os::raw::c_char, + encoding: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn PQmblenBounded( + s: *const ::std::os::raw::c_char, + encoding: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; } extern "C" { - pub fn PQdsplen(s: *const ::std::os::raw::c_char, - encoding: ::std::os::raw::c_int) -> ::std::os::raw::c_int; + pub fn PQdsplen( + s: *const ::std::os::raw::c_char, + encoding: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; } extern "C" { pub fn PQenv2encoding() -> ::std::os::raw::c_int; } extern "C" { - pub fn PQencryptPassword(passwd: *const ::std::os::raw::c_char, - user: *const ::std::os::raw::c_char) - -> *mut ::std::os::raw::c_char; + pub fn PQencryptPassword( + passwd: *const ::std::os::raw::c_char, + user: *const ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn PQencryptPasswordConn( + conn: *mut PGconn, + passwd: *const ::std::os::raw::c_char, + user: *const ::std::os::raw::c_char, + algorithm: *const ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn pg_char_to_encoding(name: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pg_encoding_to_char(encoding: ::std::os::raw::c_int) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn pg_valid_server_encoding_id(encoding: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +pub type PQsslKeyPassHook_OpenSSL_type = ::std::option::Option< + unsafe extern "C" fn( + buf: *mut ::std::os::raw::c_char, + size: ::std::os::raw::c_int, + conn: *mut PGconn, + ) -> ::std::os::raw::c_int, +>; +extern "C" { + pub fn PQgetSSLKeyPassHook_OpenSSL() -> PQsslKeyPassHook_OpenSSL_type; +} +extern "C" { + pub fn PQsetSSLKeyPassHook_OpenSSL(hook: PQsslKeyPassHook_OpenSSL_type); +} +extern "C" { + pub fn PQdefaultSSLKeyPassHook_OpenSSL( + buf: *mut ::std::os::raw::c_char, + size: ::std::os::raw::c_int, + conn: *mut PGconn, + ) -> ::std::os::raw::c_int; +} +pub type __builtin_va_list = [__va_list_tag; 1usize]; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __va_list_tag { + pub gp_offset: ::std::os::raw::c_uint, + pub fp_offset: ::std::os::raw::c_uint, + pub overflow_arg_area: *mut ::std::os::raw::c_void, + pub reg_save_area: *mut ::std::os::raw::c_void, +} +#[test] +fn bindgen_test_layout___va_list_tag() { + const UNINIT: ::std::mem::MaybeUninit<__va_list_tag> = ::std::mem::MaybeUninit::uninit(); + let ptr = UNINIT.as_ptr(); + assert_eq!( + ::std::mem::size_of::<__va_list_tag>(), + 24usize, + concat!("Size of: ", stringify!(__va_list_tag)) + ); + assert_eq!( + ::std::mem::align_of::<__va_list_tag>(), + 8usize, + concat!("Alignment of ", stringify!(__va_list_tag)) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).gp_offset) as usize - ptr as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(gp_offset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).fp_offset) as usize - ptr as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(fp_offset) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).overflow_arg_area) as usize - ptr as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(overflow_arg_area) + ) + ); + assert_eq!( + unsafe { ::std::ptr::addr_of!((*ptr).reg_save_area) as usize - ptr as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(reg_save_area) + ) + ); } diff --git a/src/lib.rs b/src/lib.rs index e2bf380..b0ecba3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,14 @@ #[cfg(feature = "bundled")] extern crate pq_src; +#[cfg(not(feature = "buildtime_bindgen"))] +#[allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] mod bindings; + +#[cfg(feature = "buildtime_bindgen")] +#[allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] +mod bindings { + include!(concat!(env!("OUT_DIR"), "/bindings.rs")); +} + pub use bindings::*; diff --git a/wrapper.h b/wrapper.h new file mode 100644 index 0000000..06a7350 --- /dev/null +++ b/wrapper.h @@ -0,0 +1 @@ +#include