summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/codegen/mod.rs18
-rw-r--r--src/features.rs187
-rw-r--r--src/ir/analysis/derive_copy.rs2
-rw-r--r--src/ir/analysis/derive_debug.rs2
-rw-r--r--src/ir/analysis/derive_default.rs2
-rw-r--r--src/lib.rs59
-rw-r--r--src/options.rs20
-rw-r--r--tests/expectations/tests/16-byte-alignment.rs65
-rw-r--r--tests/expectations/tests/16-byte-alignment_1_0.rs232
-rw-r--r--tests/expectations/tests/anon_struct_in_union.rs39
-rw-r--r--tests/expectations/tests/anon_struct_in_union_1_0.rs92
-rw-r--r--tests/expectations/tests/anon_union.rs40
-rw-r--r--tests/expectations/tests/anon_union_1_0.rs90
-rw-r--r--tests/expectations/tests/class.rs41
-rw-r--r--tests/expectations/tests/class_1_0.rs301
-rw-r--r--tests/expectations/tests/class_with_inner_struct.rs66
-rw-r--r--tests/expectations/tests/class_with_inner_struct_1_0.rs324
-rw-r--r--tests/expectations/tests/forward_declared_complex_types_1_0.rs71
-rw-r--r--tests/expectations/tests/issue-493.rs55
-rw-r--r--tests/expectations/tests/issue-493_1_0.rs111
-rw-r--r--tests/expectations/tests/jsval_layout_opaque.rs70
-rw-r--r--tests/expectations/tests/jsval_layout_opaque_1_0.rs347
-rw-r--r--tests/expectations/tests/layout_eth_conf.rs38
-rw-r--r--tests/expectations/tests/layout_eth_conf_1_0.rs1646
-rw-r--r--tests/expectations/tests/layout_mbuf.rs105
-rw-r--r--tests/expectations/tests/layout_mbuf_1_0.rs1091
-rw-r--r--tests/expectations/tests/struct_with_anon_union.rs41
-rw-r--r--tests/expectations/tests/struct_with_anon_union_1_0.rs77
-rw-r--r--tests/expectations/tests/struct_with_anon_unnamed_union.rs41
-rw-r--r--tests/expectations/tests/struct_with_anon_unnamed_union_1_0.rs72
-rw-r--r--tests/expectations/tests/struct_with_nesting.rs43
-rw-r--r--tests/expectations/tests/struct_with_nesting_1_0.rs152
-rw-r--r--tests/expectations/tests/typeref.rs44
-rw-r--r--tests/expectations/tests/typeref_1_0.rs133
-rw-r--r--tests/expectations/tests/union-in-ns.rs38
-rw-r--r--tests/expectations/tests/union-in-ns_1_0.rs60
-rw-r--r--tests/expectations/tests/union_dtor.rs35
-rw-r--r--tests/expectations/tests/union_dtor_1_0.rs64
-rw-r--r--tests/expectations/tests/union_fields.rs38
-rw-r--r--tests/expectations/tests/union_fields_1_0.rs63
-rw-r--r--tests/expectations/tests/union_template.rs61
-rw-r--r--tests/expectations/tests/union_template_1_0.rs58
-rw-r--r--tests/expectations/tests/union_with_anon_struct.rs34
-rw-r--r--tests/expectations/tests/union_with_anon_struct_1_0.rs77
-rw-r--r--tests/expectations/tests/union_with_anon_struct_bitfield.rs36
-rw-r--r--tests/expectations/tests/union_with_anon_struct_bitfield_1_0.rs148
-rw-r--r--tests/expectations/tests/union_with_anon_union.rs46
-rw-r--r--tests/expectations/tests/union_with_anon_union_1_0.rs78
-rw-r--r--tests/expectations/tests/union_with_anon_unnamed_struct.rs36
-rw-r--r--tests/expectations/tests/union_with_anon_unnamed_struct_1_0.rs91
-rw-r--r--tests/expectations/tests/union_with_anon_unnamed_union.rs48
-rw-r--r--tests/expectations/tests/union_with_anon_unnamed_union_1_0.rs79
-rw-r--r--tests/expectations/tests/union_with_big_member.rs50
-rw-r--r--tests/expectations/tests/union_with_big_member_1_0.rs117
-rw-r--r--tests/expectations/tests/union_with_nesting.rs65
-rw-r--r--tests/expectations/tests/union_with_nesting_1_0.rs134
-rw-r--r--tests/expectations/tests/use-core.rs36
-rw-r--r--tests/expectations/tests/use-core_1_0.rs99
-rw-r--r--tests/headers/16-byte-alignment.h1
-rw-r--r--tests/headers/16-byte-alignment_1_0.h34
-rw-r--r--tests/headers/anon_struct_in_union_1_0.h9
-rw-r--r--tests/headers/anon_union_1_0.hpp22
-rw-r--r--tests/headers/class_1_0.hpp58
-rw-r--r--tests/headers/class_with_inner_struct.hpp1
-rw-r--r--tests/headers/class_with_inner_struct_1_0.hpp44
-rw-r--r--tests/headers/forward_declared_complex_types_1_0.hpp18
-rw-r--r--tests/headers/issue-493.hpp2
-rw-r--r--tests/headers/issue-493_1_0.hpp49
-rw-r--r--tests/headers/jsval_layout_opaque_1_0.hpp424
-rw-r--r--tests/headers/layout_eth_conf.h2
-rw-r--r--tests/headers/layout_eth_conf_1_0.h429
-rw-r--r--tests/headers/layout_mbuf.h3
-rw-r--r--tests/headers/layout_mbuf_1_0.h189
-rw-r--r--tests/headers/struct_with_anon_union_1_0.h8
-rw-r--r--tests/headers/struct_with_anon_unnamed_union_1_0.h8
-rw-r--r--tests/headers/struct_with_nesting_1_0.h19
-rw-r--r--tests/headers/typeref_1_0.hpp30
-rw-r--r--tests/headers/union-in-ns_1_0.hpp5
-rw-r--r--tests/headers/union_dtor_1_0.hpp7
-rw-r--r--tests/headers/union_fields_1_0.hpp7
-rw-r--r--tests/headers/union_template_1_0.hpp21
-rw-r--r--tests/headers/union_with_anon_struct_1_0.h8
-rw-r--r--tests/headers/union_with_anon_struct_bitfield_1_0.h9
-rw-r--r--tests/headers/union_with_anon_union_1_0.h8
-rw-r--r--tests/headers/union_with_anon_unnamed_struct_1_0.h11
-rw-r--r--tests/headers/union_with_anon_unnamed_union_1_0.h9
-rw-r--r--tests/headers/union_with_big_member_1_0.h16
-rw-r--r--tests/headers/union_with_nesting_1_0.h16
-rw-r--r--tests/headers/use-core_1_0.h13
89 files changed, 891 insertions, 7897 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs
index ef6f031f..5c00a53d 100644
--- a/src/codegen/mod.rs
+++ b/src/codegen/mod.rs
@@ -350,7 +350,7 @@ impl CodeGenerator for Module {
}
if item.id() == ctx.root_module() {
- if result.saw_union && !ctx.options().rust_features().untagged_union() {
+ if result.saw_union && !ctx.options().unstable_rust {
utils::prepend_union_types(ctx, &mut *result);
}
if result.saw_incomplete_array {
@@ -911,8 +911,8 @@ impl<'a> FieldCodegen<'a> for FieldData {
let field_ty = ctx.resolve_type(self.ty());
let ty = self.ty().to_rust_ty_or_opaque(ctx, &());
- // NB: If supported, we use proper `union` types.
- let ty = if parent.is_union() && !ctx.options().rust_features().untagged_union() {
+ // NB: In unstable rust we use proper `union` types.
+ let ty = if parent.is_union() && !ctx.options().unstable_rust {
if ctx.options().enable_cxx_namespaces {
quote_ty!(ctx.ext_cx(), root::__BindgenUnionField<$ty>)
} else {
@@ -1052,8 +1052,8 @@ impl BitfieldUnit {
-> P<ast::Item> {
let ctor_name = self.ctor_name(ctx);
- // If supported, add the const.
- let fn_prefix = if ctx.options().rust_features().const_fn() {
+ // If we're generating unstable Rust, add the const.
+ let fn_prefix = if ctx.options().unstable_rust {
quote_tokens!(ctx.ext_cx(), pub const fn)
} else {
quote_tokens!(ctx.ext_cx(), pub fn)
@@ -1115,8 +1115,8 @@ impl Bitfield {
let offset = self.offset_into_unit();
let mask = self.mask();
- // If supported, add the const.
- let fn_prefix = if ctx.options().rust_features().const_fn() {
+ // If we're generating unstable Rust, add the const.
+ let fn_prefix = if ctx.options().unstable_rust {
quote_tokens!(ctx.ext_cx(), pub const fn)
} else {
quote_tokens!(ctx.ext_cx(), pub fn)
@@ -1445,7 +1445,7 @@ impl CodeGenerator for CompInfo {
}
let canonical_name = item.canonical_name(ctx);
- let builder = if is_union && ctx.options().rust_features().untagged_union() {
+ let builder = if is_union && ctx.options().unstable_rust {
aster::AstBuilder::new()
.item()
.pub_()
@@ -1552,7 +1552,7 @@ impl CodeGenerator for CompInfo {
());
}
- if is_union && !ctx.options().rust_features().untagged_union() {
+ if is_union && !ctx.options().unstable_rust {
let layout = layout.expect("Unable to get layout information?");
let ty = BlobTyBuilder::new(layout).build();
let field = StructFieldBuilder::named("bindgen_union_field")
diff --git a/src/features.rs b/src/features.rs
deleted file mode 100644
index ba2f11cf..00000000
--- a/src/features.rs
+++ /dev/null
@@ -1,187 +0,0 @@
-//! Contains code for selecting features
-
-#![deny(missing_docs)]
-#![deny(warnings)]
-#![deny(unused_extern_crates)]
-
-use std::io;
-use std::str::FromStr;
-
-/// Define RustTarget struct definition, Default impl, and conversions
-/// between RustTarget and String.
-macro_rules! rust_target_def {
- ( $( $( #[$attr:meta] )* => $release:ident => $value:expr; )* ) => {
- /// Represents the version of the Rust language to target.
- ///
- /// To support a beta release, use the corresponding stable release.
- ///
- /// This enum will have more variants added as necessary.
- #[derive(Debug, Copy, Clone, Eq, PartialEq, PartialOrd, Hash)]
- #[allow(non_camel_case_types)]
- pub enum RustTarget {
- $(
- $(
- #[$attr]
- )*
- $release,
- )*
- }
-
- impl Default for RustTarget {
- /// Gives the latest stable Rust version
- fn default() -> RustTarget {
- LATEST_STABLE_RUST
- }
- }
-
- impl FromStr for RustTarget {
- type Err = io::Error;
-
- #[allow(dead_code)]
- /// Create a `RustTarget` from a string.
- ///
- /// * The stable/beta versions of Rust are of the form "1.0",
- /// "1.19", etc.
- /// * The nightly version should be specified with "nightly".
- fn from_str(s: &str) -> Result<Self, Self::Err> {
- match s.as_ref() {
- $(
- stringify!($value) => Ok(RustTarget::$release),
- )*
- _ => Err(
- io::Error::new(
- io::ErrorKind::InvalidInput,
- concat!(
- "Got an invalid rust target. Accepted values ",
- "are of the form ",
- "\"1.0\" or \"nightly\"."))),
- }
- }
- }
-
- impl From<RustTarget> for String {
- fn from(target: RustTarget) -> Self {
- match target {
- $(
- RustTarget::$release => stringify!($value),
- )*
- }.into()
- }
- }
- }
-}
-
-/// Defines an array slice with all RustTarget values
-macro_rules! rust_target_values_def {
- ( $( $( #[$attr:meta] )* => $release:ident => $value:expr; )* ) => {
- /// Strings of allowed `RustTarget` values
- #[allow(dead_code)]
- pub static RUST_TARGET_STRINGS: &'static [&str] = &[
- $(
- stringify!($value),
- )*
- ];
- }
-}
-
-/// Defines macro which takes a macro
-macro_rules! rust_target_base {
- ( $x_macro:ident ) => {
- $x_macro!(
- /// Rust stable 1.0
- => Stable_1_0 => 1.0;
- /// Rust stable 1.19
- => Stable_1_19 => 1.19;
- /// Nightly rust
- => Nightly => nightly;
- );
- }
-}
-
-rust_target_base!(rust_target_def);
-rust_target_base!(rust_target_values_def);
-
-/// Latest stable release of Rust
-pub const LATEST_STABLE_RUST: RustTarget = RustTarget::Stable_1_19;
-
-/// Create RustFeatures struct definition, new(), and a getter for each field
-macro_rules! rust_feature_def {
- ( $( $( #[$attr:meta] )* => $feature:ident; )* ) => {
- /// Features supported by a rust target
- #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
- pub struct RustFeatures {
- $(
- $feature: bool,
- )*
- }
-
- impl RustFeatures {
- /// Gives a RustFeatures struct with all features disabled
- fn new() -> Self {
- RustFeatures {
- $(
- $feature: false,
- )*
- }
- }
-
- $(
- $(
- #[$attr]
- )*
- pub fn $feature(&self) -> bool {
- self.$feature
- }
- )*
- }
- }
-}
-
-rust_feature_def!(
- /// Untagged unions ([RFC 1444](https://github.com/rust-lang/rfcs/blob/master/text/1444-union.md))
- => untagged_union;
- /// Constant function ([RFC 911](https://github.com/rust-lang/rfcs/blob/master/text/0911-const-fn.md))
- => const_fn;
-);
-
-impl From<RustTarget> for RustFeatures {
- fn from(rust_target: RustTarget) -> Self {
- let mut features = RustFeatures::new();
-
- if rust_target >= RustTarget::Stable_1_19 {
- features.untagged_union = true;
- }
-
- if rust_target >= RustTarget::Nightly {
- features.const_fn = true;
- }
-
- features
- }
-}
-
-impl Default for RustFeatures {
- fn default() -> Self {
- let default_rust_target: RustTarget = Default::default();
- Self::from(default_rust_target)
- }
-}
-
-#[cfg(test)]
-mod test {
- #![allow(unused_imports)]
- use super::*;
-
- fn test_target(target_str: &str, target: RustTarget) {
- let target_string: String = target.into();
- assert_eq!(target_str, target_string);
- assert_eq!(target, RustTarget::from_str(target_str).unwrap());
- }
-
- #[test]
- fn str_to_target() {
- test_target("1.0", RustTarget::Stable_1_0);
- test_target("1.19", RustTarget::Stable_1_19);
- test_target("nightly", RustTarget::Nightly);
- }
-}
diff --git a/src/ir/analysis/derive_copy.rs b/src/ir/analysis/derive_copy.rs
index dfd0343c..f4997632 100644
--- a/src/ir/analysis/derive_copy.rs
+++ b/src/ir/analysis/derive_copy.rs
@@ -207,7 +207,7 @@ impl<'ctx, 'gen> MonotoneFramework for CannotDeriveCopy<'ctx, 'gen> {
}
if info.kind() == CompKind::Union {
- if !self.ctx.options().rust_features().untagged_union() {
+ if !self.ctx.options().unstable_rust {
// NOTE: If there's no template parameters we can derive copy
// unconditionally, since arrays are magical for rustc, and
// __BindgenUnionField always implements copy.
diff --git a/src/ir/analysis/derive_debug.rs b/src/ir/analysis/derive_debug.rs
index 8f2be22a..8990d1cc 100644
--- a/src/ir/analysis/derive_debug.rs
+++ b/src/ir/analysis/derive_debug.rs
@@ -208,7 +208,7 @@ impl<'ctx, 'gen> MonotoneFramework for CannotDeriveDebug<'ctx, 'gen> {
);
if info.kind() == CompKind::Union {
- if self.ctx.options().rust_features().untagged_union() {
+ if self.ctx.options().unstable_rust {
trace!(" cannot derive Debug for Rust unions");
return self.insert(id);
}
diff --git a/src/ir/analysis/derive_default.rs b/src/ir/analysis/derive_default.rs
index 4c2cad25..fe429e2a 100644
--- a/src/ir/analysis/derive_default.rs
+++ b/src/ir/analysis/derive_default.rs
@@ -242,7 +242,7 @@ impl<'ctx, 'gen> MonotoneFramework for CannotDeriveDefault<'ctx, 'gen> {
);
if info.kind() == CompKind::Union {
- if self.ctx.options().rust_features().untagged_union() {
+ if self.ctx.options().unstable_rust {
trace!(" cannot derive Default for Rust unions");
return self.insert(id);
}
diff --git a/src/lib.rs b/src/lib.rs
index feb3c309..3a853829 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -62,7 +62,6 @@ macro_rules! doc_mod {
}
mod clang;
-mod features;
mod ir;
mod parse;
mod regex_set;
@@ -73,7 +72,6 @@ pub mod callbacks;
mod codegen;
doc_mod!(clang, clang_docs);
-doc_mod!(features, features_docs);
doc_mod!(ir, ir_docs);
doc_mod!(parse, parse_docs);
doc_mod!(regex_set, regex_set_docs);
@@ -82,8 +80,6 @@ mod codegen {
include!(concat!(env!("OUT_DIR"), "/codegen.rs"));
}
-pub use features::{RustTarget, LATEST_STABLE_RUST, RUST_TARGET_STRINGS};
-use features::RustFeatures;
use ir::context::{BindgenContext, ItemId};
use ir::item::Item;
use parse::{ClangItemParser, ParseError};
@@ -192,8 +188,6 @@ impl Builder {
output_vector.push(header);
}
- output_vector.push(self.options.rust_target.into());
-
self.options
.bitfield_enums
.get_items()
@@ -346,6 +340,10 @@ impl Builder {
output_vector.push("--no-prepend-enum-name".into());
}
+ if !self.options.unstable_rust {
+ output_vector.push("--unstable-rust".into());
+ }
+
self.options
.opaque_types
.get_items()
@@ -465,14 +463,6 @@ impl Builder {
self
}
- /// Specify the rust target
- ///
- /// The default is the latest stable Rust version
- pub fn rust_target(mut self, rust_target: RustTarget) -> Self {
- self.options.set_rust_target(rust_target);
- self
- }
-
/// Set the output graphviz file.
pub fn emit_ir_graphviz<T: Into<String>>(mut self, path: T) -> Builder {
let path = path.into();
@@ -754,10 +744,9 @@ impl Builder {
}
/// Avoid generating any unstable Rust, such as Rust unions, in the generated bindings.
- #[deprecated(note="please use `rust_target` instead")]
- pub fn unstable_rust(self, doit: bool) -> Self {
- let rust_target = if doit { RustTarget::Nightly } else { LATEST_STABLE_RUST };
- self.rust_target(rust_target)
+ pub fn unstable_rust(mut self, doit: bool) -> Self {
+ self.options.unstable_rust = doit;
+ self
}
/// Use core instead of libstd in the generated bindings.
@@ -966,6 +955,10 @@ pub struct BindgenOptions {
/// and types.
pub derive_default: bool,
+ /// True if we can use unstable Rust code in the bindings, false if we
+ /// cannot.
+ pub unstable_rust: bool,
+
/// True if we should avoid using libstd to use libcore instead.
pub use_core: bool,
@@ -1032,12 +1025,6 @@ pub struct BindgenOptions {
/// Whether to prepend the enum name to bitfield or constant variants.
pub prepend_enum_name: bool,
-
- /// Version of the Rust compiler to target
- rust_target: RustTarget,
-
- /// Features to enable, derived from `rust_target`
- rust_features: RustFeatures,
}
/// TODO(emilio): This is sort of a lie (see the error message that results from
@@ -1056,34 +1043,11 @@ impl BindgenOptions {
self.constified_enum_modules.build();
self.constified_enums.build();
}
-
- /// Update rust target version
- pub fn set_rust_target(&mut self, rust_target: RustTarget) {
- self.rust_target = rust_target;
-
- // Keep rust_features synced with rust_target
- self.rust_features = rust_target.into();
- }
-
- /// Get target Rust version
- pub fn rust_target(&self) -> RustTarget {
- self.rust_target
- }
-
- /// Get features supported by target Rust version
- pub fn rust_features(&self) -> RustFeatures {
- self.rust_features
- }
-
}
impl Default for BindgenOptions {
fn default() -> BindgenOptions {
- let rust_target = RustTarget::default();
-
BindgenOptions {
- rust_target: rust_target,
- rust_features: rust_target.into(),
hidden_types: Default::default(),
opaque_types: Default::default(),
whitelisted_types: Default::default(),
@@ -1102,6 +1066,7 @@ impl Default for BindgenOptions {
derive_default: false,
enable_cxx_namespaces: false,
disable_name_namespacing: false,
+ unstable_rust: false,
use_core: false,
ctypes_prefix: None,
namespaced_constants: true,
diff --git a/src/options.rs b/src/options.rs
index e2e1b277..f2ed5494 100644
--- a/src/options.rs
+++ b/src/options.rs
@@ -1,9 +1,7 @@
-use bindgen::{Builder, CodegenConfig, RUST_TARGET_STRINGS, RustTarget, builder};
+use bindgen::{Builder, CodegenConfig, builder};
use clap::{App, Arg};
-// use super::features::RUST_TARGET_STRINGS;
use std::fs::File;
use std::io::{self, Error, ErrorKind};
-use std::str::FromStr;
/// Construct a new [`Builder`](./struct.Builder.html) from command line flags.
pub fn builder_from_flags<I>
@@ -11,10 +9,6 @@ pub fn builder_from_flags<I>
-> Result<(Builder, Box<io::Write>, bool), io::Error>
where I: Iterator<Item = String>,
{
- let rust_target_help = format!(
- "Version of the Rust compiler to target. Valid options are: {:?}.",
- RUST_TARGET_STRINGS);
-
let matches = App::new("bindgen")
.version(env!("CARGO_PKG_VERSION"))
.about("Generates Rust bindings from C/C++ headers.")
@@ -167,10 +161,6 @@ pub fn builder_from_flags<I>
.takes_value(true)
.multiple(true)
.number_of_values(1),
- Arg::with_name("rust-target")
- .long("rust-target")
- .help(&rust_target_help)
- .takes_value(true),
Arg::with_name("static")
.long("static-link")
.help("Link to static library.")
@@ -236,10 +226,6 @@ pub fn builder_from_flags<I>
return Err(Error::new(ErrorKind::Other, "Header not found"));
}
- if let Some(rust_target) = matches.value_of("rust-target") {
- builder = builder.rust_target(RustTarget::from_str(rust_target)?);
- }
-
if let Some(bitfields) = matches.values_of("bitfield-enum") {
for regex in bitfields {
builder = builder.bitfield_enum(regex);
@@ -351,6 +337,10 @@ pub fn builder_from_flags<I>
builder = builder.ignore_methods();
}
+ if matches.is_present("unstable-rust") {
+ builder = builder.unstable_rust(true);
+ }
+
if matches.is_present("no-convert-floats") {
builder = builder.no_convert_floats();
}
diff --git a/tests/expectations/tests/16-byte-alignment.rs b/tests/expectations/tests/16-byte-alignment.rs
index 670128e9..c60d69c3 100644
--- a/tests/expectations/tests/16-byte-alignment.rs
+++ b/tests/expectations/tests/16-byte-alignment.rs
@@ -5,17 +5,42 @@
#[repr(C)]
-#[derive(Copy)]
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy)]
pub struct rte_ipv4_tuple {
pub src_addr: u32,
pub dst_addr: u32,
pub __bindgen_anon_1: rte_ipv4_tuple__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Copy)]
-pub union rte_ipv4_tuple__bindgen_ty_1 {
- pub __bindgen_anon_1: rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1,
- pub sctp_tag: u32,
+#[derive(Debug, Default, Copy)]
+pub struct rte_ipv4_tuple__bindgen_ty_1 {
+ pub __bindgen_anon_1: __BindgenUnionField<rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1>,
+ pub sctp_tag: __BindgenUnionField<u32>,
+ pub bindgen_union_field: u32,
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
@@ -70,9 +95,6 @@ fn bindgen_test_layout_rte_ipv4_tuple__bindgen_ty_1() {
impl Clone for rte_ipv4_tuple__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
-impl Default for rte_ipv4_tuple__bindgen_ty_1 {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
#[test]
fn bindgen_test_layout_rte_ipv4_tuple() {
assert_eq!(::std::mem::size_of::<rte_ipv4_tuple>() , 12usize , concat ! (
@@ -93,21 +115,19 @@ fn bindgen_test_layout_rte_ipv4_tuple() {
impl Clone for rte_ipv4_tuple {
fn clone(&self) -> Self { *self }
}
-impl Default for rte_ipv4_tuple {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Debug, Default, Copy)]
pub struct rte_ipv6_tuple {
pub src_addr: [u8; 16usize],
pub dst_addr: [u8; 16usize],
pub __bindgen_anon_1: rte_ipv6_tuple__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Copy)]
-pub union rte_ipv6_tuple__bindgen_ty_1 {
- pub __bindgen_anon_1: rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1,
- pub sctp_tag: u32,
+#[derive(Debug, Default, Copy)]
+pub struct rte_ipv6_tuple__bindgen_ty_1 {
+ pub __bindgen_anon_1: __BindgenUnionField<rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1>,
+ pub sctp_tag: __BindgenUnionField<u32>,
+ pub bindgen_union_field: u32,
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
@@ -162,9 +182,6 @@ fn bindgen_test_layout_rte_ipv6_tuple__bindgen_ty_1() {
impl Clone for rte_ipv6_tuple__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
-impl Default for rte_ipv6_tuple__bindgen_ty_1 {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
#[test]
fn bindgen_test_layout_rte_ipv6_tuple() {
assert_eq!(::std::mem::size_of::<rte_ipv6_tuple>() , 36usize , concat ! (
@@ -185,14 +202,12 @@ fn bindgen_test_layout_rte_ipv6_tuple() {
impl Clone for rte_ipv6_tuple {
fn clone(&self) -> Self { *self }
}
-impl Default for rte_ipv6_tuple {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
#[repr(C)]
#[derive(Copy)]
-pub union rte_thash_tuple {
- pub v4: rte_ipv4_tuple,
- pub v6: rte_ipv6_tuple,
+pub struct rte_thash_tuple {
+ pub v4: __BindgenUnionField<rte_ipv4_tuple>,
+ pub v6: __BindgenUnionField<rte_ipv6_tuple>,
+ pub bindgen_union_field: [u8; 48usize],
}
#[test]
fn bindgen_test_layout_rte_thash_tuple() {
diff --git a/tests/expectations/tests/16-byte-alignment_1_0.rs b/tests/expectations/tests/16-byte-alignment_1_0.rs
deleted file mode 100644
index c60d69c3..00000000
--- a/tests/expectations/tests/16-byte-alignment_1_0.rs
+++ /dev/null
@@ -1,232 +0,0 @@
-/* automatically generated by rust-bindgen */
-
-
-#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-
-
-#[repr(C)]
-pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
-impl <T> __BindgenUnionField<T> {
- #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
- #[inline]
- fn default() -> Self { Self::new() }
-}
-impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
- #[inline]
- fn clone(&self) -> Self { Self::new() }
-}
-impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
-impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
- fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
- fmt.write_str("__BindgenUnionField")
- }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct rte_ipv4_tuple {
- pub src_addr: u32,
- pub dst_addr: u32,
- pub __bindgen_anon_1: rte_ipv4_tuple__bindgen_ty_1,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct rte_ipv4_tuple__bindgen_ty_1 {
- pub __bindgen_anon_1: __BindgenUnionField<rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1>,
- pub sctp_tag: __BindgenUnionField<u32>,
- pub bindgen_union_field: u32,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 {
- pub dport: u16,
- pub sport: u16,
-}
-#[test]
-fn bindgen_test_layout_rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1() {
- assert_eq!(::std::mem::size_of::<rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1>()
- , 4usize , concat ! (
- "Size of: " , stringify ! (
- rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 ) ));
- assert_eq! (::std::mem::align_of::<rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1>()
- , 2usize , concat ! (
- "Alignment of " , stringify ! (
- rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & (
- * ( 0 as * const rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 )
- ) . dport as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 ) , "::" ,
- stringify ! ( dport ) ));
- assert_eq! (unsafe {
- & (
- * ( 0 as * const rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 )
- ) . sport as * const _ as usize } , 2usize , concat ! (
- "Alignment of field: " , stringify ! (
- rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 ) , "::" ,
- stringify ! ( sport ) ));
-}
-impl Clone for rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1 {
- fn clone(&self) -> Self { *self }
-}
-#[test]
-fn bindgen_test_layout_rte_ipv4_tuple__bindgen_ty_1() {
- assert_eq!(::std::mem::size_of::<rte_ipv4_tuple__bindgen_ty_1>() , 4usize
- , concat ! (
- "Size of: " , stringify ! ( rte_ipv4_tuple__bindgen_ty_1 ) ));
- assert_eq! (::std::mem::align_of::<rte_ipv4_tuple__bindgen_ty_1>() ,
- 4usize , concat ! (
- "Alignment of " , stringify ! ( rte_ipv4_tuple__bindgen_ty_1 )
- ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_ipv4_tuple__bindgen_ty_1 ) ) .
- sctp_tag as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- rte_ipv4_tuple__bindgen_ty_1 ) , "::" , stringify ! ( sctp_tag
- ) ));
-}
-impl Clone for rte_ipv4_tuple__bindgen_ty_1 {
- fn clone(&self) -> Self { *self }
-}
-#[test]
-fn bindgen_test_layout_rte_ipv4_tuple() {
- assert_eq!(::std::mem::size_of::<rte_ipv4_tuple>() , 12usize , concat ! (
- "Size of: " , stringify ! ( rte_ipv4_tuple ) ));
- assert_eq! (::std::mem::align_of::<rte_ipv4_tuple>() , 4usize , concat ! (
- "Alignment of " , stringify ! ( rte_ipv4_tuple ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_ipv4_tuple ) ) . src_addr as * const
- _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_ipv4_tuple ) , "::"
- , stringify ! ( src_addr ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_ipv4_tuple ) ) . dst_addr as * const
- _ as usize } , 4usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_ipv4_tuple ) , "::"
- , stringify ! ( dst_addr ) ));
-}
-impl Clone for rte_ipv4_tuple {
- fn clone(&self) -> Self { *self }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct rte_ipv6_tuple {
- pub src_addr: [u8; 16usize],
- pub dst_addr: [u8; 16usize],
- pub __bindgen_anon_1: rte_ipv6_tuple__bindgen_ty_1,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct rte_ipv6_tuple__bindgen_ty_1 {
- pub __bindgen_anon_1: __BindgenUnionField<rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1>,
- pub sctp_tag: __BindgenUnionField<u32>,
- pub bindgen_union_field: u32,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 {
- pub dport: u16,
- pub sport: u16,
-}
-#[test]
-fn bindgen_test_layout_rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1() {
- assert_eq!(::std::mem::size_of::<rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1>()
- , 4usize , concat ! (
- "Size of: " , stringify ! (
- rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 ) ));
- assert_eq! (::std::mem::align_of::<rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1>()
- , 2usize , concat ! (
- "Alignment of " , stringify ! (
- rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & (
- * ( 0 as * const rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 )
- ) . dport as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 ) , "::" ,
- stringify ! ( dport ) ));
- assert_eq! (unsafe {
- & (
- * ( 0 as * const rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 )
- ) . sport as * const _ as usize } , 2usize , concat ! (
- "Alignment of field: " , stringify ! (
- rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 ) , "::" ,
- stringify ! ( sport ) ));
-}
-impl Clone for rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1 {
- fn clone(&self) -> Self { *self }
-}
-#[test]
-fn bindgen_test_layout_rte_ipv6_tuple__bindgen_ty_1() {
- assert_eq!(::std::mem::size_of::<rte_ipv6_tuple__bindgen_ty_1>() , 4usize
- , concat ! (
- "Size of: " , stringify ! ( rte_ipv6_tuple__bindgen_ty_1 ) ));
- assert_eq! (::std::mem::align_of::<rte_ipv6_tuple__bindgen_ty_1>() ,
- 4usize , concat ! (
- "Alignment of " , stringify ! ( rte_ipv6_tuple__bindgen_ty_1 )
- ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_ipv6_tuple__bindgen_ty_1 ) ) .
- sctp_tag as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- rte_ipv6_tuple__bindgen_ty_1 ) , "::" , stringify ! ( sctp_tag
- ) ));
-}
-impl Clone for rte_ipv6_tuple__bindgen_ty_1 {
- fn clone(&self) -> Self { *self }
-}
-#[test]
-fn bindgen_test_layout_rte_ipv6_tuple() {
- assert_eq!(::std::mem::size_of::<rte_ipv6_tuple>() , 36usize , concat ! (
- "Size of: " , stringify ! ( rte_ipv6_tuple ) ));
- assert_eq! (::std::mem::align_of::<rte_ipv6_tuple>() , 4usize , concat ! (
- "Alignment of " , stringify ! ( rte_ipv6_tuple ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_ipv6_tuple ) ) . src_addr as * const
- _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_ipv6_tuple ) , "::"
- , stringify ! ( src_addr ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_ipv6_tuple ) ) . dst_addr as * const
- _ as usize } , 16usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_ipv6_tuple ) , "::"
- , stringify ! ( dst_addr ) ));
-}
-impl Clone for rte_ipv6_tuple {
- fn clone(&self) -> Self { *self }
-}
-#[repr(C)]
-#[derive(Copy)]
-pub struct rte_thash_tuple {
- pub v4: __BindgenUnionField<rte_ipv4_tuple>,
- pub v6: __BindgenUnionField<rte_ipv6_tuple>,
- pub bindgen_union_field: [u8; 48usize],
-}
-#[test]
-fn bindgen_test_layout_rte_thash_tuple() {
- assert_eq!(::std::mem::size_of::<rte_thash_tuple>() , 48usize , concat ! (
- "Size of: " , stringify ! ( rte_thash_tuple ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_thash_tuple ) ) . v4 as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_thash_tuple ) ,
- "::" , stringify ! ( v4 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_thash_tuple ) ) . v6 as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_thash_tuple ) ,
- "::" , stringify ! ( v6 ) ));
-}
-impl Clone for rte_thash_tuple {
- fn clone(&self) -> Self { *self }
-}
-impl Default for rte_thash_tuple {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
diff --git a/tests/expectations/tests/anon_struct_in_union.rs b/tests/expectations/tests/anon_struct_in_union.rs
index b5150f36..bfb10015 100644
--- a/tests/expectations/tests/anon_struct_in_union.rs
+++ b/tests/expectations/tests/anon_struct_in_union.rs
@@ -5,14 +5,39 @@
#[repr(C)]
-#[derive(Copy)]
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy)]
pub struct s {
pub u: s__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Copy)]
-pub union s__bindgen_ty_1 {
- pub field: s__bindgen_ty_1_inner,
+#[derive(Debug, Default, Copy)]
+pub struct s__bindgen_ty_1 {
+ pub field: __BindgenUnionField<s__bindgen_ty_1_inner>,
+ pub bindgen_union_field: u32,
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
@@ -51,9 +76,6 @@ fn bindgen_test_layout_s__bindgen_ty_1() {
impl Clone for s__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
-impl Default for s__bindgen_ty_1 {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
#[test]
fn bindgen_test_layout_s() {
assert_eq!(::std::mem::size_of::<s>() , 4usize , concat ! (
@@ -68,6 +90,3 @@ fn bindgen_test_layout_s() {
impl Clone for s {
fn clone(&self) -> Self { *self }
}
-impl Default for s {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
diff --git a/tests/expectations/tests/anon_struct_in_union_1_0.rs b/tests/expectations/tests/anon_struct_in_union_1_0.rs
deleted file mode 100644
index bfb10015..00000000
--- a/tests/expectations/tests/anon_struct_in_union_1_0.rs
+++ /dev/null
@@ -1,92 +0,0 @@
-/* automatically generated by rust-bindgen */
-
-
-#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-
-
-#[repr(C)]
-pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
-impl <T> __BindgenUnionField<T> {
- #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
- #[inline]
- fn default() -> Self { Self::new() }
-}
-impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
- #[inline]
- fn clone(&self) -> Self { Self::new() }
-}
-impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
-impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
- fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
- fmt.write_str("__BindgenUnionField")
- }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct s {
- pub u: s__bindgen_ty_1,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct s__bindgen_ty_1 {
- pub field: __BindgenUnionField<s__bindgen_ty_1_inner>,
- pub bindgen_union_field: u32,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct s__bindgen_ty_1_inner {
- pub b: ::std::os::raw::c_int,
-}
-#[test]
-fn bindgen_test_layout_s__bindgen_ty_1_inner() {
- assert_eq!(::std::mem::size_of::<s__bindgen_ty_1_inner>() , 4usize ,
- concat ! ( "Size of: " , stringify ! ( s__bindgen_ty_1_inner )
- ));
- assert_eq! (::std::mem::align_of::<s__bindgen_ty_1_inner>() , 4usize ,
- concat ! (
- "Alignment of " , stringify ! ( s__bindgen_ty_1_inner ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const s__bindgen_ty_1_inner ) ) . b as * const
- _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( s__bindgen_ty_1_inner )
- , "::" , stringify ! ( b ) ));
-}
-impl Clone for s__bindgen_ty_1_inner {
- fn clone(&self) -> Self { *self }
-}
-#[test]
-fn bindgen_test_layout_s__bindgen_ty_1() {
- assert_eq!(::std::mem::size_of::<s__bindgen_ty_1>() , 4usize , concat ! (
- "Size of: " , stringify ! ( s__bindgen_ty_1 ) ));
- assert_eq! (::std::mem::align_of::<s__bindgen_ty_1>() , 4usize , concat !
- ( "Alignment of " , stringify ! ( s__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const s__bindgen_ty_1 ) ) . field as * const _
- as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( s__bindgen_ty_1 ) ,
- "::" , stringify ! ( field ) ));
-}
-impl Clone for s__bindgen_ty_1 {
- fn clone(&self) -> Self { *self }
-}
-#[test]
-fn bindgen_test_layout_s() {
- assert_eq!(::std::mem::size_of::<s>() , 4usize , concat ! (
- "Size of: " , stringify ! ( s ) ));
- assert_eq! (::std::mem::align_of::<s>() , 4usize , concat ! (
- "Alignment of " , stringify ! ( s ) ));
- assert_eq! (unsafe { & ( * ( 0 as * const s ) ) . u as * const _ as usize
- } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( s ) , "::" , stringify
- ! ( u ) ));
-}
-impl Clone for s {
- fn clone(&self) -> Self { *self }
-}
diff --git a/tests/expectations/tests/anon_union.rs b/tests/expectations/tests/anon_union.rs
index 0f5af1a2..97cd40f5 100644
--- a/tests/expectations/tests/anon_union.rs
+++ b/tests/expectations/tests/anon_union.rs
@@ -5,6 +5,31 @@
#[repr(C)]
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
pub struct TErrorResult {
pub mResult: ::std::os::raw::c_int,
pub __bindgen_anon_1: TErrorResult__bindgen_ty_1,
@@ -27,17 +52,17 @@ pub struct TErrorResult_DOMExceptionInfo {
pub _address: u8,
}
#[repr(C)]
-pub union TErrorResult__bindgen_ty_1 {
- pub mMessage: *mut TErrorResult_Message,
- pub mDOMExceptionInfo: *mut TErrorResult_DOMExceptionInfo,
-}
-impl Default for TErrorResult__bindgen_ty_1 {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+#[derive(Debug, Default, Copy, Clone)]
+pub struct TErrorResult__bindgen_ty_1 {
+ pub mMessage: __BindgenUnionField<*mut TErrorResult_Message>,
+ pub mDOMExceptionInfo: __BindgenUnionField<*mut TErrorResult_DOMExceptionInfo>,
+ pub bindgen_union_field: u64,
}
impl Default for TErrorResult {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
+#[derive(Debug, Copy)]
pub struct ErrorResult {
pub _base: TErrorResult,
}
@@ -48,6 +73,9 @@ fn bindgen_test_layout_ErrorResult() {
assert_eq! (::std::mem::align_of::<ErrorResult>() , 8usize , concat ! (
"Alignment of " , stringify ! ( ErrorResult ) ));
}
+impl Clone for ErrorResult {
+ fn clone(&self) -> Self { *self }
+}
impl Default for ErrorResult {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
diff --git a/tests/expectations/tests/anon_union_1_0.rs b/tests/expectations/tests/anon_union_1_0.rs
deleted file mode 100644
index 97cd40f5..00000000
--- a/tests/expectations/tests/anon_union_1_0.rs
+++ /dev/null
@@ -1,90 +0,0 @@
-/* automatically generated by rust-bindgen */
-
-
-#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-
-
-#[repr(C)]
-pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
-impl <T> __BindgenUnionField<T> {
- #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
- #[inline]
- fn default() -> Self { Self::new() }
-}
-impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
- #[inline]
- fn clone(&self) -> Self { Self::new() }
-}
-impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
-impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
- fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
- fmt.write_str("__BindgenUnionField")
- }
-}
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct TErrorResult {
- pub mResult: ::std::os::raw::c_int,
- pub __bindgen_anon_1: TErrorResult__bindgen_ty_1,
- pub mMightHaveUnreported: bool,
- pub mUnionState: TErrorResult_UnionState,
-}
-pub const TErrorResult_UnionState_HasException: TErrorResult_UnionState =
- TErrorResult_UnionState::HasMessage;
-#[repr(i32)]
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum TErrorResult_UnionState { HasMessage = 0, }
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
-pub struct TErrorResult_Message {
- pub _address: u8,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
-pub struct TErrorResult_DOMExceptionInfo {
- pub _address: u8,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
-pub struct TErrorResult__bindgen_ty_1 {
- pub mMessage: __BindgenUnionField<*mut TErrorResult_Message>,
- pub mDOMExceptionInfo: __BindgenUnionField<*mut TErrorResult_DOMExceptionInfo>,
- pub bindgen_union_field: u64,
-}
-impl Default for TErrorResult {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
-#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct ErrorResult {
- pub _base: TErrorResult,
-}
-#[test]
-fn bindgen_test_layout_ErrorResult() {
- assert_eq!(::std::mem::size_of::<ErrorResult>() , 24usize , concat ! (
- "Size of: " , stringify ! ( ErrorResult ) ));
- assert_eq! (::std::mem::align_of::<ErrorResult>() , 8usize , concat ! (
- "Alignment of " , stringify ! ( ErrorResult ) ));
-}
-impl Clone for ErrorResult {
- fn clone(&self) -> Self { *self }
-}
-impl Default for ErrorResult {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
-#[test]
-fn __bindgen_test_layout_TErrorResult_open0_int_close0_instantiation() {
- assert_eq!(::std::mem::size_of::<TErrorResult>() , 24usize , concat ! (
- "Size of template specialization: " , stringify ! (
- TErrorResult ) ));
- assert_eq!(::std::mem::align_of::<TErrorResult>() , 8usize , concat ! (
- "Alignment of template specialization: " , stringify ! (
- TErrorResult ) ));
-}
diff --git a/tests/expectations/tests/class.rs b/tests/expectations/tests/class.rs
index 7565076a..26e6a62c 100644
--- a/tests/expectations/tests/class.rs
+++ b/tests/expectations/tests/class.rs
@@ -38,6 +38,30 @@ impl <T> ::std::clone::Clone for __IncompleteArrayField<T> {
}
impl <T> ::std::marker::Copy for __IncompleteArrayField<T> { }
#[repr(C)]
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+#[repr(C)]
#[derive(Copy)]
pub struct C {
pub a: ::std::os::raw::c_int,
@@ -176,10 +200,11 @@ impl Default for IncompleteArrayNonCopiable {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Copy)]
-pub union Union {
- pub d: f32,
- pub i: ::std::os::raw::c_int,
+#[derive(Debug, Default, Copy)]
+pub struct Union {
+ pub d: __BindgenUnionField<f32>,
+ pub i: __BindgenUnionField<::std::os::raw::c_int>,
+ pub bindgen_union_field: u32,
}
#[test]
fn bindgen_test_layout_Union() {
@@ -201,11 +226,8 @@ fn bindgen_test_layout_Union() {
impl Clone for Union {
fn clone(&self) -> Self { *self }
}
-impl Default for Union {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Debug, Default, Copy)]
pub struct WithUnion {
pub data: Union,
}
@@ -224,9 +246,6 @@ fn bindgen_test_layout_WithUnion() {
impl Clone for WithUnion {
fn clone(&self) -> Self { *self }
}
-impl Default for WithUnion {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct RealAbstractionWithTonsOfMethods {
diff --git a/tests/expectations/tests/class_1_0.rs b/tests/expectations/tests/class_1_0.rs
deleted file mode 100644
index 26e6a62c..00000000
--- a/tests/expectations/tests/class_1_0.rs
+++ /dev/null
@@ -1,301 +0,0 @@
-/* automatically generated by rust-bindgen */
-
-
-#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-
-
-#[repr(C)]
-#[derive(Default)]
-pub struct __IncompleteArrayField<T>(::std::marker::PhantomData<T>);
-impl <T> __IncompleteArrayField<T> {
- #[inline]
- pub fn new() -> Self {
- __IncompleteArrayField(::std::marker::PhantomData)
- }
- #[inline]
- pub unsafe fn as_ptr(&self) -> *const T { ::std::mem::transmute(self) }
- #[inline]
- pub unsafe fn as_mut_ptr(&mut self) -> *mut T {
- ::std::mem::transmute(self)
- }
- #[inline]
- pub unsafe fn as_slice(&self, len: usize) -> &[T] {
- ::std::slice::from_raw_parts(self.as_ptr(), len)
- }
- #[inline]
- pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] {
- ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len)
- }
-}
-impl <T> ::std::fmt::Debug for __IncompleteArrayField<T> {
- fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
- fmt.write_str("__IncompleteArrayField")
- }
-}
-impl <T> ::std::clone::Clone for __IncompleteArrayField<T> {
- #[inline]
- fn clone(&self) -> Self { Self::new() }
-}
-impl <T> ::std::marker::Copy for __IncompleteArrayField<T> { }
-#[repr(C)]
-pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
-impl <T> __BindgenUnionField<T> {
- #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
- #[inline]
- fn default() -> Self { Self::new() }
-}
-impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
- #[inline]
- fn clone(&self) -> Self { Self::new() }
-}
-impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
-impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
- fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
- fmt.write_str("__BindgenUnionField")
- }
-}
-#[repr(C)]
-#[derive(Copy)]
-pub struct C {
- pub a: ::std::os::raw::c_int,
- pub big_array: [::std::os::raw::c_char; 33usize],
-}
-#[test]
-fn bindgen_test_layout_C() {
- assert_eq!(::std::mem::size_of::<C>() , 40usize , concat ! (
- "Size of: " , stringify ! ( C ) ));
- assert_eq! (::std::mem::align_of::<C>() , 4usize , concat ! (
- "Alignment of " , stringify ! ( C ) ));
- assert_eq! (unsafe { & ( * ( 0 as * const C ) ) . a as * const _ as usize
- } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( C ) , "::" , stringify
- ! ( a ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const C ) ) . big_array as * const _ as usize }
- , 4usize , concat ! (
- "Alignment of field: " , stringify ! ( C ) , "::" , stringify
- ! ( big_array ) ));
-}
-impl Clone for C {
- fn clone(&self) -> Self { *self }
-}
-impl Default for C {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
-#[repr(C)]
-pub struct C_with_zero_length_array {
- pub a: ::std::os::raw::c_int,
- pub big_array: [::std::os::raw::c_char; 33usize],
- pub zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>,
-}
-#[test]
-fn bindgen_test_layout_C_with_zero_length_array() {
- assert_eq!(::std::mem::size_of::<C_with_zero_length_array>() , 40usize ,
- concat ! (
- "Size of: " , stringify ! ( C_with_zero_length_array ) ));
- assert_eq! (::std::mem::align_of::<C_with_zero_length_array>() , 4usize ,
- concat ! (
- "Alignment of " , stringify ! ( C_with_zero_length_array ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const C_with_zero_length_array ) ) . a as *
- const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- C_with_zero_length_array ) , "::" , stringify ! ( a ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const C_with_zero_length_array ) ) . big_array
- as * const _ as usize } , 4usize , concat ! (
- "Alignment of field: " , stringify ! (
- C_with_zero_length_array ) , "::" , stringify ! ( big_array )
- ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const C_with_zero_length_array ) ) .
- zero_length_array as * const _ as usize } , 37usize , concat !
- (
- "Alignment of field: " , stringify ! (
- C_with_zero_length_array ) , "::" , stringify ! (
- zero_length_array ) ));
-}
-impl Default for C_with_zero_length_array {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
-#[repr(C)]
-pub struct C_with_incomplete_array {
- pub a: ::std::os::raw::c_int,
- pub big_array: [::std::os::raw::c_char; 33usize],
- pub incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>,
-}
-#[test]
-fn bindgen_test_layout_C_with_incomplete_array() {
- assert_eq!(::std::mem::size_of::<C_with_incomplete_array>() , 40usize ,
- concat ! (
- "Size of: " , stringify ! ( C_with_incomplete_array ) ));
- assert_eq! (::std::mem::align_of::<C_with_incomplete_array>() , 4usize ,
- concat ! (
- "Alignment of " , stringify ! ( C_with_incomplete_array ) ));
-}
-impl Default for C_with_incomplete_array {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
-#[repr(C)]
-pub struct C_with_zero_length_array_and_incomplete_array {
- pub a: ::std::os::raw::c_int,
- pub big_array: [::std::os::raw::c_char; 33usize],
- pub zero_length_array: __IncompleteArrayField<::std::os::raw::c_char>,
- pub incomplete_array: __IncompleteArrayField<::std::os::raw::c_char>,
-}
-#[test]
-fn bindgen_test_layout_C_with_zero_length_array_and_incomplete_array() {
- assert_eq!(::std::mem::size_of::<C_with_zero_length_array_and_incomplete_array>()
- , 40usize , concat ! (
- "Size of: " , stringify ! (
- C_with_zero_length_array_and_incomplete_array ) ));
- assert_eq! (::std::mem::align_of::<C_with_zero_length_array_and_incomplete_array>()
- , 4usize , concat ! (
- "Alignment of " , stringify ! (
- C_with_zero_length_array_and_incomplete_array ) ));
-}
-impl Default for C_with_zero_length_array_and_incomplete_array {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
-#[repr(C)]
-#[derive(Debug, Default)]
-pub struct WithDtor {
- pub b: ::std::os::raw::c_int,
-}
-#[test]
-fn bindgen_test_layout_WithDtor() {
- assert_eq!(::std::mem::size_of::<WithDtor>() , 4usize , concat ! (
- "Size of: " , stringify ! ( WithDtor ) ));
- assert_eq! (::std::mem::align_of::<WithDtor>() , 4usize , concat ! (
- "Alignment of " , stringify ! ( WithDtor ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const WithDtor ) ) . b as * const _ as usize }
- , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( WithDtor ) , "::" ,
- stringify ! ( b ) ));
-}
-#[repr(C)]
-pub struct IncompleteArrayNonCopiable {
- pub whatever: *mut ::std::os::raw::c_void,
- pub incomplete_array: __IncompleteArrayField<C>,
-}
-#[test]
-fn bindgen_test_layout_IncompleteArrayNonCopiable() {
- assert_eq!(::std::mem::size_of::<IncompleteArrayNonCopiable>() , 8usize ,
- concat ! (
- "Size of: " , stringify ! ( IncompleteArrayNonCopiable ) ));
- assert_eq! (::std::mem::align_of::<IncompleteArrayNonCopiable>() , 8usize
- , concat ! (
- "Alignment of " , stringify ! ( IncompleteArrayNonCopiable )
- ));
-}
-impl Default for IncompleteArrayNonCopiable {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct Union {
- pub d: __BindgenUnionField<f32>,
- pub i: __BindgenUnionField<::std::os::raw::c_int>,
- pub bindgen_union_field: u32,
-}
-#[test]
-fn bindgen_test_layout_Union() {
- assert_eq!(::std::mem::size_of::<Union>() , 4usize , concat ! (
- "Size of: " , stringify ! ( Union ) ));
- assert_eq! (::std::mem::align_of::<Union>() , 4usize , concat ! (
- "Alignment of " , stringify ! ( Union ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const Union ) ) . d as * const _ as usize } ,
- 0usize , concat ! (
- "Alignment of field: " , stringify ! ( Union ) , "::" ,
- stringify ! ( d ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const Union ) ) . i as * const _ as usize } ,
- 0usize , concat ! (
- "Alignment of field: " , stringify ! ( Union ) , "::" ,
- stringify ! ( i ) ));
-}
-impl Clone for Union {
- fn clone(&self) -> Self { *self }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct WithUnion {
- pub data: Union,
-}
-#[test]
-fn bindgen_test_layout_WithUnion() {
- assert_eq!(::std::mem::size_of::<WithUnion>() , 4usize , concat ! (
- "Size of: " , stringify ! ( WithUnion ) ));
- assert_eq! (::std::mem::align_of::<WithUnion>() , 4usize , concat ! (
- "Alignment of " , stringify ! ( WithUnion ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const WithUnion ) ) . data as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( WithUnion ) , "::" ,
- stringify ! ( data ) ));
-}
-impl Clone for WithUnion {
- fn clone(&self) -> Self { *self }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct RealAbstractionWithTonsOfMethods {
- pub _address: u8,
-}
-#[test]
-fn bindgen_test_layout_RealAbstractionWithTonsOfMethods() {
- assert_eq!(::std::mem::size_of::<RealAbstractionWithTonsOfMethods>() ,
- 1usize , concat ! (
- "Size of: " , stringify ! ( RealAbstractionWithTonsOfMethods )
- ));
- assert_eq! (::std::mem::align_of::<RealAbstractionWithTonsOfMethods>() ,
- 1usize , concat ! (
- "Alignment of " , stringify ! (
- RealAbstractionWithTonsOfMethods ) ));
-}
-extern "C" {
- #[link_name = "_ZNK32RealAbstractionWithTonsOfMethods3barEv"]
- pub fn RealAbstractionWithTonsOfMethods_bar(this:
- *const RealAbstractionWithTonsOfMethods);
-}
-extern "C" {
- #[link_name = "_ZN32RealAbstractionWithTonsOfMethods3barEv"]
- pub fn RealAbstractionWithTonsOfMethods_bar1(this:
- *mut RealAbstractionWithTonsOfMethods);
-}
-extern "C" {
- #[link_name = "_ZN32RealAbstractionWithTonsOfMethods3barEi"]
- pub fn RealAbstractionWithTonsOfMethods_bar2(this:
- *mut RealAbstractionWithTonsOfMethods,
- foo: ::std::os::raw::c_int);
-}
-extern "C" {
- #[link_name = "_ZN32RealAbstractionWithTonsOfMethods3staEv"]
- pub fn RealAbstractionWithTonsOfMethods_sta();
-}
-impl Clone for RealAbstractionWithTonsOfMethods {
- fn clone(&self) -> Self { *self }
-}
-impl RealAbstractionWithTonsOfMethods {
- #[inline]
- pub unsafe fn bar(&self) { RealAbstractionWithTonsOfMethods_bar(self) }
- #[inline]
- pub unsafe fn bar1(&mut self) {
- RealAbstractionWithTonsOfMethods_bar1(self)
- }
- #[inline]
- pub unsafe fn bar2(&mut self, foo: ::std::os::raw::c_int) {
- RealAbstractionWithTonsOfMethods_bar2(self, foo)
- }
- #[inline]
- pub unsafe fn sta() { RealAbstractionWithTonsOfMethods_sta() }
-}
diff --git a/tests/expectations/tests/class_with_inner_struct.rs b/tests/expectations/tests/class_with_inner_struct.rs
index 7cd725fa..f4b03b4e 100644
--- a/tests/expectations/tests/class_with_inner_struct.rs
+++ b/tests/expectations/tests/class_with_inner_struct.rs
@@ -5,7 +5,31 @@
#[repr(C)]
-#[derive(Copy)]
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy)]
pub struct A {
pub c: ::std::os::raw::c_uint,
pub named_union: A__bindgen_ty_1,
@@ -38,9 +62,10 @@ impl Clone for A_Segment {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Copy)]
-pub union A__bindgen_ty_1 {
- pub f: ::std::os::raw::c_int,
+#[derive(Debug, Default, Copy)]
+pub struct A__bindgen_ty_1 {
+ pub f: __BindgenUnionField<::std::os::raw::c_int>,
+ pub bindgen_union_field: u32,
}
#[test]
fn bindgen_test_layout_A__bindgen_ty_1() {
@@ -57,13 +82,11 @@ fn bindgen_test_layout_A__bindgen_ty_1() {
impl Clone for A__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
-impl Default for A__bindgen_ty_1 {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
#[repr(C)]
-#[derive(Copy)]
-pub union A__bindgen_ty_2 {
- pub d: ::std::os::raw::c_int,
+#[derive(Debug, Default, Copy)]
+pub struct A__bindgen_ty_2 {
+ pub d: __BindgenUnionField<::std::os::raw::c_int>,
+ pub bindgen_union_field: u32,
}
#[test]
fn bindgen_test_layout_A__bindgen_ty_2() {
@@ -80,9 +103,6 @@ fn bindgen_test_layout_A__bindgen_ty_2() {
impl Clone for A__bindgen_ty_2 {
fn clone(&self) -> Self { *self }
}
-impl Default for A__bindgen_ty_2 {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
#[test]
fn bindgen_test_layout_A() {
assert_eq!(::std::mem::size_of::<A>() , 12usize , concat ! (
@@ -102,9 +122,6 @@ fn bindgen_test_layout_A() {
impl Clone for A {
fn clone(&self) -> Self { *self }
}
-impl Default for A {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct B {
@@ -159,16 +176,17 @@ pub enum StepSyntax {
FunctionalWithEndKeyword = 3,
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Debug, Default, Copy)]
pub struct C {
pub d: ::std::os::raw::c_uint,
pub __bindgen_anon_1: C__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Copy)]
-pub union C__bindgen_ty_1 {
- pub mFunc: C__bindgen_ty_1__bindgen_ty_1,
- pub __bindgen_anon_1: C__bindgen_ty_1__bindgen_ty_2,
+#[derive(Debug, Default, Copy)]
+pub struct C__bindgen_ty_1 {
+ pub mFunc: __BindgenUnionField<C__bindgen_ty_1__bindgen_ty_1>,
+ pub __bindgen_anon_1: __BindgenUnionField<C__bindgen_ty_1__bindgen_ty_2>,
+ pub bindgen_union_field: [u32; 4usize],
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
@@ -264,9 +282,6 @@ fn bindgen_test_layout_C__bindgen_ty_1() {
impl Clone for C__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
-impl Default for C__bindgen_ty_1 {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct C_Segment {
@@ -307,6 +322,3 @@ fn bindgen_test_layout_C() {
impl Clone for C {
fn clone(&self) -> Self { *self }
}
-impl Default for C {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
diff --git a/tests/expectations/tests/class_with_inner_struct_1_0.rs b/tests/expectations/tests/class_with_inner_struct_1_0.rs
deleted file mode 100644
index f4b03b4e..00000000
--- a/tests/expectations/tests/class_with_inner_struct_1_0.rs
+++ /dev/null
@@ -1,324 +0,0 @@
-/* automatically generated by rust-bindgen */
-
-
-#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-
-
-#[repr(C)]
-pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
-impl <T> __BindgenUnionField<T> {
- #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
- #[inline]
- fn default() -> Self { Self::new() }
-}
-impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
- #[inline]
- fn clone(&self) -> Self { Self::new() }
-}
-impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
-impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
- fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
- fmt.write_str("__BindgenUnionField")
- }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct A {
- pub c: ::std::os::raw::c_uint,
- pub named_union: A__bindgen_ty_1,
- pub __bindgen_anon_1: A__bindgen_ty_2,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct A_Segment {
- pub begin: ::std::os::raw::c_int,
- pub end: ::std::os::raw::c_int,
-}
-#[test]
-fn bindgen_test_layout_A_Segment() {
- assert_eq!(::std::mem::size_of::<A_Segment>() , 8usize , concat ! (
- "Size of: " , stringify ! ( A_Segment ) ));
- assert_eq! (::std::mem::align_of::<A_Segment>() , 4usize , concat ! (
- "Alignment of " , stringify ! ( A_Segment ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const A_Segment ) ) . begin as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( A_Segment ) , "::" ,
- stringify ! ( begin ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const A_Segment ) ) . end as * const _ as usize
- } , 4usize , concat ! (
- "Alignment of field: " , stringify ! ( A_Segment ) , "::" ,
- stringify ! ( end ) ));
-}
-impl Clone for A_Segment {
- fn clone(&self) -> Self { *self }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct A__bindgen_ty_1 {
- pub f: __BindgenUnionField<::std::os::raw::c_int>,
- pub bindgen_union_field: u32,
-}
-#[test]
-fn bindgen_test_layout_A__bindgen_ty_1() {
- assert_eq!(::std::mem::size_of::<A__bindgen_ty_1>() , 4usize , concat ! (
- "Size of: " , stringify ! ( A__bindgen_ty_1 ) ));
- assert_eq! (::std::mem::align_of::<A__bindgen_ty_1>() , 4usize , concat !
- ( "Alignment of " , stringify ! ( A__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const A__bindgen_ty_1 ) ) . f as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( A__bindgen_ty_1 ) ,
- "::" , stringify ! ( f ) ));
-}
-impl Clone for A__bindgen_ty_1 {
- fn clone(&self) -> Self { *self }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct A__bindgen_ty_2 {
- pub d: __BindgenUnionField<::std::os::raw::c_int>,
- pub bindgen_union_field: u32,
-}
-#[test]
-fn bindgen_test_layout_A__bindgen_ty_2() {
- assert_eq!(::std::mem::size_of::<A__bindgen_ty_2>() , 4usize , concat ! (
- "Size of: " , stringify ! ( A__bindgen_ty_2 ) ));
- assert_eq! (::std::mem::align_of::<A__bindgen_ty_2>() , 4usize , concat !
- ( "Alignment of " , stringify ! ( A__bindgen_ty_2 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const A__bindgen_ty_2 ) ) . d as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( A__bindgen_ty_2 ) ,
- "::" , stringify ! ( d ) ));
-}
-impl Clone for A__bindgen_ty_2 {
- fn clone(&self) -> Self { *self }
-}
-#[test]
-fn bindgen_test_layout_A() {
- assert_eq!(::std::mem::size_of::<A>() , 12usize , concat ! (
- "Size of: " , stringify ! ( A ) ));
- assert_eq! (::std::mem::align_of::<A>() , 4usize , concat ! (
- "Alignment of " , stringify ! ( A ) ));
- assert_eq! (unsafe { & ( * ( 0 as * const A ) ) . c as * const _ as usize
- } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( A ) , "::" , stringify
- ! ( c ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const A ) ) . named_union as * const _ as usize
- } , 4usize , concat ! (
- "Alignment of field: " , stringify ! ( A ) , "::" , stringify
- ! ( named_union ) ));
-}
-impl Clone for A {
- fn clone(&self) -> Self { *self }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct B {
- pub d: ::std::os::raw::c_uint,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct B_Segment {
- pub begin: ::std::os::raw::c_int,
- pub end: ::std::os::raw::c_int,
-}
-#[test]
-fn bindgen_test_layout_B_Segment() {
- assert_eq!(::std::mem::size_of::<B_Segment>() , 8usize , concat ! (
- "Size of: " , stringify ! ( B_Segment ) ));
- assert_eq! (::std::mem::align_of::<B_Segment>() , 4usize , concat ! (
- "Alignment of " , stringify ! ( B_Segment ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const B_Segment ) ) . begin as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( B_Segment ) , "::" ,
- stringify ! ( begin ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const B_Segment ) ) . end as * const _ as usize
- } , 4usize , concat ! (
- "Alignment of field: " , stringify ! ( B_Segment ) , "::" ,
- stringify ! ( end ) ));
-}
-impl Clone for B_Segment {
- fn clone(&self) -> Self { *self }
-}
-#[test]
-fn bindgen_test_layout_B() {
- assert_eq!(::std::mem::size_of::<B>() , 4usize , concat ! (
- "Size of: " , stringify ! ( B ) ));
- assert_eq! (::std::mem::align_of::<B>() , 4usize , concat ! (
- "Alignment of " , stringify ! ( B ) ));
- assert_eq! (unsafe { & ( * ( 0 as * const B ) ) . d as * const _ as usize
- } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( B ) , "::" , stringify
- ! ( d ) ));
-}
-impl Clone for B {
- fn clone(&self) -> Self { *self }
-}
-#[repr(i32)]
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum StepSyntax {
- Keyword = 0,
- FunctionalWithoutKeyword = 1,
- FunctionalWithStartKeyword = 2,
- FunctionalWithEndKeyword = 3,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct C {
- pub d: ::std::os::raw::c_uint,
- pub __bindgen_anon_1: C__bindgen_ty_1,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct C__bindgen_ty_1 {
- pub mFunc: __BindgenUnionField<C__bindgen_ty_1__bindgen_ty_1>,
- pub __bindgen_anon_1: __BindgenUnionField<C__bindgen_ty_1__bindgen_ty_2>,
- pub bindgen_union_field: [u32; 4usize],
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct C__bindgen_ty_1__bindgen_ty_1 {
- pub mX1: f32,
- pub mY1: f32,
- pub mX2: f32,
- pub mY2: f32,
-}
-#[test]
-fn bindgen_test_layout_C__bindgen_ty_1__bindgen_ty_1() {
- assert_eq!(::std::mem::size_of::<C__bindgen_ty_1__bindgen_ty_1>() ,
- 16usize , concat ! (
- "Size of: " , stringify ! ( C__bindgen_ty_1__bindgen_ty_1 ) ));
- assert_eq! (::std::mem::align_of::<C__bindgen_ty_1__bindgen_ty_1>() ,
- 4usize , concat ! (
- "Alignment of " , stringify ! ( C__bindgen_ty_1__bindgen_ty_1
- ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const C__bindgen_ty_1__bindgen_ty_1 ) ) . mX1
- as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- C__bindgen_ty_1__bindgen_ty_1 ) , "::" , stringify ! ( mX1 )
- ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const C__bindgen_ty_1__bindgen_ty_1 ) ) . mY1
- as * const _ as usize } , 4usize , concat ! (
- "Alignment of field: " , stringify ! (
- C__bindgen_ty_1__bindgen_ty_1 ) , "::" , stringify ! ( mY1 )
- ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const C__bindgen_ty_1__bindgen_ty_1 ) ) . mX2
- as * const _ as usize } , 8usize , concat ! (
- "Alignment of field: " , stringify ! (
- C__bindgen_ty_1__bindgen_ty_1 ) , "::" , stringify ! ( mX2 )
- ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const C__bindgen_ty_1__bindgen_ty_1 ) ) . mY2
- as * const _ as usize } , 12usize , concat ! (
- "Alignment of field: " , stringify ! (
- C__bindgen_ty_1__bindgen_ty_1 ) , "::" , stringify ! ( mY2 )
- ));
-}
-impl Clone for C__bindgen_ty_1__bindgen_ty_1 {
- fn clone(&self) -> Self { *self }
-}
-#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct C__bindgen_ty_1__bindgen_ty_2 {
- pub mStepSyntax: StepSyntax,
- pub mSteps: ::std::os::raw::c_uint,
-}
-#[test]
-fn bindgen_test_layout_C__bindgen_ty_1__bindgen_ty_2() {
- assert_eq!(::std::mem::size_of::<C__bindgen_ty_1__bindgen_ty_2>() , 8usize
- , concat ! (
- "Size of: " , stringify ! ( C__bindgen_ty_1__bindgen_ty_2 ) ));
- assert_eq! (::std::mem::align_of::<C__bindgen_ty_1__bindgen_ty_2>() ,
- 4usize , concat ! (
- "Alignment of " , stringify ! ( C__bindgen_ty_1__bindgen_ty_2
- ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const C__bindgen_ty_1__bindgen_ty_2 ) ) .
- mStepSyntax as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- C__bindgen_ty_1__bindgen_ty_2 ) , "::" , stringify ! (
- mStepSyntax ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const C__bindgen_ty_1__bindgen_ty_2 ) ) .
- mSteps as * const _ as usize } , 4usize , concat ! (
- "Alignment of field: " , stringify ! (
- C__bindgen_ty_1__bindgen_ty_2 ) , "::" , stringify ! ( mSteps
- ) ));
-}
-impl Clone for C__bindgen_ty_1__bindgen_ty_2 {
- fn clone(&self) -> Self { *self }
-}
-impl Default for C__bindgen_ty_1__bindgen_ty_2 {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
-#[test]
-fn bindgen_test_layout_C__bindgen_ty_1() {
- assert_eq!(::std::mem::size_of::<C__bindgen_ty_1>() , 16usize , concat ! (
- "Size of: " , stringify ! ( C__bindgen_ty_1 ) ));
- assert_eq! (::std::mem::align_of::<C__bindgen_ty_1>() , 4usize , concat !
- ( "Alignment of " , stringify ! ( C__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const C__bindgen_ty_1 ) ) . mFunc as * const _
- as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( C__bindgen_ty_1 ) ,
- "::" , stringify ! ( mFunc ) ));
-}
-impl Clone for C__bindgen_ty_1 {
- fn clone(&self) -> Self { *self }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct C_Segment {
- pub begin: ::std::os::raw::c_int,
- pub end: ::std::os::raw::c_int,
-}
-#[test]
-fn bindgen_test_layout_C_Segment() {
- assert_eq!(::std::mem::size_of::<C_Segment>() , 8usize , concat ! (
- "Size of: " , stringify ! ( C_Segment ) ));
- assert_eq! (::std::mem::align_of::<C_Segment>() , 4usize , concat ! (
- "Alignment of " , stringify ! ( C_Segment ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const C_Segment ) ) . begin as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( C_Segment ) , "::" ,
- stringify ! ( begin ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const C_Segment ) ) . end as * const _ as usize
- } , 4usize , concat ! (
- "Alignment of field: " , stringify ! ( C_Segment ) , "::" ,
- stringify ! ( end ) ));
-}
-impl Clone for C_Segment {
- fn clone(&self) -> Self { *self }
-}
-#[test]
-fn bindgen_test_layout_C() {
- assert_eq!(::std::mem::size_of::<C>() , 20usize , concat ! (
- "Size of: " , stringify ! ( C ) ));
- assert_eq! (::std::mem::align_of::<C>() , 4usize , concat ! (
- "Alignment of " , stringify ! ( C ) ));
- assert_eq! (unsafe { & ( * ( 0 as * const C ) ) . d as * const _ as usize
- } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( C ) , "::" , stringify
- ! ( d ) ));
-}
-impl Clone for C {
- fn clone(&self) -> Self { *self }
-}
diff --git a/tests/expectations/tests/forward_declared_complex_types_1_0.rs b/tests/expectations/tests/forward_declared_complex_types_1_0.rs
deleted file mode 100644
index 9baa2d8d..00000000
--- a/tests/expectations/tests/forward_declared_complex_types_1_0.rs
+++ /dev/null
@@ -1,71 +0,0 @@
-/* automatically generated by rust-bindgen */
-
-
-#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-
-
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct Foo_empty {
- pub _address: u8,
-}
-#[test]
-fn bindgen_test_layout_Foo_empty() {
- assert_eq!(::std::mem::size_of::<Foo_empty>() , 1usize , concat ! (
- "Size of: " , stringify ! ( Foo_empty ) ));
- assert_eq! (::std::mem::align_of::<Foo_empty>() , 1usize , concat ! (
- "Alignment of " , stringify ! ( Foo_empty ) ));
-}
-impl Clone for Foo_empty {
- fn clone(&self) -> Self { *self }
-}
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct Foo {
- _unused: [u8; 0],
-}
-#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct Bar {
- pub f: *mut Foo,
-}
-#[test]
-fn bindgen_test_layout_Bar() {
- assert_eq!(::std::mem::size_of::<Bar>() , 8usize , concat ! (
- "Size of: " , stringify ! ( Bar ) ));
- assert_eq! (::std::mem::align_of::<Bar>() , 8usize , concat ! (
- "Alignment of " , stringify ! ( Bar ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const Bar ) ) . f as * const _ as usize } ,
- 0usize , concat ! (
- "Alignment of field: " , stringify ! ( Bar ) , "::" ,
- stringify ! ( f ) ));
-}
-impl Clone for Bar {
- fn clone(&self) -> Self { *self }
-}
-impl Default for Bar {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
-extern "C" {
- #[link_name = "_Z10baz_structP3Foo"]
- pub fn baz_struct(f: *mut Foo);
-}
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct Union {
- _unused: [u8; 0],
-}
-extern "C" {
- #[link_name = "_Z9baz_unionP5Union"]
- pub fn baz_union(u: *mut Union);
-}
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct Quux {
- _unused: [u8; 0],
-}
-extern "C" {
- #[link_name = "_Z9baz_classP4Quux"]
- pub fn baz_class(q: *mut Quux);
-}
diff --git a/tests/expectations/tests/issue-493.rs b/tests/expectations/tests/issue-493.rs
index c1d9dcb8..89f03457 100644
--- a/tests/expectations/tests/issue-493.rs
+++ b/tests/expectations/tests/issue-493.rs
@@ -5,6 +5,30 @@
#[repr(C)]
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct basic_string {
pub _address: u8,
@@ -28,25 +52,27 @@ pub const basic_string___min_cap: basic_string__bindgen_ty_1 =
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum basic_string__bindgen_ty_1 { __min_cap = 0, }
#[repr(C)]
+#[derive(Debug, Copy, Clone)]
pub struct basic_string___short {
pub __bindgen_anon_1: basic_string___short__bindgen_ty_1,
pub __data_: *mut basic_string_value_type,
}
#[repr(C)]
-pub union basic_string___short__bindgen_ty_1 {
- pub __size_: ::std::os::raw::c_uchar,
- pub __lx: basic_string_value_type,
-}
-impl Default for basic_string___short__bindgen_ty_1 {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+#[derive(Debug, Default, Copy, Clone)]
+pub struct basic_string___short__bindgen_ty_1 {
+ pub __size_: __BindgenUnionField<::std::os::raw::c_uchar>,
+ pub __lx: __BindgenUnionField<basic_string_value_type>,
+ pub bindgen_union_field: u8,
}
impl Default for basic_string___short {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-pub union basic_string___ulx {
- pub __lx: basic_string___long,
- pub __lxx: basic_string___short,
+#[derive(Copy, Clone)]
+pub struct basic_string___ulx {
+ pub __lx: __BindgenUnionField<basic_string___long>,
+ pub __lxx: __BindgenUnionField<basic_string___short>,
+ pub bindgen_union_field: [u8; 0usize],
}
impl Default for basic_string___ulx {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
@@ -65,14 +91,17 @@ impl Default for basic_string___raw {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
+#[derive(Copy, Clone)]
pub struct basic_string___rep {
pub __bindgen_anon_1: basic_string___rep__bindgen_ty_1,
}
#[repr(C)]
-pub union basic_string___rep__bindgen_ty_1 {
- pub __l: basic_string___long,
- pub __s: basic_string___short,
- pub __r: basic_string___raw,
+#[derive(Copy, Clone)]
+pub struct basic_string___rep__bindgen_ty_1 {
+ pub __l: __BindgenUnionField<basic_string___long>,
+ pub __s: __BindgenUnionField<basic_string___short>,
+ pub __r: __BindgenUnionField<basic_string___raw>,
+ pub bindgen_union_field: [u8; 0usize],
}
impl Default for basic_string___rep__bindgen_ty_1 {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
diff --git a/tests/expectations/tests/issue-493_1_0.rs b/tests/expectations/tests/issue-493_1_0.rs
deleted file mode 100644
index 89f03457..00000000
--- a/tests/expectations/tests/issue-493_1_0.rs
+++ /dev/null
@@ -1,111 +0,0 @@
-/* automatically generated by rust-bindgen */
-
-
-#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-
-
-#[repr(C)]
-pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
-impl <T> __BindgenUnionField<T> {
- #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
- #[inline]
- fn default() -> Self { Self::new() }
-}
-impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
- #[inline]
- fn clone(&self) -> Self { Self::new() }
-}
-impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
-impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
- fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
- fmt.write_str("__BindgenUnionField")
- }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
-pub struct basic_string {
- pub _address: u8,
-}
-pub type basic_string_size_type = ::std::os::raw::c_ulonglong;
-pub type basic_string_value_type = ::std::os::raw::c_char;
-pub type basic_string_pointer = *mut basic_string_value_type;
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct basic_string___long {
- pub __cap_: basic_string_size_type,
- pub __size_: basic_string_size_type,
- pub __data_: basic_string_pointer,
-}
-impl Default for basic_string___long {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
-pub const basic_string___min_cap: basic_string__bindgen_ty_1 =
- basic_string__bindgen_ty_1::__min_cap;
-#[repr(i32)]
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum basic_string__bindgen_ty_1 { __min_cap = 0, }
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct basic_string___short {
- pub __bindgen_anon_1: basic_string___short__bindgen_ty_1,
- pub __data_: *mut basic_string_value_type,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
-pub struct basic_string___short__bindgen_ty_1 {
- pub __size_: __BindgenUnionField<::std::os::raw::c_uchar>,
- pub __lx: __BindgenUnionField<basic_string_value_type>,
- pub bindgen_union_field: u8,
-}
-impl Default for basic_string___short {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
-#[repr(C)]
-#[derive(Copy, Clone)]
-pub struct basic_string___ulx {
- pub __lx: __BindgenUnionField<basic_string___long>,
- pub __lxx: __BindgenUnionField<basic_string___short>,
- pub bindgen_union_field: [u8; 0usize],
-}
-impl Default for basic_string___ulx {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
-pub const basic_string___n_words: basic_string__bindgen_ty_2 =
- basic_string__bindgen_ty_2::__n_words;
-#[repr(i32)]
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum basic_string__bindgen_ty_2 { __n_words = 0, }
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct basic_string___raw {
- pub __words: *mut basic_string_size_type,
-}
-impl Default for basic_string___raw {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
-#[repr(C)]
-#[derive(Copy, Clone)]
-pub struct basic_string___rep {
- pub __bindgen_anon_1: basic_string___rep__bindgen_ty_1,
-}
-#[repr(C)]
-#[derive(Copy, Clone)]
-pub struct basic_string___rep__bindgen_ty_1 {
- pub __l: __BindgenUnionField<basic_string___long>,
- pub __s: __BindgenUnionField<basic_string___short>,
- pub __r: __BindgenUnionField<basic_string___raw>,
- pub bindgen_union_field: [u8; 0usize],
-}
-impl Default for basic_string___rep__bindgen_ty_1 {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
-impl Default for basic_string___rep {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
diff --git a/tests/expectations/tests/jsval_layout_opaque.rs b/tests/expectations/tests/jsval_layout_opaque.rs
index 0e178800..980adbcf 100644
--- a/tests/expectations/tests/jsval_layout_opaque.rs
+++ b/tests/expectations/tests/jsval_layout_opaque.rs
@@ -4,6 +4,30 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
+#[repr(C)]
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
pub const JSVAL_TAG_SHIFT: ::std::os::raw::c_uint = 47;
pub const JSVAL_PAYLOAD_MASK: ::std::os::raw::c_ulonglong = 140737488355327;
pub const JSVAL_TAG_MASK: ::std::os::raw::c_longlong = -140737488355328;
@@ -72,15 +96,16 @@ pub enum JSWhyMagic {
JS_WHY_MAGIC_COUNT = 18,
}
#[repr(C)]
-#[derive(Copy)]
-pub union jsval_layout {
- pub asBits: u64,
- pub debugView: jsval_layout__bindgen_ty_1,
- pub s: jsval_layout__bindgen_ty_2,
- pub asDouble: f64,
- pub asPtr: *mut ::std::os::raw::c_void,
- pub asWord: usize,
- pub asUIntPtr: usize,
+#[derive(Debug, Default, Copy)]
+pub struct jsval_layout {
+ pub asBits: __BindgenUnionField<u64>,
+ pub debugView: __BindgenUnionField<jsval_layout__bindgen_ty_1>,
+ pub s: __BindgenUnionField<jsval_layout__bindgen_ty_2>,
+ pub asDouble: __BindgenUnionField<f64>,
+ pub asPtr: __BindgenUnionField<*mut ::std::os::raw::c_void>,
+ pub asWord: __BindgenUnionField<usize>,
+ pub asUIntPtr: __BindgenUnionField<usize>,
+ pub bindgen_union_field: u64,
}
#[repr(C)]
#[derive(Debug, Copy)]
@@ -189,16 +214,17 @@ impl jsval_layout__bindgen_ty_1 {
}
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Debug, Default, Copy)]
pub struct jsval_layout__bindgen_ty_2 {
pub payload: jsval_layout__bindgen_ty_2__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Copy)]
-pub union jsval_layout__bindgen_ty_2__bindgen_ty_1 {
- pub i32: i32,
- pub u32: u32,
- pub why: JSWhyMagic,
+#[derive(Debug, Default, Copy)]
+pub struct jsval_layout__bindgen_ty_2__bindgen_ty_1 {
+ pub i32: __BindgenUnionField<i32>,
+ pub u32: __BindgenUnionField<u32>,
+ pub why: __BindgenUnionField<JSWhyMagic>,
+ pub bindgen_union_field: u32,
}
#[test]
fn bindgen_test_layout_jsval_layout__bindgen_ty_2__bindgen_ty_1() {
@@ -235,9 +261,6 @@ fn bindgen_test_layout_jsval_layout__bindgen_ty_2__bindgen_ty_1() {
impl Clone for jsval_layout__bindgen_ty_2__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
-impl Default for jsval_layout__bindgen_ty_2__bindgen_ty_1 {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
#[test]
fn bindgen_test_layout_jsval_layout__bindgen_ty_2() {
assert_eq!(::std::mem::size_of::<jsval_layout__bindgen_ty_2>() , 4usize ,
@@ -257,9 +280,6 @@ fn bindgen_test_layout_jsval_layout__bindgen_ty_2() {
impl Clone for jsval_layout__bindgen_ty_2 {
fn clone(&self) -> Self { *self }
}
-impl Default for jsval_layout__bindgen_ty_2 {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
#[test]
fn bindgen_test_layout_jsval_layout() {
assert_eq!(::std::mem::size_of::<jsval_layout>() , 8usize , concat ! (
@@ -305,11 +325,8 @@ fn bindgen_test_layout_jsval_layout() {
impl Clone for jsval_layout {
fn clone(&self) -> Self { *self }
}
-impl Default for jsval_layout {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Debug, Default, Copy)]
pub struct Value {
pub data: jsval_layout,
}
@@ -328,6 +345,3 @@ fn bindgen_test_layout_Value() {
impl Clone for Value {
fn clone(&self) -> Self { *self }
}
-impl Default for Value {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
diff --git a/tests/expectations/tests/jsval_layout_opaque_1_0.rs b/tests/expectations/tests/jsval_layout_opaque_1_0.rs
deleted file mode 100644
index 980adbcf..00000000
--- a/tests/expectations/tests/jsval_layout_opaque_1_0.rs
+++ /dev/null
@@ -1,347 +0,0 @@
-/* automatically generated by rust-bindgen */
-
-
-#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-
-
-#[repr(C)]
-pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
-impl <T> __BindgenUnionField<T> {
- #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
- #[inline]
- fn default() -> Self { Self::new() }
-}
-impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
- #[inline]
- fn clone(&self) -> Self { Self::new() }
-}
-impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
-impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
- fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
- fmt.write_str("__BindgenUnionField")
- }
-}
-pub const JSVAL_TAG_SHIFT: ::std::os::raw::c_uint = 47;
-pub const JSVAL_PAYLOAD_MASK: ::std::os::raw::c_ulonglong = 140737488355327;
-pub const JSVAL_TAG_MASK: ::std::os::raw::c_longlong = -140737488355328;
-#[repr(u8)]
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum JSValueType {
- JSVAL_TYPE_DOUBLE = 0,
- JSVAL_TYPE_INT32 = 1,
- JSVAL_TYPE_UNDEFINED = 2,
- JSVAL_TYPE_BOOLEAN = 3,
- JSVAL_TYPE_MAGIC = 4,
- JSVAL_TYPE_STRING = 5,
- JSVAL_TYPE_SYMBOL = 6,
- JSVAL_TYPE_NULL = 7,
- JSVAL_TYPE_OBJECT = 8,
- JSVAL_TYPE_UNKNOWN = 32,
- JSVAL_TYPE_MISSING = 33,
-}
-#[repr(u32)]
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum JSValueTag {
- JSVAL_TAG_MAX_DOUBLE = 131056,
- JSVAL_TAG_INT32 = 131057,
- JSVAL_TAG_UNDEFINED = 131058,
- JSVAL_TAG_STRING = 131061,
- JSVAL_TAG_SYMBOL = 131062,
- JSVAL_TAG_BOOLEAN = 131059,
- JSVAL_TAG_MAGIC = 131060,
- JSVAL_TAG_NULL = 131063,
- JSVAL_TAG_OBJECT = 131064,
-}
-#[repr(u64)]
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum JSValueShiftedTag {
- JSVAL_SHIFTED_TAG_MAX_DOUBLE = 18444492278190833663,
- JSVAL_SHIFTED_TAG_INT32 = 18444633011384221696,
- JSVAL_SHIFTED_TAG_UNDEFINED = 18444773748872577024,
- JSVAL_SHIFTED_TAG_STRING = 18445195961337643008,
- JSVAL_SHIFTED_TAG_SYMBOL = 18445336698825998336,
- JSVAL_SHIFTED_TAG_BOOLEAN = 18444914486360932352,
- JSVAL_SHIFTED_TAG_MAGIC = 18445055223849287680,
- JSVAL_SHIFTED_TAG_NULL = 18445477436314353664,
- JSVAL_SHIFTED_TAG_OBJECT = 18445618173802708992,
-}
-#[repr(u32)]
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum JSWhyMagic {
- JS_ELEMENTS_HOLE = 0,
- JS_NO_ITER_VALUE = 1,
- JS_GENERATOR_CLOSING = 2,
- JS_NO_CONSTANT = 3,
- JS_THIS_POISON = 4,
- JS_ARG_POISON = 5,
- JS_SERIALIZE_NO_NODE = 6,
- JS_LAZY_ARGUMENTS = 7,
- JS_OPTIMIZED_ARGUMENTS = 8,
- JS_IS_CONSTRUCTING = 9,
- JS_OVERWRITTEN_CALLEE = 10,
- JS_BLOCK_NEEDS_CLONE = 11,
- JS_HASH_KEY_EMPTY = 12,
- JS_ION_ERROR = 13,
- JS_ION_BAILOUT = 14,
- JS_OPTIMIZED_OUT = 15,
- JS_UNINITIALIZED_LEXICAL = 16,
- JS_GENERIC_MAGIC = 17,
- JS_WHY_MAGIC_COUNT = 18,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct jsval_layout {
- pub asBits: __BindgenUnionField<u64>,
- pub debugView: __BindgenUnionField<jsval_layout__bindgen_ty_1>,
- pub s: __BindgenUnionField<jsval_layout__bindgen_ty_2>,
- pub asDouble: __BindgenUnionField<f64>,
- pub asPtr: __BindgenUnionField<*mut ::std::os::raw::c_void>,
- pub asWord: __BindgenUnionField<usize>,
- pub asUIntPtr: __BindgenUnionField<usize>,
- pub bindgen_union_field: u64,
-}
-#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct jsval_layout__bindgen_ty_1 {
- pub _bitfield_1: u64,
- pub __bindgen_align: [u64; 0usize],
-}
-#[test]
-fn bindgen_test_layout_jsval_layout__bindgen_ty_1() {
- assert_eq!(::std::mem::size_of::<jsval_layout__bindgen_ty_1>() , 8usize ,
- concat ! (
- "Size of: " , stringify ! ( jsval_layout__bindgen_ty_1 ) ));
- assert_eq! (::std::mem::align_of::<jsval_layout__bindgen_ty_1>() , 8usize
- , concat ! (
- "Alignment of " , stringify ! ( jsval_layout__bindgen_ty_1 )
- ));
-}
-impl Clone for jsval_layout__bindgen_ty_1 {
- fn clone(&self) -> Self { *self }
-}
-impl Default for jsval_layout__bindgen_ty_1 {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
-impl jsval_layout__bindgen_ty_1 {
- #[inline]
- pub fn payload47(&self) -> u64 {
- let mut unit_field_val: u64 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u64 as
- *mut u8,
- ::std::mem::size_of::<u64>())
- };
- let mask = 140737488355327u64 as u64;
- let val = (unit_field_val & mask) >> 0usize;
- unsafe { ::std::mem::transmute(val as u64) }
- }
- #[inline]
- pub fn set_payload47(&mut self, val: u64) {
- let mask = 140737488355327u64 as u64;
- let val = val as u64 as u64;
- let mut unit_field_val: u64 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u64 as
- *mut u8,
- ::std::mem::size_of::<u64>())
- };
- unit_field_val &= !mask;
- unit_field_val |= (val << 0usize) & mask;
- unsafe {
- ::std::ptr::copy_nonoverlapping(&unit_field_val as *const _ as
- *const u8,
- &mut self._bitfield_1 as *mut _ as
- *mut u8,
- ::std::mem::size_of::<u64>());
- }
- }
- #[inline]
- pub fn tag(&self) -> JSValueTag {
- let mut unit_field_val: u64 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u64 as
- *mut u8,
- ::std::mem::size_of::<u64>())
- };
- let mask = 18446603336221196288u64 as u64;
- let val = (unit_field_val & mask) >> 47usize;
- unsafe { ::std::mem::transmute(val as u32) }
- }
- #[inline]
- pub fn set_tag(&mut self, val: JSValueTag) {
- let mask = 18446603336221196288u64 as u64;
- let val = val as u32 as u64;
- let mut unit_field_val: u64 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u64 as
- *mut u8,
- ::std::mem::size_of::<u64>())
- };
- unit_field_val &= !mask;
- unit_field_val |= (val << 47usize) & mask;
- unsafe {
- ::std::ptr::copy_nonoverlapping(&unit_field_val as *const _ as
- *const u8,
- &mut self._bitfield_1 as *mut _ as
- *mut u8,
- ::std::mem::size_of::<u64>());
- }
- }
- #[inline]
- pub fn new_bitfield_1(payload47: u64, tag: JSValueTag) -> u64 {
- ({
- ({ 0 } |
- ((payload47 as u64 as u64) << 0usize) &
- (140737488355327u64 as u64))
- } |
- ((tag as u32 as u64) << 47usize) &
- (18446603336221196288u64 as u64))
- }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct jsval_layout__bindgen_ty_2 {
- pub payload: jsval_layout__bindgen_ty_2__bindgen_ty_1,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct jsval_layout__bindgen_ty_2__bindgen_ty_1 {
- pub i32: __BindgenUnionField<i32>,
- pub u32: __BindgenUnionField<u32>,
- pub why: __BindgenUnionField<JSWhyMagic>,
- pub bindgen_union_field: u32,
-}
-#[test]
-fn bindgen_test_layout_jsval_layout__bindgen_ty_2__bindgen_ty_1() {
- assert_eq!(::std::mem::size_of::<jsval_layout__bindgen_ty_2__bindgen_ty_1>()
- , 4usize , concat ! (
- "Size of: " , stringify ! (
- jsval_layout__bindgen_ty_2__bindgen_ty_1 ) ));
- assert_eq! (::std::mem::align_of::<jsval_layout__bindgen_ty_2__bindgen_ty_1>()
- , 4usize , concat ! (
- "Alignment of " , stringify ! (
- jsval_layout__bindgen_ty_2__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & (
- * ( 0 as * const jsval_layout__bindgen_ty_2__bindgen_ty_1 ) )
- . i32 as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- jsval_layout__bindgen_ty_2__bindgen_ty_1 ) , "::" , stringify
- ! ( i32 ) ));
- assert_eq! (unsafe {
- & (
- * ( 0 as * const jsval_layout__bindgen_ty_2__bindgen_ty_1 ) )
- . u32 as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- jsval_layout__bindgen_ty_2__bindgen_ty_1 ) , "::" , stringify
- ! ( u32 ) ));
- assert_eq! (unsafe {
- & (
- * ( 0 as * const jsval_layout__bindgen_ty_2__bindgen_ty_1 ) )
- . why as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- jsval_layout__bindgen_ty_2__bindgen_ty_1 ) , "::" , stringify
- ! ( why ) ));
-}
-impl Clone for jsval_layout__bindgen_ty_2__bindgen_ty_1 {
- fn clone(&self) -> Self { *self }
-}
-#[test]
-fn bindgen_test_layout_jsval_layout__bindgen_ty_2() {
- assert_eq!(::std::mem::size_of::<jsval_layout__bindgen_ty_2>() , 4usize ,
- concat ! (
- "Size of: " , stringify ! ( jsval_layout__bindgen_ty_2 ) ));
- assert_eq! (::std::mem::align_of::<jsval_layout__bindgen_ty_2>() , 4usize
- , concat ! (
- "Alignment of " , stringify ! ( jsval_layout__bindgen_ty_2 )
- ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const jsval_layout__bindgen_ty_2 ) ) . payload
- as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- jsval_layout__bindgen_ty_2 ) , "::" , stringify ! ( payload )
- ));
-}
-impl Clone for jsval_layout__bindgen_ty_2 {
- fn clone(&self) -> Self { *self }
-}
-#[test]
-fn bindgen_test_layout_jsval_layout() {
- assert_eq!(::std::mem::size_of::<jsval_layout>() , 8usize , concat ! (
- "Size of: " , stringify ! ( jsval_layout ) ));
- assert_eq! (::std::mem::align_of::<jsval_layout>() , 8usize , concat ! (
- "Alignment of " , stringify ! ( jsval_layout ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const jsval_layout ) ) . asBits as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( jsval_layout ) , "::" ,
- stringify ! ( asBits ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const jsval_layout ) ) . debugView as * const _
- as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( jsval_layout ) , "::" ,
- stringify ! ( debugView ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const jsval_layout ) ) . s as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( jsval_layout ) , "::" ,
- stringify ! ( s ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const jsval_layout ) ) . asDouble as * const _
- as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( jsval_layout ) , "::" ,
- stringify ! ( asDouble ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const jsval_layout ) ) . asPtr as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( jsval_layout ) , "::" ,
- stringify ! ( asPtr ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const jsval_layout ) ) . asWord as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( jsval_layout ) , "::" ,
- stringify ! ( asWord ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const jsval_layout ) ) . asUIntPtr as * const _
- as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( jsval_layout ) , "::" ,
- stringify ! ( asUIntPtr ) ));
-}
-impl Clone for jsval_layout {
- fn clone(&self) -> Self { *self }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct Value {
- pub data: jsval_layout,
-}
-#[test]
-fn bindgen_test_layout_Value() {
- assert_eq!(::std::mem::size_of::<Value>() , 8usize , concat ! (
- "Size of: " , stringify ! ( Value ) ));
- assert_eq! (::std::mem::align_of::<Value>() , 8usize , concat ! (
- "Alignment of " , stringify ! ( Value ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const Value ) ) . data as * const _ as usize }
- , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( Value ) , "::" ,
- stringify ! ( data ) ));
-}
-impl Clone for Value {
- fn clone(&self) -> Self { *self }
-}
diff --git a/tests/expectations/tests/layout_eth_conf.rs b/tests/expectations/tests/layout_eth_conf.rs
index 43a93611..a51e40bc 100644
--- a/tests/expectations/tests/layout_eth_conf.rs
+++ b/tests/expectations/tests/layout_eth_conf.rs
@@ -4,6 +4,30 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
+#[repr(C)]
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
pub const ETH_MQ_RX_RSS_FLAG: ::std::os::raw::c_uint = 1;
pub const ETH_MQ_RX_DCB_FLAG: ::std::os::raw::c_uint = 2;
pub const ETH_MQ_RX_VMDQ_FLAG: ::std::os::raw::c_uint = 4;
@@ -1524,11 +1548,12 @@ impl Default for rte_eth_conf__bindgen_ty_1 {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Copy)]
-pub union rte_eth_conf__bindgen_ty_2 {
- pub vmdq_dcb_tx_conf: rte_eth_vmdq_dcb_tx_conf,
- pub dcb_tx_conf: rte_eth_dcb_tx_conf,
- pub vmdq_tx_conf: rte_eth_vmdq_tx_conf,
+#[derive(Debug, Default, Copy)]
+pub struct rte_eth_conf__bindgen_ty_2 {
+ pub vmdq_dcb_tx_conf: __BindgenUnionField<rte_eth_vmdq_dcb_tx_conf>,
+ pub dcb_tx_conf: __BindgenUnionField<rte_eth_dcb_tx_conf>,
+ pub vmdq_tx_conf: __BindgenUnionField<rte_eth_vmdq_tx_conf>,
+ pub bindgen_union_field: [u32; 3usize],
}
#[test]
fn bindgen_test_layout_rte_eth_conf__bindgen_ty_2() {
@@ -1561,9 +1586,6 @@ fn bindgen_test_layout_rte_eth_conf__bindgen_ty_2() {
impl Clone for rte_eth_conf__bindgen_ty_2 {
fn clone(&self) -> Self { *self }
}
-impl Default for rte_eth_conf__bindgen_ty_2 {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
#[test]
fn bindgen_test_layout_rte_eth_conf() {
assert_eq!(::std::mem::size_of::<rte_eth_conf>() , 2944usize , concat ! (
diff --git a/tests/expectations/tests/layout_eth_conf_1_0.rs b/tests/expectations/tests/layout_eth_conf_1_0.rs
deleted file mode 100644
index a51e40bc..00000000
--- a/tests/expectations/tests/layout_eth_conf_1_0.rs
+++ /dev/null
@@ -1,1646 +0,0 @@
-/* automatically generated by rust-bindgen */
-
-
-#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-
-
-#[repr(C)]
-pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
-impl <T> __BindgenUnionField<T> {
- #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
- #[inline]
- fn default() -> Self { Self::new() }
-}
-impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
- #[inline]
- fn clone(&self) -> Self { Self::new() }
-}
-impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
-impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
- fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
- fmt.write_str("__BindgenUnionField")
- }
-}
-pub const ETH_MQ_RX_RSS_FLAG: ::std::os::raw::c_uint = 1;
-pub const ETH_MQ_RX_DCB_FLAG: ::std::os::raw::c_uint = 2;
-pub const ETH_MQ_RX_VMDQ_FLAG: ::std::os::raw::c_uint = 4;
-pub const ETH_VMDQ_MAX_VLAN_FILTERS: ::std::os::raw::c_uint = 64;
-pub const ETH_DCB_NUM_USER_PRIORITIES: ::std::os::raw::c_uint = 8;
-pub const ETH_VMDQ_DCB_NUM_QUEUES: ::std::os::raw::c_uint = 128;
-pub const ETH_DCB_NUM_QUEUES: ::std::os::raw::c_uint = 128;
-pub const RTE_ETH_FDIR_MAX_FLEXLEN: ::std::os::raw::c_uint = 16;
-pub const RTE_ETH_INSET_SIZE_MAX: ::std::os::raw::c_uint = 128;
-pub const RTE_ETH_FLOW_UNKNOWN: ::std::os::raw::c_uint = 0;
-pub const RTE_ETH_FLOW_RAW: ::std::os::raw::c_uint = 1;
-pub const RTE_ETH_FLOW_IPV4: ::std::os::raw::c_uint = 2;
-pub const RTE_ETH_FLOW_FRAG_IPV4: ::std::os::raw::c_uint = 3;
-pub const RTE_ETH_FLOW_NONFRAG_IPV4_TCP: ::std::os::raw::c_uint = 4;
-pub const RTE_ETH_FLOW_NONFRAG_IPV4_UDP: ::std::os::raw::c_uint = 5;
-pub const RTE_ETH_FLOW_NONFRAG_IPV4_SCTP: ::std::os::raw::c_uint = 6;
-pub const RTE_ETH_FLOW_NONFRAG_IPV4_OTHER: ::std::os::raw::c_uint = 7;
-pub const RTE_ETH_FLOW_IPV6: ::std::os::raw::c_uint = 8;
-pub const RTE_ETH_FLOW_FRAG_IPV6: ::std::os::raw::c_uint = 9;
-pub const RTE_ETH_FLOW_NONFRAG_IPV6_TCP: ::std::os::raw::c_uint = 10;
-pub const RTE_ETH_FLOW_NONFRAG_IPV6_UDP: ::std::os::raw::c_uint = 11;
-pub const RTE_ETH_FLOW_NONFRAG_IPV6_SCTP: ::std::os::raw::c_uint = 12;
-pub const RTE_ETH_FLOW_NONFRAG_IPV6_OTHER: ::std::os::raw::c_uint = 13;
-pub const RTE_ETH_FLOW_L2_PAYLOAD: ::std::os::raw::c_uint = 14;
-pub const RTE_ETH_FLOW_IPV6_EX: ::std::os::raw::c_uint = 15;
-pub const RTE_ETH_FLOW_IPV6_TCP_EX: ::std::os::raw::c_uint = 16;
-pub const RTE_ETH_FLOW_IPV6_UDP_EX: ::std::os::raw::c_uint = 17;
-pub const RTE_ETH_FLOW_PORT: ::std::os::raw::c_uint = 18;
-pub const RTE_ETH_FLOW_VXLAN: ::std::os::raw::c_uint = 19;
-pub const RTE_ETH_FLOW_GENEVE: ::std::os::raw::c_uint = 20;
-pub const RTE_ETH_FLOW_NVGRE: ::std::os::raw::c_uint = 21;
-pub const RTE_ETH_FLOW_MAX: ::std::os::raw::c_uint = 22;
-#[repr(u32)]
-/// A set of values to identify what method is to be used to route
-/// packets to multiple queues.
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum rte_eth_rx_mq_mode {
- ETH_MQ_RX_NONE = 0,
- ETH_MQ_RX_RSS = 1,
- ETH_MQ_RX_DCB = 2,
- ETH_MQ_RX_DCB_RSS = 3,
- ETH_MQ_RX_VMDQ_ONLY = 4,
- ETH_MQ_RX_VMDQ_RSS = 5,
- ETH_MQ_RX_VMDQ_DCB = 6,
- ETH_MQ_RX_VMDQ_DCB_RSS = 7,
-}
-/// A structure used to configure the RX features of an Ethernet port.
-#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct rte_eth_rxmode {
- /// The multi-queue packet distribution mode to be used, e.g. RSS.
- pub mq_mode: rte_eth_rx_mq_mode,
- /// < Only used if jumbo_frame enabled.
- pub max_rx_pkt_len: u32,
- /// < hdr buf size (header_split enabled).
- pub split_hdr_size: u16,
- pub _bitfield_1: [u8; 2usize],
-}
-#[test]
-fn bindgen_test_layout_rte_eth_rxmode() {
- assert_eq!(::std::mem::size_of::<rte_eth_rxmode>() , 12usize , concat ! (
- "Size of: " , stringify ! ( rte_eth_rxmode ) ));
- assert_eq! (::std::mem::align_of::<rte_eth_rxmode>() , 4usize , concat ! (
- "Alignment of " , stringify ! ( rte_eth_rxmode ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_rxmode ) ) . mq_mode as * const _
- as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_rxmode ) , "::"
- , stringify ! ( mq_mode ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_rxmode ) ) . max_rx_pkt_len as *
- const _ as usize } , 4usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_rxmode ) , "::"
- , stringify ! ( max_rx_pkt_len ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_rxmode ) ) . split_hdr_size as *
- const _ as usize } , 8usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_rxmode ) , "::"
- , stringify ! ( split_hdr_size ) ));
-}
-impl Clone for rte_eth_rxmode {
- fn clone(&self) -> Self { *self }
-}
-impl Default for rte_eth_rxmode {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
-impl rte_eth_rxmode {
- #[inline]
- pub fn header_split(&self) -> u16 {
- let mut unit_field_val: u16 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u16 as
- *mut u8,
- ::std::mem::size_of::<u16>())
- };
- let mask = 1u64 as u16;
- let val = (unit_field_val & mask) >> 0usize;
- unsafe { ::std::mem::transmute(val as u16) }
- }
- #[inline]
- pub fn set_header_split(&mut self, val: u16) {
- let mask = 1u64 as u16;
- let val = val as u16 as u16;
- let mut unit_field_val: u16 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u16 as
- *mut u8,
- ::std::mem::size_of::<u16>())
- };
- unit_field_val &= !mask;
- unit_field_val |= (val << 0usize) & mask;
- unsafe {
- ::std::ptr::copy_nonoverlapping(&unit_field_val as *const _ as
- *const u8,
- &mut self._bitfield_1 as *mut _ as
- *mut u8,
- ::std::mem::size_of::<u16>());
- }
- }
- #[inline]
- pub fn hw_ip_checksum(&self) -> u16 {
- let mut unit_field_val: u16 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u16 as
- *mut u8,
- ::std::mem::size_of::<u16>())
- };
- let mask = 2u64 as u16;
- let val = (unit_field_val & mask) >> 1usize;
- unsafe { ::std::mem::transmute(val as u16) }
- }
- #[inline]
- pub fn set_hw_ip_checksum(&mut self, val: u16) {
- let mask = 2u64 as u16;
- let val = val as u16 as u16;
- let mut unit_field_val: u16 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u16 as
- *mut u8,
- ::std::mem::size_of::<u16>())
- };
- unit_field_val &= !mask;
- unit_field_val |= (val << 1usize) & mask;
- unsafe {
- ::std::ptr::copy_nonoverlapping(&unit_field_val as *const _ as
- *const u8,
- &mut self._bitfield_1 as *mut _ as
- *mut u8,
- ::std::mem::size_of::<u16>());
- }
- }
- #[inline]
- pub fn hw_vlan_filter(&self) -> u16 {
- let mut unit_field_val: u16 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u16 as
- *mut u8,
- ::std::mem::size_of::<u16>())
- };
- let mask = 4u64 as u16;
- let val = (unit_field_val & mask) >> 2usize;
- unsafe { ::std::mem::transmute(val as u16) }
- }
- #[inline]
- pub fn set_hw_vlan_filter(&mut self, val: u16) {
- let mask = 4u64 as u16;
- let val = val as u16 as u16;
- let mut unit_field_val: u16 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u16 as
- *mut u8,
- ::std::mem::size_of::<u16>())
- };
- unit_field_val &= !mask;
- unit_field_val |= (val << 2usize) & mask;
- unsafe {
- ::std::ptr::copy_nonoverlapping(&unit_field_val as *const _ as
- *const u8,
- &mut self._bitfield_1 as *mut _ as
- *mut u8,
- ::std::mem::size_of::<u16>());
- }
- }
- #[inline]
- pub fn hw_vlan_strip(&self) -> u16 {
- let mut unit_field_val: u16 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u16 as
- *mut u8,
- ::std::mem::size_of::<u16>())
- };
- let mask = 8u64 as u16;
- let val = (unit_field_val & mask) >> 3usize;
- unsafe { ::std::mem::transmute(val as u16) }
- }
- #[inline]
- pub fn set_hw_vlan_strip(&mut self, val: u16) {
- let mask = 8u64 as u16;
- let val = val as u16 as u16;
- let mut unit_field_val: u16 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u16 as
- *mut u8,
- ::std::mem::size_of::<u16>())
- };
- unit_field_val &= !mask;
- unit_field_val |= (val << 3usize) & mask;
- unsafe {
- ::std::ptr::copy_nonoverlapping(&unit_field_val as *const _ as
- *const u8,
- &mut self._bitfield_1 as *mut _ as
- *mut u8,
- ::std::mem::size_of::<u16>());
- }
- }
- #[inline]
- pub fn hw_vlan_extend(&self) -> u16 {
- let mut unit_field_val: u16 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u16 as
- *mut u8,
- ::std::mem::size_of::<u16>())
- };
- let mask = 16u64 as u16;
- let val = (unit_field_val & mask) >> 4usize;
- unsafe { ::std::mem::transmute(val as u16) }
- }
- #[inline]
- pub fn set_hw_vlan_extend(&mut self, val: u16) {
- let mask = 16u64 as u16;
- let val = val as u16 as u16;
- let mut unit_field_val: u16 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u16 as
- *mut u8,
- ::std::mem::size_of::<u16>())
- };
- unit_field_val &= !mask;
- unit_field_val |= (val << 4usize) & mask;
- unsafe {
- ::std::ptr::copy_nonoverlapping(&unit_field_val as *const _ as
- *const u8,
- &mut self._bitfield_1 as *mut _ as
- *mut u8,
- ::std::mem::size_of::<u16>());
- }
- }
- #[inline]
- pub fn jumbo_frame(&self) -> u16 {
- let mut unit_field_val: u16 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u16 as
- *mut u8,
- ::std::mem::size_of::<u16>())
- };
- let mask = 32u64 as u16;
- let val = (unit_field_val & mask) >> 5usize;
- unsafe { ::std::mem::transmute(val as u16) }
- }
- #[inline]
- pub fn set_jumbo_frame(&mut self, val: u16) {
- let mask = 32u64 as u16;
- let val = val as u16 as u16;
- let mut unit_field_val: u16 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u16 as
- *mut u8,
- ::std::mem::size_of::<u16>())
- };
- unit_field_val &= !mask;
- unit_field_val |= (val << 5usize) & mask;
- unsafe {
- ::std::ptr::copy_nonoverlapping(&unit_field_val as *const _ as
- *const u8,
- &mut self._bitfield_1 as *mut _ as
- *mut u8,
- ::std::mem::size_of::<u16>());
- }
- }
- #[inline]
- pub fn hw_strip_crc(&self) -> u16 {
- let mut unit_field_val: u16 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u16 as
- *mut u8,
- ::std::mem::size_of::<u16>())
- };
- let mask = 64u64 as u16;
- let val = (unit_field_val & mask) >> 6usize;
- unsafe { ::std::mem::transmute(val as u16) }
- }
- #[inline]
- pub fn set_hw_strip_crc(&mut self, val: u16) {
- let mask = 64u64 as u16;
- let val = val as u16 as u16;
- let mut unit_field_val: u16 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u16 as
- *mut u8,
- ::std::mem::size_of::<u16>())
- };
- unit_field_val &= !mask;
- unit_field_val |= (val << 6usize) & mask;
- unsafe {
- ::std::ptr::copy_nonoverlapping(&unit_field_val as *const _ as
- *const u8,
- &mut self._bitfield_1 as *mut _ as
- *mut u8,
- ::std::mem::size_of::<u16>());
- }
- }
- #[inline]
- pub fn enable_scatter(&self) -> u16 {
- let mut unit_field_val: u16 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u16 as
- *mut u8,
- ::std::mem::size_of::<u16>())
- };
- let mask = 128u64 as u16;
- let val = (unit_field_val & mask) >> 7usize;
- unsafe { ::std::mem::transmute(val as u16) }
- }
- #[inline]
- pub fn set_enable_scatter(&mut self, val: u16) {
- let mask = 128u64 as u16;
- let val = val as u16 as u16;
- let mut unit_field_val: u16 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u16 as
- *mut u8,
- ::std::mem::size_of::<u16>())
- };
- unit_field_val &= !mask;
- unit_field_val |= (val << 7usize) & mask;
- unsafe {
- ::std::ptr::copy_nonoverlapping(&unit_field_val as *const _ as
- *const u8,
- &mut self._bitfield_1 as *mut _ as
- *mut u8,
- ::std::mem::size_of::<u16>());
- }
- }
- #[inline]
- pub fn enable_lro(&self) -> u16 {
- let mut unit_field_val: u16 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u16 as
- *mut u8,
- ::std::mem::size_of::<u16>())
- };
- let mask = 256u64 as u16;
- let val = (unit_field_val & mask) >> 8usize;
- unsafe { ::std::mem::transmute(val as u16) }
- }
- #[inline]
- pub fn set_enable_lro(&mut self, val: u16) {
- let mask = 256u64 as u16;
- let val = val as u16 as u16;
- let mut unit_field_val: u16 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u16 as
- *mut u8,
- ::std::mem::size_of::<u16>())
- };
- unit_field_val &= !mask;
- unit_field_val |= (val << 8usize) & mask;
- unsafe {
- ::std::ptr::copy_nonoverlapping(&unit_field_val as *const _ as
- *const u8,
- &mut self._bitfield_1 as *mut _ as
- *mut u8,
- ::std::mem::size_of::<u16>());
- }
- }
- #[inline]
- pub fn new_bitfield_1(header_split: u16, hw_ip_checksum: u16,
- hw_vlan_filter: u16, hw_vlan_strip: u16,
- hw_vlan_extend: u16, jumbo_frame: u16,
- hw_strip_crc: u16, enable_scatter: u16,
- enable_lro: u16) -> u16 {
- ({
- ({
- ({
- ({
- ({
- ({
- ({
- ({
- ({ 0 } |
- ((header_split as u16 as
- u16) << 0usize) &
- (1u64 as u16))
- } |
- ((hw_ip_checksum as u16 as
- u16) << 1usize) &
- (2u64 as u16))
- } |
- ((hw_vlan_filter as u16 as u16) <<
- 2usize) & (4u64 as u16))
- } |
- ((hw_vlan_strip as u16 as u16) <<
- 3usize) & (8u64 as u16))
- } |
- ((hw_vlan_extend as u16 as u16) << 4usize) &
- (16u64 as u16))
- } |
- ((jumbo_frame as u16 as u16) << 5usize) &
- (32u64 as u16))
- } |
- ((hw_strip_crc as u16 as u16) << 6usize) &
- (64u64 as u16))
- } |
- ((enable_scatter as u16 as u16) << 7usize) &
- (128u64 as u16))
- } | ((enable_lro as u16 as u16) << 8usize) & (256u64 as u16))
- }
-}
-#[repr(u32)]
-/// A set of values to identify what method is to be used to transmit
-/// packets using multi-TCs.
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum rte_eth_tx_mq_mode {
- ETH_MQ_TX_NONE = 0,
- ETH_MQ_TX_DCB = 1,
- ETH_MQ_TX_VMDQ_DCB = 2,
- ETH_MQ_TX_VMDQ_ONLY = 3,
-}
-/// A structure used to configure the TX features of an Ethernet port.
-#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct rte_eth_txmode {
- /// < TX multi-queues mode.
- pub mq_mode: rte_eth_tx_mq_mode,
- pub pvid: u16,
- pub _bitfield_1: u8,
- pub __bindgen_padding_0: u8,
-}
-#[test]
-fn bindgen_test_layout_rte_eth_txmode() {
- assert_eq!(::std::mem::size_of::<rte_eth_txmode>() , 8usize , concat ! (
- "Size of: " , stringify ! ( rte_eth_txmode ) ));
- assert_eq! (::std::mem::align_of::<rte_eth_txmode>() , 4usize , concat ! (
- "Alignment of " , stringify ! ( rte_eth_txmode ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_txmode ) ) . mq_mode as * const _
- as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_txmode ) , "::"
- , stringify ! ( mq_mode ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_txmode ) ) . pvid as * const _ as
- usize } , 4usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_txmode ) , "::"
- , stringify ! ( pvid ) ));
-}
-impl Clone for rte_eth_txmode {
- fn clone(&self) -> Self { *self }
-}
-impl Default for rte_eth_txmode {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
-impl rte_eth_txmode {
- #[inline]
- pub fn hw_vlan_reject_tagged(&self) -> u8 {
- let mut unit_field_val: u8 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u8 as
- *mut u8,
- ::std::mem::size_of::<u8>())
- };
- let mask = 1u64 as u8;
- let val = (unit_field_val & mask) >> 0usize;
- unsafe { ::std::mem::transmute(val as u8) }
- }
- #[inline]
- pub fn set_hw_vlan_reject_tagged(&mut self, val: u8) {
- let mask = 1u64 as u8;
- let val = val as u8 as u8;
- let mut unit_field_val: u8 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u8 as
- *mut u8,
- ::std::mem::size_of::<u8>())
- };
- unit_field_val &= !mask;
- unit_field_val |= (val << 0usize) & mask;
- unsafe {
- ::std::ptr::copy_nonoverlapping(&unit_field_val as *const _ as
- *const u8,
- &mut self._bitfield_1 as *mut _ as
- *mut u8,
- ::std::mem::size_of::<u8>());
- }
- }
- #[inline]
- pub fn hw_vlan_reject_untagged(&self) -> u8 {
- let mut unit_field_val: u8 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u8 as
- *mut u8,
- ::std::mem::size_of::<u8>())
- };
- let mask = 2u64 as u8;
- let val = (unit_field_val & mask) >> 1usize;
- unsafe { ::std::mem::transmute(val as u8) }
- }
- #[inline]
- pub fn set_hw_vlan_reject_untagged(&mut self, val: u8) {
- let mask = 2u64 as u8;
- let val = val as u8 as u8;
- let mut unit_field_val: u8 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u8 as
- *mut u8,
- ::std::mem::size_of::<u8>())
- };
- unit_field_val &= !mask;
- unit_field_val |= (val << 1usize) & mask;
- unsafe {
- ::std::ptr::copy_nonoverlapping(&unit_field_val as *const _ as
- *const u8,
- &mut self._bitfield_1 as *mut _ as
- *mut u8,
- ::std::mem::size_of::<u8>());
- }
- }
- #[inline]
- pub fn hw_vlan_insert_pvid(&self) -> u8 {
- let mut unit_field_val: u8 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u8 as
- *mut u8,
- ::std::mem::size_of::<u8>())
- };
- let mask = 4u64 as u8;
- let val = (unit_field_val & mask) >> 2usize;
- unsafe { ::std::mem::transmute(val as u8) }
- }
- #[inline]
- pub fn set_hw_vlan_insert_pvid(&mut self, val: u8) {
- let mask = 4u64 as u8;
- let val = val as u8 as u8;
- let mut unit_field_val: u8 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u8 as
- *mut u8,
- ::std::mem::size_of::<u8>())
- };
- unit_field_val &= !mask;
- unit_field_val |= (val << 2usize) & mask;
- unsafe {
- ::std::ptr::copy_nonoverlapping(&unit_field_val as *const _ as
- *const u8,
- &mut self._bitfield_1 as *mut _ as
- *mut u8,
- ::std::mem::size_of::<u8>());
- }
- }
- #[inline]
- pub fn new_bitfield_1(hw_vlan_reject_tagged: u8,
- hw_vlan_reject_untagged: u8,
- hw_vlan_insert_pvid: u8) -> u8 {
- ({
- ({
- ({ 0 } |
- ((hw_vlan_reject_tagged as u8 as u8) << 0usize) &
- (1u64 as u8))
- } |
- ((hw_vlan_reject_untagged as u8 as u8) << 1usize) &
- (2u64 as u8))
- } | ((hw_vlan_insert_pvid as u8 as u8) << 2usize) & (4u64 as u8))
- }
-}
-/// A structure used to configure the Receive Side Scaling (RSS) feature
-/// of an Ethernet port.
-/// If not NULL, the *rss_key* pointer of the *rss_conf* structure points
-/// to an array holding the RSS key to use for hashing specific header
-/// fields of received packets. The length of this array should be indicated
-/// by *rss_key_len* below. Otherwise, a default random hash key is used by
-/// the device driver.
-///
-/// The *rss_key_len* field of the *rss_conf* structure indicates the length
-/// in bytes of the array pointed by *rss_key*. To be compatible, this length
-/// will be checked in i40e only. Others assume 40 bytes to be used as before.
-///
-/// The *rss_hf* field of the *rss_conf* structure indicates the different
-/// types of IPv4/IPv6 packets to which the RSS hashing must be applied.
-/// Supplying an *rss_hf* equal to zero disables the RSS feature.
-#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct rte_eth_rss_conf {
- /// < If not NULL, 40-byte hash key.
- pub rss_key: *mut u8,
- /// < hash key length in bytes.
- pub rss_key_len: u8,
- /// < Hash functions to apply - see below.
- pub rss_hf: u64,
-}
-#[test]
-fn bindgen_test_layout_rte_eth_rss_conf() {
- assert_eq!(::std::mem::size_of::<rte_eth_rss_conf>() , 24usize , concat !
- ( "Size of: " , stringify ! ( rte_eth_rss_conf ) ));
- assert_eq! (::std::mem::align_of::<rte_eth_rss_conf>() , 8usize , concat !
- ( "Alignment of " , stringify ! ( rte_eth_rss_conf ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_rss_conf ) ) . rss_key as * const
- _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_rss_conf ) ,
- "::" , stringify ! ( rss_key ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_rss_conf ) ) . rss_key_len as *
- const _ as usize } , 8usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_rss_conf ) ,
- "::" , stringify ! ( rss_key_len ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_rss_conf ) ) . rss_hf as * const
- _ as usize } , 16usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_rss_conf ) ,
- "::" , stringify ! ( rss_hf ) ));
-}
-impl Clone for rte_eth_rss_conf {
- fn clone(&self) -> Self { *self }
-}
-impl Default for rte_eth_rss_conf {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
-#[repr(u32)]
-/// This enum indicates the possible number of traffic classes
-/// in DCB configratioins
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum rte_eth_nb_tcs { ETH_4_TCS = 4, ETH_8_TCS = 8, }
-#[repr(u32)]
-/// This enum indicates the possible number of queue pools
-/// in VMDQ configurations.
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum rte_eth_nb_pools {
- ETH_8_POOLS = 8,
- ETH_16_POOLS = 16,
- ETH_32_POOLS = 32,
- ETH_64_POOLS = 64,
-}
-/// A structure used to configure the VMDQ+DCB feature
-/// of an Ethernet port.
-///
-/// Using this feature, packets are routed to a pool of queues, based
-/// on the vlan id in the vlan tag, and then to a specific queue within
-/// that pool, using the user priority vlan tag field.
-///
-/// A default pool may be used, if desired, to route all traffic which
-/// does not match the vlan filter rules.
-#[repr(C)]
-#[derive(Copy)]
-pub struct rte_eth_vmdq_dcb_conf {
- /// < With DCB, 16 or 32 pools
- pub nb_queue_pools: rte_eth_nb_pools,
- /// < If non-zero, use a default pool
- pub enable_default_pool: u8,
- /// < The default pool, if applicable
- pub default_pool: u8,
- /// < We can have up to 64 filters/mappings
- pub nb_pool_maps: u8,
- /// < VMDq vlan pool maps.
- pub pool_map: [rte_eth_vmdq_dcb_conf__bindgen_ty_1; 64usize],
- pub dcb_tc: [u8; 8usize],
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct rte_eth_vmdq_dcb_conf__bindgen_ty_1 {
- /// < The vlan id of the received frame
- pub vlan_id: u16,
- /// < Bitmask of pools for packet rx
- pub pools: u64,
-}
-#[test]
-fn bindgen_test_layout_rte_eth_vmdq_dcb_conf__bindgen_ty_1() {
- assert_eq!(::std::mem::size_of::<rte_eth_vmdq_dcb_conf__bindgen_ty_1>() ,
- 16usize , concat ! (
- "Size of: " , stringify ! ( rte_eth_vmdq_dcb_conf__bindgen_ty_1
- ) ));
- assert_eq! (::std::mem::align_of::<rte_eth_vmdq_dcb_conf__bindgen_ty_1>()
- , 8usize , concat ! (
- "Alignment of " , stringify ! (
- rte_eth_vmdq_dcb_conf__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_vmdq_dcb_conf__bindgen_ty_1 ) ) .
- vlan_id as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- rte_eth_vmdq_dcb_conf__bindgen_ty_1 ) , "::" , stringify ! (
- vlan_id ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_vmdq_dcb_conf__bindgen_ty_1 ) ) .
- pools as * const _ as usize } , 8usize , concat ! (
- "Alignment of field: " , stringify ! (
- rte_eth_vmdq_dcb_conf__bindgen_ty_1 ) , "::" , stringify ! (
- pools ) ));
-}
-impl Clone for rte_eth_vmdq_dcb_conf__bindgen_ty_1 {
- fn clone(&self) -> Self { *self }
-}
-#[test]
-fn bindgen_test_layout_rte_eth_vmdq_dcb_conf() {
- assert_eq!(::std::mem::size_of::<rte_eth_vmdq_dcb_conf>() , 1040usize ,
- concat ! ( "Size of: " , stringify ! ( rte_eth_vmdq_dcb_conf )
- ));
- assert_eq! (::std::mem::align_of::<rte_eth_vmdq_dcb_conf>() , 8usize ,
- concat ! (
- "Alignment of " , stringify ! ( rte_eth_vmdq_dcb_conf ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_vmdq_dcb_conf ) ) .
- nb_queue_pools as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_vmdq_dcb_conf )
- , "::" , stringify ! ( nb_queue_pools ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_vmdq_dcb_conf ) ) .
- enable_default_pool as * const _ as usize } , 4usize , concat
- ! (
- "Alignment of field: " , stringify ! ( rte_eth_vmdq_dcb_conf )
- , "::" , stringify ! ( enable_default_pool ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_vmdq_dcb_conf ) ) . default_pool
- as * const _ as usize } , 5usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_vmdq_dcb_conf )
- , "::" , stringify ! ( default_pool ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_vmdq_dcb_conf ) ) . nb_pool_maps
- as * const _ as usize } , 6usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_vmdq_dcb_conf )
- , "::" , stringify ! ( nb_pool_maps ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_vmdq_dcb_conf ) ) . pool_map as *
- const _ as usize } , 8usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_vmdq_dcb_conf )
- , "::" , stringify ! ( pool_map ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_vmdq_dcb_conf ) ) . dcb_tc as *
- const _ as usize } , 1032usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_vmdq_dcb_conf )
- , "::" , stringify ! ( dcb_tc ) ));
-}
-impl Clone for rte_eth_vmdq_dcb_conf {
- fn clone(&self) -> Self { *self }
-}
-impl Default for rte_eth_vmdq_dcb_conf {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
-#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct rte_eth_dcb_rx_conf {
- /// < Possible DCB TCs, 4 or 8 TCs
- pub nb_tcs: rte_eth_nb_tcs,
- /// Traffic class each UP mapped to.
- pub dcb_tc: [u8; 8usize],
-}
-#[test]
-fn bindgen_test_layout_rte_eth_dcb_rx_conf() {
- assert_eq!(::std::mem::size_of::<rte_eth_dcb_rx_conf>() , 12usize , concat
- ! ( "Size of: " , stringify ! ( rte_eth_dcb_rx_conf ) ));
- assert_eq! (::std::mem::align_of::<rte_eth_dcb_rx_conf>() , 4usize ,
- concat ! (
- "Alignment of " , stringify ! ( rte_eth_dcb_rx_conf ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_dcb_rx_conf ) ) . nb_tcs as *
- const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_dcb_rx_conf ) ,
- "::" , stringify ! ( nb_tcs ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_dcb_rx_conf ) ) . dcb_tc as *
- const _ as usize } , 4usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_dcb_rx_conf ) ,
- "::" , stringify ! ( dcb_tc ) ));
-}
-impl Clone for rte_eth_dcb_rx_conf {
- fn clone(&self) -> Self { *self }
-}
-impl Default for rte_eth_dcb_rx_conf {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
-#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct rte_eth_vmdq_dcb_tx_conf {
- /// < With DCB, 16 or 32 pools.
- pub nb_queue_pools: rte_eth_nb_pools,
- /// Traffic class each UP mapped to.
- pub dcb_tc: [u8; 8usize],
-}
-#[test]
-fn bindgen_test_layout_rte_eth_vmdq_dcb_tx_conf() {
- assert_eq!(::std::mem::size_of::<rte_eth_vmdq_dcb_tx_conf>() , 12usize ,
- concat ! (
- "Size of: " , stringify ! ( rte_eth_vmdq_dcb_tx_conf ) ));
- assert_eq! (::std::mem::align_of::<rte_eth_vmdq_dcb_tx_conf>() , 4usize ,
- concat ! (
- "Alignment of " , stringify ! ( rte_eth_vmdq_dcb_tx_conf ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_vmdq_dcb_tx_conf ) ) .
- nb_queue_pools as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- rte_eth_vmdq_dcb_tx_conf ) , "::" , stringify ! (
- nb_queue_pools ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_vmdq_dcb_tx_conf ) ) . dcb_tc as
- * const _ as usize } , 4usize , concat ! (
- "Alignment of field: " , stringify ! (
- rte_eth_vmdq_dcb_tx_conf ) , "::" , stringify ! ( dcb_tc ) ));
-}
-impl Clone for rte_eth_vmdq_dcb_tx_conf {
- fn clone(&self) -> Self { *self }
-}
-impl Default for rte_eth_vmdq_dcb_tx_conf {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
-#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct rte_eth_dcb_tx_conf {
- /// < Possible DCB TCs, 4 or 8 TCs.
- pub nb_tcs: rte_eth_nb_tcs,
- /// Traffic class each UP mapped to.
- pub dcb_tc: [u8; 8usize],
-}
-#[test]
-fn bindgen_test_layout_rte_eth_dcb_tx_conf() {
- assert_eq!(::std::mem::size_of::<rte_eth_dcb_tx_conf>() , 12usize , concat
- ! ( "Size of: " , stringify ! ( rte_eth_dcb_tx_conf ) ));
- assert_eq! (::std::mem::align_of::<rte_eth_dcb_tx_conf>() , 4usize ,
- concat ! (
- "Alignment of " , stringify ! ( rte_eth_dcb_tx_conf ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_dcb_tx_conf ) ) . nb_tcs as *
- const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_dcb_tx_conf ) ,
- "::" , stringify ! ( nb_tcs ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_dcb_tx_conf ) ) . dcb_tc as *
- const _ as usize } , 4usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_dcb_tx_conf ) ,
- "::" , stringify ! ( dcb_tc ) ));
-}
-impl Clone for rte_eth_dcb_tx_conf {
- fn clone(&self) -> Self { *self }
-}
-impl Default for rte_eth_dcb_tx_conf {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
-#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct rte_eth_vmdq_tx_conf {
- /// < VMDq mode, 64 pools.
- pub nb_queue_pools: rte_eth_nb_pools,
-}
-#[test]
-fn bindgen_test_layout_rte_eth_vmdq_tx_conf() {
- assert_eq!(::std::mem::size_of::<rte_eth_vmdq_tx_conf>() , 4usize , concat
- ! ( "Size of: " , stringify ! ( rte_eth_vmdq_tx_conf ) ));
- assert_eq! (::std::mem::align_of::<rte_eth_vmdq_tx_conf>() , 4usize ,
- concat ! (
- "Alignment of " , stringify ! ( rte_eth_vmdq_tx_conf ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_vmdq_tx_conf ) ) . nb_queue_pools
- as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_vmdq_tx_conf )
- , "::" , stringify ! ( nb_queue_pools ) ));
-}
-impl Clone for rte_eth_vmdq_tx_conf {
- fn clone(&self) -> Self { *self }
-}
-impl Default for rte_eth_vmdq_tx_conf {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
-#[repr(C)]
-#[derive(Copy)]
-pub struct rte_eth_vmdq_rx_conf {
- /// < VMDq only mode, 8 or 64 pools
- pub nb_queue_pools: rte_eth_nb_pools,
- /// < If non-zero, use a default pool
- pub enable_default_pool: u8,
- /// < The default pool, if applicable
- pub default_pool: u8,
- /// < Enable VT loop back
- pub enable_loop_back: u8,
- /// < We can have up to 64 filters/mappings
- pub nb_pool_maps: u8,
- /// < Flags from ETH_VMDQ_ACCEPT_*
- pub rx_mode: u32,
- /// < VMDq vlan pool maps.
- pub pool_map: [rte_eth_vmdq_rx_conf__bindgen_ty_1; 64usize],
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct rte_eth_vmdq_rx_conf__bindgen_ty_1 {
- /// < The vlan id of the received frame
- pub vlan_id: u16,
- /// < Bitmask of pools for packet rx
- pub pools: u64,
-}
-#[test]
-fn bindgen_test_layout_rte_eth_vmdq_rx_conf__bindgen_ty_1() {
- assert_eq!(::std::mem::size_of::<rte_eth_vmdq_rx_conf__bindgen_ty_1>() ,
- 16usize , concat ! (
- "Size of: " , stringify ! ( rte_eth_vmdq_rx_conf__bindgen_ty_1
- ) ));
- assert_eq! (::std::mem::align_of::<rte_eth_vmdq_rx_conf__bindgen_ty_1>() ,
- 8usize , concat ! (
- "Alignment of " , stringify ! (
- rte_eth_vmdq_rx_conf__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_vmdq_rx_conf__bindgen_ty_1 ) ) .
- vlan_id as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- rte_eth_vmdq_rx_conf__bindgen_ty_1 ) , "::" , stringify ! (
- vlan_id ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_vmdq_rx_conf__bindgen_ty_1 ) ) .
- pools as * const _ as usize } , 8usize , concat ! (
- "Alignment of field: " , stringify ! (
- rte_eth_vmdq_rx_conf__bindgen_ty_1 ) , "::" , stringify ! (
- pools ) ));
-}
-impl Clone for rte_eth_vmdq_rx_conf__bindgen_ty_1 {
- fn clone(&self) -> Self { *self }
-}
-#[test]
-fn bindgen_test_layout_rte_eth_vmdq_rx_conf() {
- assert_eq!(::std::mem::size_of::<rte_eth_vmdq_rx_conf>() , 1040usize ,
- concat ! ( "Size of: " , stringify ! ( rte_eth_vmdq_rx_conf )
- ));
- assert_eq! (::std::mem::align_of::<rte_eth_vmdq_rx_conf>() , 8usize ,
- concat ! (
- "Alignment of " , stringify ! ( rte_eth_vmdq_rx_conf ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_vmdq_rx_conf ) ) . nb_queue_pools
- as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_vmdq_rx_conf )
- , "::" , stringify ! ( nb_queue_pools ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_vmdq_rx_conf ) ) .
- enable_default_pool as * const _ as usize } , 4usize , concat
- ! (
- "Alignment of field: " , stringify ! ( rte_eth_vmdq_rx_conf )
- , "::" , stringify ! ( enable_default_pool ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_vmdq_rx_conf ) ) . default_pool
- as * const _ as usize } , 5usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_vmdq_rx_conf )
- , "::" , stringify ! ( default_pool ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_vmdq_rx_conf ) ) .
- enable_loop_back as * const _ as usize } , 6usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_vmdq_rx_conf )
- , "::" , stringify ! ( enable_loop_back ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_vmdq_rx_conf ) ) . nb_pool_maps
- as * const _ as usize } , 7usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_vmdq_rx_conf )
- , "::" , stringify ! ( nb_pool_maps ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_vmdq_rx_conf ) ) . rx_mode as *
- const _ as usize } , 8usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_vmdq_rx_conf )
- , "::" , stringify ! ( rx_mode ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_vmdq_rx_conf ) ) . pool_map as *
- const _ as usize } , 16usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_vmdq_rx_conf )
- , "::" , stringify ! ( pool_map ) ));
-}
-impl Clone for rte_eth_vmdq_rx_conf {
- fn clone(&self) -> Self { *self }
-}
-impl Default for rte_eth_vmdq_rx_conf {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
-#[repr(u32)]
-/// Flow Director setting modes: none, signature or perfect.
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum rte_fdir_mode {
- RTE_FDIR_MODE_NONE = 0,
- RTE_FDIR_MODE_SIGNATURE = 1,
- RTE_FDIR_MODE_PERFECT = 2,
- RTE_FDIR_MODE_PERFECT_MAC_VLAN = 3,
- RTE_FDIR_MODE_PERFECT_TUNNEL = 4,
-}
-#[repr(u32)]
-/// Memory space that can be configured to store Flow Director filters
-/// in the board memory.
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum rte_fdir_pballoc_type {
- RTE_FDIR_PBALLOC_64K = 0,
- RTE_FDIR_PBALLOC_128K = 1,
- RTE_FDIR_PBALLOC_256K = 2,
-}
-#[repr(u32)]
-/// Select report mode of FDIR hash information in RX descriptors.
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum rte_fdir_status_mode {
- RTE_FDIR_NO_REPORT_STATUS = 0,
- RTE_FDIR_REPORT_STATUS = 1,
- RTE_FDIR_REPORT_STATUS_ALWAYS = 2,
-}
-/// A structure used to define the input for IPV4 flow
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct rte_eth_ipv4_flow {
- /// < IPv4 source address in big endian.
- pub src_ip: u32,
- /// < IPv4 destination address in big endian.
- pub dst_ip: u32,
- /// < Type of service to match.
- pub tos: u8,
- /// < Time to live to match.
- pub ttl: u8,
- /// < Protocol, next header in big endian.
- pub proto: u8,
-}
-#[test]
-fn bindgen_test_layout_rte_eth_ipv4_flow() {
- assert_eq!(::std::mem::size_of::<rte_eth_ipv4_flow>() , 12usize , concat !
- ( "Size of: " , stringify ! ( rte_eth_ipv4_flow ) ));
- assert_eq! (::std::mem::align_of::<rte_eth_ipv4_flow>() , 4usize , concat
- ! ( "Alignment of " , stringify ! ( rte_eth_ipv4_flow ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_ipv4_flow ) ) . src_ip as * const
- _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_ipv4_flow ) ,
- "::" , stringify ! ( src_ip ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_ipv4_flow ) ) . dst_ip as * const
- _ as usize } , 4usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_ipv4_flow ) ,
- "::" , stringify ! ( dst_ip ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_ipv4_flow ) ) . tos as * const _
- as usize } , 8usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_ipv4_flow ) ,
- "::" , stringify ! ( tos ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_ipv4_flow ) ) . ttl as * const _
- as usize } , 9usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_ipv4_flow ) ,
- "::" , stringify ! ( ttl ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_ipv4_flow ) ) . proto as * const
- _ as usize } , 10usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_ipv4_flow ) ,
- "::" , stringify ! ( proto ) ));
-}
-impl Clone for rte_eth_ipv4_flow {
- fn clone(&self) -> Self { *self }
-}
-/// A structure used to define the input for IPV6 flow
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct rte_eth_ipv6_flow {
- /// < IPv6 source address in big endian.
- pub src_ip: [u32; 4usize],
- /// < IPv6 destination address in big endian.
- pub dst_ip: [u32; 4usize],
- /// < Traffic class to match.
- pub tc: u8,
- /// < Protocol, next header to match.
- pub proto: u8,
- /// < Hop limits to match.
- pub hop_limits: u8,
-}
-#[test]
-fn bindgen_test_layout_rte_eth_ipv6_flow() {
- assert_eq!(::std::mem::size_of::<rte_eth_ipv6_flow>() , 36usize , concat !
- ( "Size of: " , stringify ! ( rte_eth_ipv6_flow ) ));
- assert_eq! (::std::mem::align_of::<rte_eth_ipv6_flow>() , 4usize , concat
- ! ( "Alignment of " , stringify ! ( rte_eth_ipv6_flow ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_ipv6_flow ) ) . src_ip as * const
- _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_ipv6_flow ) ,
- "::" , stringify ! ( src_ip ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_ipv6_flow ) ) . dst_ip as * const
- _ as usize } , 16usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_ipv6_flow ) ,
- "::" , stringify ! ( dst_ip ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_ipv6_flow ) ) . tc as * const _
- as usize } , 32usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_ipv6_flow ) ,
- "::" , stringify ! ( tc ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_ipv6_flow ) ) . proto as * const
- _ as usize } , 33usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_ipv6_flow ) ,
- "::" , stringify ! ( proto ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_ipv6_flow ) ) . hop_limits as *
- const _ as usize } , 34usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_ipv6_flow ) ,
- "::" , stringify ! ( hop_limits ) ));
-}
-impl Clone for rte_eth_ipv6_flow {
- fn clone(&self) -> Self { *self }
-}
-/// A structure used to configure FDIR masks that are used by the device
-/// to match the various fields of RX packet headers.
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct rte_eth_fdir_masks {
- /// < Bit mask for vlan_tci in big endian
- pub vlan_tci_mask: u16,
- /// Bit mask for ipv4 flow in big endian.
- pub ipv4_mask: rte_eth_ipv4_flow,
- /// Bit maks for ipv6 flow in big endian.
- pub ipv6_mask: rte_eth_ipv6_flow,
- /// Bit mask for L4 source port in big endian.
- pub src_port_mask: u16,
- /// Bit mask for L4 destination port in big endian.
- pub dst_port_mask: u16,
- /// 6 bit mask for proper 6 bytes of Mac address, bit 0 matches the
- /// first byte on the wire
- pub mac_addr_byte_mask: u8,
- /// Bit mask for tunnel ID in big endian.
- pub tunnel_id_mask: u32,
- /// < 1 - Match tunnel type,
- /// 0 - Ignore tunnel type.
- pub tunnel_type_mask: u8,
-}
-#[test]
-fn bindgen_test_layout_rte_eth_fdir_masks() {
- assert_eq!(::std::mem::size_of::<rte_eth_fdir_masks>() , 68usize , concat
- ! ( "Size of: " , stringify ! ( rte_eth_fdir_masks ) ));
- assert_eq! (::std::mem::align_of::<rte_eth_fdir_masks>() , 4usize , concat
- ! ( "Alignment of " , stringify ! ( rte_eth_fdir_masks ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_fdir_masks ) ) . vlan_tci_mask as
- * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_fdir_masks ) ,
- "::" , stringify ! ( vlan_tci_mask ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_fdir_masks ) ) . ipv4_mask as *
- const _ as usize } , 4usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_fdir_masks ) ,
- "::" , stringify ! ( ipv4_mask ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_fdir_masks ) ) . ipv6_mask as *
- const _ as usize } , 16usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_fdir_masks ) ,
- "::" , stringify ! ( ipv6_mask ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_fdir_masks ) ) . src_port_mask as
- * const _ as usize } , 52usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_fdir_masks ) ,
- "::" , stringify ! ( src_port_mask ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_fdir_masks ) ) . dst_port_mask as
- * const _ as usize } , 54usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_fdir_masks ) ,
- "::" , stringify ! ( dst_port_mask ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_fdir_masks ) ) .
- mac_addr_byte_mask as * const _ as usize } , 56usize , concat
- ! (
- "Alignment of field: " , stringify ! ( rte_eth_fdir_masks ) ,
- "::" , stringify ! ( mac_addr_byte_mask ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_fdir_masks ) ) . tunnel_id_mask
- as * const _ as usize } , 60usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_fdir_masks ) ,
- "::" , stringify ! ( tunnel_id_mask ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_fdir_masks ) ) . tunnel_type_mask
- as * const _ as usize } , 64usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_fdir_masks ) ,
- "::" , stringify ! ( tunnel_type_mask ) ));
-}
-impl Clone for rte_eth_fdir_masks {
- fn clone(&self) -> Self { *self }
-}
-#[repr(u32)]
-/// Payload type
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum rte_eth_payload_type {
- RTE_ETH_PAYLOAD_UNKNOWN = 0,
- RTE_ETH_RAW_PAYLOAD = 1,
- RTE_ETH_L2_PAYLOAD = 2,
- RTE_ETH_L3_PAYLOAD = 3,
- RTE_ETH_L4_PAYLOAD = 4,
- RTE_ETH_PAYLOAD_MAX = 8,
-}
-/// A structure used to select bytes extracted from the protocol layers to
-/// flexible payload for filter
-#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct rte_eth_flex_payload_cfg {
- /// < Payload type
- pub type_: rte_eth_payload_type,
- pub src_offset: [u16; 16usize],
-}
-#[test]
-fn bindgen_test_layout_rte_eth_flex_payload_cfg() {
- assert_eq!(::std::mem::size_of::<rte_eth_flex_payload_cfg>() , 36usize ,
- concat ! (
- "Size of: " , stringify ! ( rte_eth_flex_payload_cfg ) ));
- assert_eq! (::std::mem::align_of::<rte_eth_flex_payload_cfg>() , 4usize ,
- concat ! (
- "Alignment of " , stringify ! ( rte_eth_flex_payload_cfg ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_flex_payload_cfg ) ) . type_ as *
- const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- rte_eth_flex_payload_cfg ) , "::" , stringify ! ( type_ ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_flex_payload_cfg ) ) . src_offset
- as * const _ as usize } , 4usize , concat ! (
- "Alignment of field: " , stringify ! (
- rte_eth_flex_payload_cfg ) , "::" , stringify ! ( src_offset )
- ));
-}
-impl Clone for rte_eth_flex_payload_cfg {
- fn clone(&self) -> Self { *self }
-}
-impl Default for rte_eth_flex_payload_cfg {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
-/// A structure used to define FDIR masks for flexible payload
-/// for each flow type
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct rte_eth_fdir_flex_mask {
- pub flow_type: u16,
- pub mask: [u8; 16usize],
-}
-#[test]
-fn bindgen_test_layout_rte_eth_fdir_flex_mask() {
- assert_eq!(::std::mem::size_of::<rte_eth_fdir_flex_mask>() , 18usize ,
- concat ! ( "Size of: " , stringify ! ( rte_eth_fdir_flex_mask )
- ));
- assert_eq! (::std::mem::align_of::<rte_eth_fdir_flex_mask>() , 2usize ,
- concat ! (
- "Alignment of " , stringify ! ( rte_eth_fdir_flex_mask ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_fdir_flex_mask ) ) . flow_type as
- * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_fdir_flex_mask
- ) , "::" , stringify ! ( flow_type ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_fdir_flex_mask ) ) . mask as *
- const _ as usize } , 2usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_fdir_flex_mask
- ) , "::" , stringify ! ( mask ) ));
-}
-impl Clone for rte_eth_fdir_flex_mask {
- fn clone(&self) -> Self { *self }
-}
-/// A structure used to define all flexible payload related setting
-/// include flex payload and flex mask
-#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct rte_eth_fdir_flex_conf {
- /// < The number of following payload cfg
- pub nb_payloads: u16,
- /// < The number of following mask
- pub nb_flexmasks: u16,
- pub flex_set: [rte_eth_flex_payload_cfg; 8usize],
- pub flex_mask: [rte_eth_fdir_flex_mask; 22usize],
-}
-#[test]
-fn bindgen_test_layout_rte_eth_fdir_flex_conf() {
- assert_eq!(::std::mem::size_of::<rte_eth_fdir_flex_conf>() , 688usize ,
- concat ! ( "Size of: " , stringify ! ( rte_eth_fdir_flex_conf )
- ));
- assert_eq! (::std::mem::align_of::<rte_eth_fdir_flex_conf>() , 4usize ,
- concat ! (
- "Alignment of " , stringify ! ( rte_eth_fdir_flex_conf ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_fdir_flex_conf ) ) . nb_payloads
- as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_fdir_flex_conf
- ) , "::" , stringify ! ( nb_payloads ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_fdir_flex_conf ) ) . nb_flexmasks
- as * const _ as usize } , 2usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_fdir_flex_conf
- ) , "::" , stringify ! ( nb_flexmasks ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_fdir_flex_conf ) ) . flex_set as
- * const _ as usize } , 4usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_fdir_flex_conf
- ) , "::" , stringify ! ( flex_set ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_fdir_flex_conf ) ) . flex_mask as
- * const _ as usize } , 292usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_fdir_flex_conf
- ) , "::" , stringify ! ( flex_mask ) ));
-}
-impl Clone for rte_eth_fdir_flex_conf {
- fn clone(&self) -> Self { *self }
-}
-impl Default for rte_eth_fdir_flex_conf {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
-/// A structure used to configure the Flow Director (FDIR) feature
-/// of an Ethernet port.
-///
-/// If mode is RTE_FDIR_DISABLE, the pballoc value is ignored.
-#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct rte_fdir_conf {
- /// < Flow Director mode.
- pub mode: rte_fdir_mode,
- /// < Space for FDIR filters.
- pub pballoc: rte_fdir_pballoc_type,
- /// < How to report FDIR hash.
- pub status: rte_fdir_status_mode,
- /// RX queue of packets matching a "drop" filter in perfect mode.
- pub drop_queue: u8,
- pub mask: rte_eth_fdir_masks,
- pub flex_conf: rte_eth_fdir_flex_conf,
-}
-#[test]
-fn bindgen_test_layout_rte_fdir_conf() {
- assert_eq!(::std::mem::size_of::<rte_fdir_conf>() , 772usize , concat ! (
- "Size of: " , stringify ! ( rte_fdir_conf ) ));
- assert_eq! (::std::mem::align_of::<rte_fdir_conf>() , 4usize , concat ! (
- "Alignment of " , stringify ! ( rte_fdir_conf ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_fdir_conf ) ) . mode as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_fdir_conf ) , "::"
- , stringify ! ( mode ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_fdir_conf ) ) . pballoc as * const _
- as usize } , 4usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_fdir_conf ) , "::"
- , stringify ! ( pballoc ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_fdir_conf ) ) . status as * const _
- as usize } , 8usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_fdir_conf ) , "::"
- , stringify ! ( status ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_fdir_conf ) ) . drop_queue as * const
- _ as usize } , 12usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_fdir_conf ) , "::"
- , stringify ! ( drop_queue ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_fdir_conf ) ) . mask as * const _ as
- usize } , 16usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_fdir_conf ) , "::"
- , stringify ! ( mask ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_fdir_conf ) ) . flex_conf as * const
- _ as usize } , 84usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_fdir_conf ) , "::"
- , stringify ! ( flex_conf ) ));
-}
-impl Clone for rte_fdir_conf {
- fn clone(&self) -> Self { *self }
-}
-impl Default for rte_fdir_conf {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
-/// A structure used to enable/disable specific device interrupts.
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct rte_intr_conf {
- /// enable/disable lsc interrupt. 0 (default) - disable, 1 enable
- pub lsc: u16,
- /// enable/disable rxq interrupt. 0 (default) - disable, 1 enable
- pub rxq: u16,
-}
-#[test]
-fn bindgen_test_layout_rte_intr_conf() {
- assert_eq!(::std::mem::size_of::<rte_intr_conf>() , 4usize , concat ! (
- "Size of: " , stringify ! ( rte_intr_conf ) ));
- assert_eq! (::std::mem::align_of::<rte_intr_conf>() , 2usize , concat ! (
- "Alignment of " , stringify ! ( rte_intr_conf ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_intr_conf ) ) . lsc as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_intr_conf ) , "::"
- , stringify ! ( lsc ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_intr_conf ) ) . rxq as * const _ as
- usize } , 2usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_intr_conf ) , "::"
- , stringify ! ( rxq ) ));
-}
-impl Clone for rte_intr_conf {
- fn clone(&self) -> Self { *self }
-}
-/// A structure used to configure an Ethernet port.
-/// Depending upon the RX multi-queue mode, extra advanced
-/// configuration settings may be needed.
-#[repr(C)]
-#[derive(Copy)]
-pub struct rte_eth_conf {
- /// < bitmap of ETH_LINK_SPEED_XXX of speeds to be
- /// used. ETH_LINK_SPEED_FIXED disables link
- /// autonegotiation, and a unique speed shall be
- /// set. Otherwise, the bitmap defines the set of
- /// speeds to be advertised. If the special value
- /// ETH_LINK_SPEED_AUTONEG (0) is used, all speeds
- /// supported are advertised.
- pub link_speeds: u32,
- /// < Port RX configuration.
- pub rxmode: rte_eth_rxmode,
- /// < Port TX configuration.
- pub txmode: rte_eth_txmode,
- /// < Loopback operation mode. By default the value
- /// is 0, meaning the loopback mode is disabled.
- /// Read the datasheet of given ethernet controller
- /// for details. The possible values of this field
- /// are defined in implementation of each driver.
- pub lpbk_mode: u32,
- /// < Port RX filtering configuration (union).
- pub rx_adv_conf: rte_eth_conf__bindgen_ty_1,
- /// < Port TX DCB configuration (union).
- pub tx_adv_conf: rte_eth_conf__bindgen_ty_2,
- /// Currently,Priority Flow Control(PFC) are supported,if DCB with PFC
- /// is needed,and the variable must be set ETH_DCB_PFC_SUPPORT.
- pub dcb_capability_en: u32,
- /// < FDIR configuration.
- pub fdir_conf: rte_fdir_conf,
- /// < Interrupt mode configuration.
- pub intr_conf: rte_intr_conf,
-}
-#[repr(C)]
-#[derive(Copy)]
-pub struct rte_eth_conf__bindgen_ty_1 {
- /// < Port RSS configuration
- pub rss_conf: rte_eth_rss_conf,
- pub vmdq_dcb_conf: rte_eth_vmdq_dcb_conf,
- pub dcb_rx_conf: rte_eth_dcb_rx_conf,
- pub vmdq_rx_conf: rte_eth_vmdq_rx_conf,
-}
-#[test]
-fn bindgen_test_layout_rte_eth_conf__bindgen_ty_1() {
- assert_eq!(::std::mem::size_of::<rte_eth_conf__bindgen_ty_1>() , 2120usize
- , concat ! (
- "Size of: " , stringify ! ( rte_eth_conf__bindgen_ty_1 ) ));
- assert_eq! (::std::mem::align_of::<rte_eth_conf__bindgen_ty_1>() , 8usize
- , concat ! (
- "Alignment of " , stringify ! ( rte_eth_conf__bindgen_ty_1 )
- ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_conf__bindgen_ty_1 ) ) . rss_conf
- as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- rte_eth_conf__bindgen_ty_1 ) , "::" , stringify ! ( rss_conf )
- ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_conf__bindgen_ty_1 ) ) .
- vmdq_dcb_conf as * const _ as usize } , 24usize , concat ! (
- "Alignment of field: " , stringify ! (
- rte_eth_conf__bindgen_ty_1 ) , "::" , stringify ! (
- vmdq_dcb_conf ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_conf__bindgen_ty_1 ) ) .
- dcb_rx_conf as * const _ as usize } , 1064usize , concat ! (
- "Alignment of field: " , stringify ! (
- rte_eth_conf__bindgen_ty_1 ) , "::" , stringify ! (
- dcb_rx_conf ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_conf__bindgen_ty_1 ) ) .
- vmdq_rx_conf as * const _ as usize } , 1080usize , concat ! (
- "Alignment of field: " , stringify ! (
- rte_eth_conf__bindgen_ty_1 ) , "::" , stringify ! (
- vmdq_rx_conf ) ));
-}
-impl Clone for rte_eth_conf__bindgen_ty_1 {
- fn clone(&self) -> Self { *self }
-}
-impl Default for rte_eth_conf__bindgen_ty_1 {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct rte_eth_conf__bindgen_ty_2 {
- pub vmdq_dcb_tx_conf: __BindgenUnionField<rte_eth_vmdq_dcb_tx_conf>,
- pub dcb_tx_conf: __BindgenUnionField<rte_eth_dcb_tx_conf>,
- pub vmdq_tx_conf: __BindgenUnionField<rte_eth_vmdq_tx_conf>,
- pub bindgen_union_field: [u32; 3usize],
-}
-#[test]
-fn bindgen_test_layout_rte_eth_conf__bindgen_ty_2() {
- assert_eq!(::std::mem::size_of::<rte_eth_conf__bindgen_ty_2>() , 12usize ,
- concat ! (
- "Size of: " , stringify ! ( rte_eth_conf__bindgen_ty_2 ) ));
- assert_eq! (::std::mem::align_of::<rte_eth_conf__bindgen_ty_2>() , 4usize
- , concat ! (
- "Alignment of " , stringify ! ( rte_eth_conf__bindgen_ty_2 )
- ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_conf__bindgen_ty_2 ) ) .
- vmdq_dcb_tx_conf as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- rte_eth_conf__bindgen_ty_2 ) , "::" , stringify ! (
- vmdq_dcb_tx_conf ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_conf__bindgen_ty_2 ) ) .
- dcb_tx_conf as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- rte_eth_conf__bindgen_ty_2 ) , "::" , stringify ! (
- dcb_tx_conf ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_conf__bindgen_ty_2 ) ) .
- vmdq_tx_conf as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- rte_eth_conf__bindgen_ty_2 ) , "::" , stringify ! (
- vmdq_tx_conf ) ));
-}
-impl Clone for rte_eth_conf__bindgen_ty_2 {
- fn clone(&self) -> Self { *self }
-}
-#[test]
-fn bindgen_test_layout_rte_eth_conf() {
- assert_eq!(::std::mem::size_of::<rte_eth_conf>() , 2944usize , concat ! (
- "Size of: " , stringify ! ( rte_eth_conf ) ));
- assert_eq! (::std::mem::align_of::<rte_eth_conf>() , 8usize , concat ! (
- "Alignment of " , stringify ! ( rte_eth_conf ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_conf ) ) . link_speeds as * const
- _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_conf ) , "::" ,
- stringify ! ( link_speeds ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_conf ) ) . rxmode as * const _ as
- usize } , 4usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_conf ) , "::" ,
- stringify ! ( rxmode ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_conf ) ) . txmode as * const _ as
- usize } , 16usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_conf ) , "::" ,
- stringify ! ( txmode ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_conf ) ) . lpbk_mode as * const _
- as usize } , 24usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_conf ) , "::" ,
- stringify ! ( lpbk_mode ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_conf ) ) . rx_adv_conf as * const
- _ as usize } , 32usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_conf ) , "::" ,
- stringify ! ( rx_adv_conf ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_conf ) ) . tx_adv_conf as * const
- _ as usize } , 2152usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_conf ) , "::" ,
- stringify ! ( tx_adv_conf ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_conf ) ) . dcb_capability_en as *
- const _ as usize } , 2164usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_conf ) , "::" ,
- stringify ! ( dcb_capability_en ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_conf ) ) . fdir_conf as * const _
- as usize } , 2168usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_conf ) , "::" ,
- stringify ! ( fdir_conf ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_eth_conf ) ) . intr_conf as * const _
- as usize } , 2940usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_eth_conf ) , "::" ,
- stringify ! ( intr_conf ) ));
-}
-impl Clone for rte_eth_conf {
- fn clone(&self) -> Self { *self }
-}
-impl Default for rte_eth_conf {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
diff --git a/tests/expectations/tests/layout_mbuf.rs b/tests/expectations/tests/layout_mbuf.rs
index 499c1ee7..77198c35 100644
--- a/tests/expectations/tests/layout_mbuf.rs
+++ b/tests/expectations/tests/layout_mbuf.rs
@@ -4,6 +4,30 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
+#[repr(C)]
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
pub const RTE_CACHE_LINE_MIN_SIZE: ::std::os::raw::c_uint = 64;
pub const RTE_CACHE_LINE_SIZE: ::std::os::raw::c_uint = 64;
pub type phys_addr_t = u64;
@@ -86,12 +110,13 @@ pub struct rte_mbuf {
/// or non-atomic) is controlled by the CONFIG_RTE_MBUF_REFCNT_ATOMIC
/// config option.
#[repr(C)]
-#[derive(Copy)]
-pub union rte_mbuf__bindgen_ty_1 {
+#[derive(Debug, Default, Copy)]
+pub struct rte_mbuf__bindgen_ty_1 {
/// < Atomically accessed refcnt
- pub refcnt_atomic: rte_atomic16_t,
+ pub refcnt_atomic: __BindgenUnionField<rte_atomic16_t>,
/// < Non-atomically accessed refcnt
- pub refcnt: u16,
+ pub refcnt: __BindgenUnionField<u16>,
+ pub bindgen_union_field: u16,
}
#[test]
fn bindgen_test_layout_rte_mbuf__bindgen_ty_1() {
@@ -115,15 +140,13 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_1() {
impl Clone for rte_mbuf__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
-impl Default for rte_mbuf__bindgen_ty_1 {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
#[repr(C)]
-#[derive(Copy)]
-pub union rte_mbuf__bindgen_ty_2 {
+#[derive(Debug, Default, Copy)]
+pub struct rte_mbuf__bindgen_ty_2 {
/// < L2/L3/L4 and tunnel information.
- pub packet_type: u32,
- pub __bindgen_anon_1: rte_mbuf__bindgen_ty_2__bindgen_ty_1,
+ pub packet_type: __BindgenUnionField<u32>,
+ pub __bindgen_anon_1: __BindgenUnionField<rte_mbuf__bindgen_ty_2__bindgen_ty_1>,
+ pub bindgen_union_field: u32,
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
@@ -448,32 +471,31 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_2() {
impl Clone for rte_mbuf__bindgen_ty_2 {
fn clone(&self) -> Self { *self }
}
-impl Default for rte_mbuf__bindgen_ty_2 {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
#[repr(C)]
-#[derive(Copy)]
-pub union rte_mbuf__bindgen_ty_3 {
+#[derive(Debug, Default, Copy)]
+pub struct rte_mbuf__bindgen_ty_3 {
/// < RSS hash result if RSS enabled
- pub rss: u32,
+ pub rss: __BindgenUnionField<u32>,
/// < Filter identifier if FDIR enabled
- pub fdir: rte_mbuf__bindgen_ty_3__bindgen_ty_1,
+ pub fdir: __BindgenUnionField<rte_mbuf__bindgen_ty_3__bindgen_ty_1>,
/// < Hierarchical scheduler
- pub sched: rte_mbuf__bindgen_ty_3__bindgen_ty_2,
+ pub sched: __BindgenUnionField<rte_mbuf__bindgen_ty_3__bindgen_ty_2>,
/// < User defined tags. See rte_distributor_process()
- pub usr: u32,
+ pub usr: __BindgenUnionField<u32>,
+ pub bindgen_union_field: [u32; 2usize],
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Debug, Default, Copy)]
pub struct rte_mbuf__bindgen_ty_3__bindgen_ty_1 {
pub __bindgen_anon_1: rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1,
pub hi: u32,
}
#[repr(C)]
-#[derive(Copy)]
-pub union rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1 {
- pub __bindgen_anon_1: rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1,
- pub lo: u32,
+#[derive(Debug, Default, Copy)]
+pub struct rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1 {
+ pub __bindgen_anon_1: __BindgenUnionField<rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1>,
+ pub lo: __BindgenUnionField<u32>,
+ pub bindgen_union_field: u32,
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
@@ -539,9 +561,6 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1() {
impl Clone for rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
-impl Default for rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1 {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
#[test]
fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_1() {
assert_eq!(::std::mem::size_of::<rte_mbuf__bindgen_ty_3__bindgen_ty_1>() ,
@@ -562,9 +581,6 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_1() {
impl Clone for rte_mbuf__bindgen_ty_3__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
-impl Default for rte_mbuf__bindgen_ty_3__bindgen_ty_1 {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct rte_mbuf__bindgen_ty_3__bindgen_ty_2 {
@@ -629,16 +645,14 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_3() {
impl Clone for rte_mbuf__bindgen_ty_3 {
fn clone(&self) -> Self { *self }
}
-impl Default for rte_mbuf__bindgen_ty_3 {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
#[repr(C)]
-#[derive(Copy)]
-pub union rte_mbuf__bindgen_ty_4 {
+#[derive(Debug, Default, Copy)]
+pub struct rte_mbuf__bindgen_ty_4 {
/// < Can be used for external metadata
- pub userdata: *mut ::std::os::raw::c_void,
+ pub userdata: __BindgenUnionField<*mut ::std::os::raw::c_void>,
/// < Allow 8-byte userdata on 32-bit
- pub udata64: u64,
+ pub udata64: __BindgenUnionField<u64>,
+ pub bindgen_union_field: u64,
}
#[test]
fn bindgen_test_layout_rte_mbuf__bindgen_ty_4() {
@@ -662,15 +676,13 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_4() {
impl Clone for rte_mbuf__bindgen_ty_4 {
fn clone(&self) -> Self { *self }
}
-impl Default for rte_mbuf__bindgen_ty_4 {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
#[repr(C)]
-#[derive(Copy)]
-pub union rte_mbuf__bindgen_ty_5 {
+#[derive(Debug, Default, Copy)]
+pub struct rte_mbuf__bindgen_ty_5 {
/// < combined for easy fetch
- pub tx_offload: u64,
- pub __bindgen_anon_1: rte_mbuf__bindgen_ty_5__bindgen_ty_1,
+ pub tx_offload: __BindgenUnionField<u64>,
+ pub __bindgen_anon_1: __BindgenUnionField<rte_mbuf__bindgen_ty_5__bindgen_ty_1>,
+ pub bindgen_union_field: u64,
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
@@ -955,9 +967,6 @@ fn bindgen_test_layout_rte_mbuf__bindgen_ty_5() {
impl Clone for rte_mbuf__bindgen_ty_5 {
fn clone(&self) -> Self { *self }
}
-impl Default for rte_mbuf__bindgen_ty_5 {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
#[test]
fn bindgen_test_layout_rte_mbuf() {
assert_eq!(::std::mem::size_of::<rte_mbuf>() , 128usize , concat ! (
diff --git a/tests/expectations/tests/layout_mbuf_1_0.rs b/tests/expectations/tests/layout_mbuf_1_0.rs
deleted file mode 100644
index 77198c35..00000000
--- a/tests/expectations/tests/layout_mbuf_1_0.rs
+++ /dev/null
@@ -1,1091 +0,0 @@
-/* automatically generated by rust-bindgen */
-
-
-#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-
-
-#[repr(C)]
-pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
-impl <T> __BindgenUnionField<T> {
- #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
- #[inline]
- fn default() -> Self { Self::new() }
-}
-impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
- #[inline]
- fn clone(&self) -> Self { Self::new() }
-}
-impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
-impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
- fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
- fmt.write_str("__BindgenUnionField")
- }
-}
-pub const RTE_CACHE_LINE_MIN_SIZE: ::std::os::raw::c_uint = 64;
-pub const RTE_CACHE_LINE_SIZE: ::std::os::raw::c_uint = 64;
-pub type phys_addr_t = u64;
-pub type MARKER = [*mut ::std::os::raw::c_void; 0usize];
-pub type MARKER8 = [u8; 0usize];
-pub type MARKER64 = [u64; 0usize];
-/// The atomic counter structure.
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct rte_atomic16_t {
- /// < An internal counter value.
- pub cnt: i16,
-}
-#[test]
-fn bindgen_test_layout_rte_atomic16_t() {
- assert_eq!(::std::mem::size_of::<rte_atomic16_t>() , 2usize , concat ! (
- "Size of: " , stringify ! ( rte_atomic16_t ) ));
- assert_eq! (::std::mem::align_of::<rte_atomic16_t>() , 2usize , concat ! (
- "Alignment of " , stringify ! ( rte_atomic16_t ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_atomic16_t ) ) . cnt as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_atomic16_t ) , "::"
- , stringify ! ( cnt ) ));
-}
-impl Clone for rte_atomic16_t {
- fn clone(&self) -> Self { *self }
-}
-/// The generic rte_mbuf, containing a packet mbuf.
-#[repr(C)]
-pub struct rte_mbuf {
- pub cacheline0: MARKER,
- /// < Virtual address of segment buffer.
- pub buf_addr: *mut ::std::os::raw::c_void,
- /// < Physical address of segment buffer.
- pub buf_physaddr: phys_addr_t,
- /// < Length of segment buffer.
- pub buf_len: u16,
- pub rearm_data: MARKER8,
- pub data_off: u16,
- pub __bindgen_anon_1: rte_mbuf__bindgen_ty_1,
- /// < Number of segments.
- pub nb_segs: u8,
- /// < Input port.
- pub port: u8,
- /// < Offload features.
- pub ol_flags: u64,
- pub rx_descriptor_fields1: MARKER,
- pub __bindgen_anon_2: rte_mbuf__bindgen_ty_2,
- /// < Total pkt len: sum of all segments.
- pub pkt_len: u32,
- /// < Amount of data in segment buffer.
- pub data_len: u16,
- /// VLAN TCI (CPU order), valid if PKT_RX_VLAN_STRIPPED is set.
- pub vlan_tci: u16,
- /// < hash information
- pub hash: rte_mbuf__bindgen_ty_3,
- /// < Sequence number. See also rte_reorder_insert()
- pub seqn: u32,
- /// Outer VLAN TCI (CPU order), valid if PKT_RX_QINQ_STRIPPED is set.
- pub vlan_tci_outer: u16,
- pub cacheline1: MARKER,
- pub __bindgen_anon_3: rte_mbuf__bindgen_ty_4,
- /// < Pool from which mbuf was allocated.
- pub pool: *mut rte_mempool,
- /// < Next segment of scattered packet.
- pub next: *mut rte_mbuf,
- pub __bindgen_anon_4: rte_mbuf__bindgen_ty_5,
- /// Size of the application private data. In case of an indirect
- /// mbuf, it stores the direct mbuf private data size.
- pub priv_size: u16,
- /// Timesync flags for use with IEEE1588.
- pub timesync: u16,
- pub __bindgen_padding_0: [u32; 7usize],
-}
-/// 16-bit Reference counter.
-/// It should only be accessed using the following functions:
-/// rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and
-/// rte_mbuf_refcnt_set(). The functionality of these functions (atomic,
-/// or non-atomic) is controlled by the CONFIG_RTE_MBUF_REFCNT_ATOMIC
-/// config option.
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct rte_mbuf__bindgen_ty_1 {
- /// < Atomically accessed refcnt
- pub refcnt_atomic: __BindgenUnionField<rte_atomic16_t>,
- /// < Non-atomically accessed refcnt
- pub refcnt: __BindgenUnionField<u16>,
- pub bindgen_union_field: u16,
-}
-#[test]
-fn bindgen_test_layout_rte_mbuf__bindgen_ty_1() {
- assert_eq!(::std::mem::size_of::<rte_mbuf__bindgen_ty_1>() , 2usize ,
- concat ! ( "Size of: " , stringify ! ( rte_mbuf__bindgen_ty_1 )
- ));
- assert_eq! (::std::mem::align_of::<rte_mbuf__bindgen_ty_1>() , 2usize ,
- concat ! (
- "Alignment of " , stringify ! ( rte_mbuf__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf__bindgen_ty_1 ) ) .
- refcnt_atomic as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mbuf__bindgen_ty_1
- ) , "::" , stringify ! ( refcnt_atomic ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf__bindgen_ty_1 ) ) . refcnt as *
- const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mbuf__bindgen_ty_1
- ) , "::" , stringify ! ( refcnt ) ));
-}
-impl Clone for rte_mbuf__bindgen_ty_1 {
- fn clone(&self) -> Self { *self }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct rte_mbuf__bindgen_ty_2 {
- /// < L2/L3/L4 and tunnel information.
- pub packet_type: __BindgenUnionField<u32>,
- pub __bindgen_anon_1: __BindgenUnionField<rte_mbuf__bindgen_ty_2__bindgen_ty_1>,
- pub bindgen_union_field: u32,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct rte_mbuf__bindgen_ty_2__bindgen_ty_1 {
- pub _bitfield_1: [u8; 4usize],
- pub __bindgen_align: [u32; 0usize],
-}
-#[test]
-fn bindgen_test_layout_rte_mbuf__bindgen_ty_2__bindgen_ty_1() {
- assert_eq!(::std::mem::size_of::<rte_mbuf__bindgen_ty_2__bindgen_ty_1>() ,
- 4usize , concat ! (
- "Size of: " , stringify ! (
- rte_mbuf__bindgen_ty_2__bindgen_ty_1 ) ));
- assert_eq! (::std::mem::align_of::<rte_mbuf__bindgen_ty_2__bindgen_ty_1>()
- , 4usize , concat ! (
- "Alignment of " , stringify ! (
- rte_mbuf__bindgen_ty_2__bindgen_ty_1 ) ));
-}
-impl Clone for rte_mbuf__bindgen_ty_2__bindgen_ty_1 {
- fn clone(&self) -> Self { *self }
-}
-impl rte_mbuf__bindgen_ty_2__bindgen_ty_1 {
- #[inline]
- pub fn l2_type(&self) -> u32 {
- let mut unit_field_val: u32 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u32 as
- *mut u8,
- ::std::mem::size_of::<u32>())
- };
- let mask = 15u64 as u32;
- let val = (unit_field_val & mask) >> 0usize;
- unsafe { ::std::mem::transmute(val as u32) }
- }
- #[inline]
- pub fn set_l2_type(&mut self, val: u32) {
- let mask = 15u64 as u32;
- let val = val as u32 as u32;
- let mut unit_field_val: u32 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u32 as
- *mut u8,
- ::std::mem::size_of::<u32>())
- };
- unit_field_val &= !mask;
- unit_field_val |= (val << 0usize) & mask;
- unsafe {
- ::std::ptr::copy_nonoverlapping(&unit_field_val as *const _ as
- *const u8,
- &mut self._bitfield_1 as *mut _ as
- *mut u8,
- ::std::mem::size_of::<u32>());
- }
- }
- #[inline]
- pub fn l3_type(&self) -> u32 {
- let mut unit_field_val: u32 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u32 as
- *mut u8,
- ::std::mem::size_of::<u32>())
- };
- let mask = 240u64 as u32;
- let val = (unit_field_val & mask) >> 4usize;
- unsafe { ::std::mem::transmute(val as u32) }
- }
- #[inline]
- pub fn set_l3_type(&mut self, val: u32) {
- let mask = 240u64 as u32;
- let val = val as u32 as u32;
- let mut unit_field_val: u32 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u32 as
- *mut u8,
- ::std::mem::size_of::<u32>())
- };
- unit_field_val &= !mask;
- unit_field_val |= (val << 4usize) & mask;
- unsafe {
- ::std::ptr::copy_nonoverlapping(&unit_field_val as *const _ as
- *const u8,
- &mut self._bitfield_1 as *mut _ as
- *mut u8,
- ::std::mem::size_of::<u32>());
- }
- }
- #[inline]
- pub fn l4_type(&self) -> u32 {
- let mut unit_field_val: u32 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u32 as
- *mut u8,
- ::std::mem::size_of::<u32>())
- };
- let mask = 3840u64 as u32;
- let val = (unit_field_val & mask) >> 8usize;
- unsafe { ::std::mem::transmute(val as u32) }
- }
- #[inline]
- pub fn set_l4_type(&mut self, val: u32) {
- let mask = 3840u64 as u32;
- let val = val as u32 as u32;
- let mut unit_field_val: u32 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u32 as
- *mut u8,
- ::std::mem::size_of::<u32>())
- };
- unit_field_val &= !mask;
- unit_field_val |= (val << 8usize) & mask;
- unsafe {
- ::std::ptr::copy_nonoverlapping(&unit_field_val as *const _ as
- *const u8,
- &mut self._bitfield_1 as *mut _ as
- *mut u8,
- ::std::mem::size_of::<u32>());
- }
- }
- #[inline]
- pub fn tun_type(&self) -> u32 {
- let mut unit_field_val: u32 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u32 as
- *mut u8,
- ::std::mem::size_of::<u32>())
- };
- let mask = 61440u64 as u32;
- let val = (unit_field_val & mask) >> 12usize;
- unsafe { ::std::mem::transmute(val as u32) }
- }
- #[inline]
- pub fn set_tun_type(&mut self, val: u32) {
- let mask = 61440u64 as u32;
- let val = val as u32 as u32;
- let mut unit_field_val: u32 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u32 as
- *mut u8,
- ::std::mem::size_of::<u32>())
- };
- unit_field_val &= !mask;
- unit_field_val |= (val << 12usize) & mask;
- unsafe {
- ::std::ptr::copy_nonoverlapping(&unit_field_val as *const _ as
- *const u8,
- &mut self._bitfield_1 as *mut _ as
- *mut u8,
- ::std::mem::size_of::<u32>());
- }
- }
- #[inline]
- pub fn inner_l2_type(&self) -> u32 {
- let mut unit_field_val: u32 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u32 as
- *mut u8,
- ::std::mem::size_of::<u32>())
- };
- let mask = 983040u64 as u32;
- let val = (unit_field_val & mask) >> 16usize;
- unsafe { ::std::mem::transmute(val as u32) }
- }
- #[inline]
- pub fn set_inner_l2_type(&mut self, val: u32) {
- let mask = 983040u64 as u32;
- let val = val as u32 as u32;
- let mut unit_field_val: u32 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u32 as
- *mut u8,
- ::std::mem::size_of::<u32>())
- };
- unit_field_val &= !mask;
- unit_field_val |= (val << 16usize) & mask;
- unsafe {
- ::std::ptr::copy_nonoverlapping(&unit_field_val as *const _ as
- *const u8,
- &mut self._bitfield_1 as *mut _ as
- *mut u8,
- ::std::mem::size_of::<u32>());
- }
- }
- #[inline]
- pub fn inner_l3_type(&self) -> u32 {
- let mut unit_field_val: u32 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u32 as
- *mut u8,
- ::std::mem::size_of::<u32>())
- };
- let mask = 15728640u64 as u32;
- let val = (unit_field_val & mask) >> 20usize;
- unsafe { ::std::mem::transmute(val as u32) }
- }
- #[inline]
- pub fn set_inner_l3_type(&mut self, val: u32) {
- let mask = 15728640u64 as u32;
- let val = val as u32 as u32;
- let mut unit_field_val: u32 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u32 as
- *mut u8,
- ::std::mem::size_of::<u32>())
- };
- unit_field_val &= !mask;
- unit_field_val |= (val << 20usize) & mask;
- unsafe {
- ::std::ptr::copy_nonoverlapping(&unit_field_val as *const _ as
- *const u8,
- &mut self._bitfield_1 as *mut _ as
- *mut u8,
- ::std::mem::size_of::<u32>());
- }
- }
- #[inline]
- pub fn inner_l4_type(&self) -> u32 {
- let mut unit_field_val: u32 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u32 as
- *mut u8,
- ::std::mem::size_of::<u32>())
- };
- let mask = 251658240u64 as u32;
- let val = (unit_field_val & mask) >> 24usize;
- unsafe { ::std::mem::transmute(val as u32) }
- }
- #[inline]
- pub fn set_inner_l4_type(&mut self, val: u32) {
- let mask = 251658240u64 as u32;
- let val = val as u32 as u32;
- let mut unit_field_val: u32 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u32 as
- *mut u8,
- ::std::mem::size_of::<u32>())
- };
- unit_field_val &= !mask;
- unit_field_val |= (val << 24usize) & mask;
- unsafe {
- ::std::ptr::copy_nonoverlapping(&unit_field_val as *const _ as
- *const u8,
- &mut self._bitfield_1 as *mut _ as
- *mut u8,
- ::std::mem::size_of::<u32>());
- }
- }
- #[inline]
- pub fn new_bitfield_1(l2_type: u32, l3_type: u32, l4_type: u32,
- tun_type: u32, inner_l2_type: u32,
- inner_l3_type: u32, inner_l4_type: u32) -> u32 {
- ({
- ({
- ({
- ({
- ({
- ({
- ({ 0 } |
- ((l2_type as u32 as u32) << 0usize)
- & (15u64 as u32))
- } |
- ((l3_type as u32 as u32) << 4usize) &
- (240u64 as u32))
- } |
- ((l4_type as u32 as u32) << 8usize) &
- (3840u64 as u32))
- } |
- ((tun_type as u32 as u32) << 12usize) &
- (61440u64 as u32))
- } |
- ((inner_l2_type as u32 as u32) << 16usize) &
- (983040u64 as u32))
- } |
- ((inner_l3_type as u32 as u32) << 20usize) &
- (15728640u64 as u32))
- } |
- ((inner_l4_type as u32 as u32) << 24usize) &
- (251658240u64 as u32))
- }
-}
-#[test]
-fn bindgen_test_layout_rte_mbuf__bindgen_ty_2() {
- assert_eq!(::std::mem::size_of::<rte_mbuf__bindgen_ty_2>() , 4usize ,
- concat ! ( "Size of: " , stringify ! ( rte_mbuf__bindgen_ty_2 )
- ));
- assert_eq! (::std::mem::align_of::<rte_mbuf__bindgen_ty_2>() , 4usize ,
- concat ! (
- "Alignment of " , stringify ! ( rte_mbuf__bindgen_ty_2 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf__bindgen_ty_2 ) ) . packet_type
- as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mbuf__bindgen_ty_2
- ) , "::" , stringify ! ( packet_type ) ));
-}
-impl Clone for rte_mbuf__bindgen_ty_2 {
- fn clone(&self) -> Self { *self }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct rte_mbuf__bindgen_ty_3 {
- /// < RSS hash result if RSS enabled
- pub rss: __BindgenUnionField<u32>,
- /// < Filter identifier if FDIR enabled
- pub fdir: __BindgenUnionField<rte_mbuf__bindgen_ty_3__bindgen_ty_1>,
- /// < Hierarchical scheduler
- pub sched: __BindgenUnionField<rte_mbuf__bindgen_ty_3__bindgen_ty_2>,
- /// < User defined tags. See rte_distributor_process()
- pub usr: __BindgenUnionField<u32>,
- pub bindgen_union_field: [u32; 2usize],
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct rte_mbuf__bindgen_ty_3__bindgen_ty_1 {
- pub __bindgen_anon_1: rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1,
- pub hi: u32,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1 {
- pub __bindgen_anon_1: __BindgenUnionField<rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1>,
- pub lo: __BindgenUnionField<u32>,
- pub bindgen_union_field: u32,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 {
- pub hash: u16,
- pub id: u16,
-}
-#[test]
-fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1() {
- assert_eq!(::std::mem::size_of::<rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1>()
- , 4usize , concat ! (
- "Size of: " , stringify ! (
- rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1
- ) ));
- assert_eq! (::std::mem::align_of::<rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1>()
- , 2usize , concat ! (
- "Alignment of " , stringify ! (
- rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1
- ) ));
- assert_eq! (unsafe {
- & (
- * (
- 0 as * const
- rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1
- ) ) . hash as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1
- ) , "::" , stringify ! ( hash ) ));
- assert_eq! (unsafe {
- & (
- * (
- 0 as * const
- rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1
- ) ) . id as * const _ as usize } , 2usize , concat ! (
- "Alignment of field: " , stringify ! (
- rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1
- ) , "::" , stringify ! ( id ) ));
-}
-impl Clone for
- rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 {
- fn clone(&self) -> Self { *self }
-}
-#[test]
-fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1() {
- assert_eq!(::std::mem::size_of::<rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1>()
- , 4usize , concat ! (
- "Size of: " , stringify ! (
- rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1 ) ));
- assert_eq! (::std::mem::align_of::<rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1>()
- , 4usize , concat ! (
- "Alignment of " , stringify ! (
- rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & (
- * (
- 0 as * const
- rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1 ) ) . lo as
- * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1 ) , "::" ,
- stringify ! ( lo ) ));
-}
-impl Clone for rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1 {
- fn clone(&self) -> Self { *self }
-}
-#[test]
-fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_1() {
- assert_eq!(::std::mem::size_of::<rte_mbuf__bindgen_ty_3__bindgen_ty_1>() ,
- 8usize , concat ! (
- "Size of: " , stringify ! (
- rte_mbuf__bindgen_ty_3__bindgen_ty_1 ) ));
- assert_eq! (::std::mem::align_of::<rte_mbuf__bindgen_ty_3__bindgen_ty_1>()
- , 4usize , concat ! (
- "Alignment of " , stringify ! (
- rte_mbuf__bindgen_ty_3__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf__bindgen_ty_3__bindgen_ty_1 ) )
- . hi as * const _ as usize } , 4usize , concat ! (
- "Alignment of field: " , stringify ! (
- rte_mbuf__bindgen_ty_3__bindgen_ty_1 ) , "::" , stringify ! (
- hi ) ));
-}
-impl Clone for rte_mbuf__bindgen_ty_3__bindgen_ty_1 {
- fn clone(&self) -> Self { *self }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct rte_mbuf__bindgen_ty_3__bindgen_ty_2 {
- pub lo: u32,
- pub hi: u32,
-}
-#[test]
-fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_2() {
- assert_eq!(::std::mem::size_of::<rte_mbuf__bindgen_ty_3__bindgen_ty_2>() ,
- 8usize , concat ! (
- "Size of: " , stringify ! (
- rte_mbuf__bindgen_ty_3__bindgen_ty_2 ) ));
- assert_eq! (::std::mem::align_of::<rte_mbuf__bindgen_ty_3__bindgen_ty_2>()
- , 4usize , concat ! (
- "Alignment of " , stringify ! (
- rte_mbuf__bindgen_ty_3__bindgen_ty_2 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf__bindgen_ty_3__bindgen_ty_2 ) )
- . lo as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- rte_mbuf__bindgen_ty_3__bindgen_ty_2 ) , "::" , stringify ! (
- lo ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf__bindgen_ty_3__bindgen_ty_2 ) )
- . hi as * const _ as usize } , 4usize , concat ! (
- "Alignment of field: " , stringify ! (
- rte_mbuf__bindgen_ty_3__bindgen_ty_2 ) , "::" , stringify ! (
- hi ) ));
-}
-impl Clone for rte_mbuf__bindgen_ty_3__bindgen_ty_2 {
- fn clone(&self) -> Self { *self }
-}
-#[test]
-fn bindgen_test_layout_rte_mbuf__bindgen_ty_3() {
- assert_eq!(::std::mem::size_of::<rte_mbuf__bindgen_ty_3>() , 8usize ,
- concat ! ( "Size of: " , stringify ! ( rte_mbuf__bindgen_ty_3 )
- ));
- assert_eq! (::std::mem::align_of::<rte_mbuf__bindgen_ty_3>() , 4usize ,
- concat ! (
- "Alignment of " , stringify ! ( rte_mbuf__bindgen_ty_3 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf__bindgen_ty_3 ) ) . rss as *
- const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mbuf__bindgen_ty_3
- ) , "::" , stringify ! ( rss ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf__bindgen_ty_3 ) ) . fdir as *
- const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mbuf__bindgen_ty_3
- ) , "::" , stringify ! ( fdir ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf__bindgen_ty_3 ) ) . sched as *
- const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mbuf__bindgen_ty_3
- ) , "::" , stringify ! ( sched ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf__bindgen_ty_3 ) ) . usr as *
- const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mbuf__bindgen_ty_3
- ) , "::" , stringify ! ( usr ) ));
-}
-impl Clone for rte_mbuf__bindgen_ty_3 {
- fn clone(&self) -> Self { *self }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct rte_mbuf__bindgen_ty_4 {
- /// < Can be used for external metadata
- pub userdata: __BindgenUnionField<*mut ::std::os::raw::c_void>,
- /// < Allow 8-byte userdata on 32-bit
- pub udata64: __BindgenUnionField<u64>,
- pub bindgen_union_field: u64,
-}
-#[test]
-fn bindgen_test_layout_rte_mbuf__bindgen_ty_4() {
- assert_eq!(::std::mem::size_of::<rte_mbuf__bindgen_ty_4>() , 8usize ,
- concat ! ( "Size of: " , stringify ! ( rte_mbuf__bindgen_ty_4 )
- ));
- assert_eq! (::std::mem::align_of::<rte_mbuf__bindgen_ty_4>() , 8usize ,
- concat ! (
- "Alignment of " , stringify ! ( rte_mbuf__bindgen_ty_4 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf__bindgen_ty_4 ) ) . userdata as
- * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mbuf__bindgen_ty_4
- ) , "::" , stringify ! ( userdata ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf__bindgen_ty_4 ) ) . udata64 as *
- const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mbuf__bindgen_ty_4
- ) , "::" , stringify ! ( udata64 ) ));
-}
-impl Clone for rte_mbuf__bindgen_ty_4 {
- fn clone(&self) -> Self { *self }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct rte_mbuf__bindgen_ty_5 {
- /// < combined for easy fetch
- pub tx_offload: __BindgenUnionField<u64>,
- pub __bindgen_anon_1: __BindgenUnionField<rte_mbuf__bindgen_ty_5__bindgen_ty_1>,
- pub bindgen_union_field: u64,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct rte_mbuf__bindgen_ty_5__bindgen_ty_1 {
- pub _bitfield_1: [u16; 4usize],
- pub __bindgen_align: [u64; 0usize],
-}
-#[test]
-fn bindgen_test_layout_rte_mbuf__bindgen_ty_5__bindgen_ty_1() {
- assert_eq!(::std::mem::size_of::<rte_mbuf__bindgen_ty_5__bindgen_ty_1>() ,
- 8usize , concat ! (
- "Size of: " , stringify ! (
- rte_mbuf__bindgen_ty_5__bindgen_ty_1 ) ));
- assert_eq! (::std::mem::align_of::<rte_mbuf__bindgen_ty_5__bindgen_ty_1>()
- , 8usize , concat ! (
- "Alignment of " , stringify ! (
- rte_mbuf__bindgen_ty_5__bindgen_ty_1 ) ));
-}
-impl Clone for rte_mbuf__bindgen_ty_5__bindgen_ty_1 {
- fn clone(&self) -> Self { *self }
-}
-impl rte_mbuf__bindgen_ty_5__bindgen_ty_1 {
- #[inline]
- pub fn l2_len(&self) -> u64 {
- let mut unit_field_val: u64 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u64 as
- *mut u8,
- ::std::mem::size_of::<u64>())
- };
- let mask = 127u64 as u64;
- let val = (unit_field_val & mask) >> 0usize;
- unsafe { ::std::mem::transmute(val as u64) }
- }
- #[inline]
- pub fn set_l2_len(&mut self, val: u64) {
- let mask = 127u64 as u64;
- let val = val as u64 as u64;
- let mut unit_field_val: u64 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u64 as
- *mut u8,
- ::std::mem::size_of::<u64>())
- };
- unit_field_val &= !mask;
- unit_field_val |= (val << 0usize) & mask;
- unsafe {
- ::std::ptr::copy_nonoverlapping(&unit_field_val as *const _ as
- *const u8,
- &mut self._bitfield_1 as *mut _ as
- *mut u8,
- ::std::mem::size_of::<u64>());
- }
- }
- #[inline]
- pub fn l3_len(&self) -> u64 {
- let mut unit_field_val: u64 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u64 as
- *mut u8,
- ::std::mem::size_of::<u64>())
- };
- let mask = 65408u64 as u64;
- let val = (unit_field_val & mask) >> 7usize;
- unsafe { ::std::mem::transmute(val as u64) }
- }
- #[inline]
- pub fn set_l3_len(&mut self, val: u64) {
- let mask = 65408u64 as u64;
- let val = val as u64 as u64;
- let mut unit_field_val: u64 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u64 as
- *mut u8,
- ::std::mem::size_of::<u64>())
- };
- unit_field_val &= !mask;
- unit_field_val |= (val << 7usize) & mask;
- unsafe {
- ::std::ptr::copy_nonoverlapping(&unit_field_val as *const _ as
- *const u8,
- &mut self._bitfield_1 as *mut _ as
- *mut u8,
- ::std::mem::size_of::<u64>());
- }
- }
- #[inline]
- pub fn l4_len(&self) -> u64 {
- let mut unit_field_val: u64 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u64 as
- *mut u8,
- ::std::mem::size_of::<u64>())
- };
- let mask = 16711680u64 as u64;
- let val = (unit_field_val & mask) >> 16usize;
- unsafe { ::std::mem::transmute(val as u64) }
- }
- #[inline]
- pub fn set_l4_len(&mut self, val: u64) {
- let mask = 16711680u64 as u64;
- let val = val as u64 as u64;
- let mut unit_field_val: u64 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u64 as
- *mut u8,
- ::std::mem::size_of::<u64>())
- };
- unit_field_val &= !mask;
- unit_field_val |= (val << 16usize) & mask;
- unsafe {
- ::std::ptr::copy_nonoverlapping(&unit_field_val as *const _ as
- *const u8,
- &mut self._bitfield_1 as *mut _ as
- *mut u8,
- ::std::mem::size_of::<u64>());
- }
- }
- #[inline]
- pub fn tso_segsz(&self) -> u64 {
- let mut unit_field_val: u64 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u64 as
- *mut u8,
- ::std::mem::size_of::<u64>())
- };
- let mask = 1099494850560u64 as u64;
- let val = (unit_field_val & mask) >> 24usize;
- unsafe { ::std::mem::transmute(val as u64) }
- }
- #[inline]
- pub fn set_tso_segsz(&mut self, val: u64) {
- let mask = 1099494850560u64 as u64;
- let val = val as u64 as u64;
- let mut unit_field_val: u64 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u64 as
- *mut u8,
- ::std::mem::size_of::<u64>())
- };
- unit_field_val &= !mask;
- unit_field_val |= (val << 24usize) & mask;
- unsafe {
- ::std::ptr::copy_nonoverlapping(&unit_field_val as *const _ as
- *const u8,
- &mut self._bitfield_1 as *mut _ as
- *mut u8,
- ::std::mem::size_of::<u64>());
- }
- }
- #[inline]
- pub fn outer_l3_len(&self) -> u64 {
- let mut unit_field_val: u64 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u64 as
- *mut u8,
- ::std::mem::size_of::<u64>())
- };
- let mask = 561850441793536u64 as u64;
- let val = (unit_field_val & mask) >> 40usize;
- unsafe { ::std::mem::transmute(val as u64) }
- }
- #[inline]
- pub fn set_outer_l3_len(&mut self, val: u64) {
- let mask = 561850441793536u64 as u64;
- let val = val as u64 as u64;
- let mut unit_field_val: u64 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u64 as
- *mut u8,
- ::std::mem::size_of::<u64>())
- };
- unit_field_val &= !mask;
- unit_field_val |= (val << 40usize) & mask;
- unsafe {
- ::std::ptr::copy_nonoverlapping(&unit_field_val as *const _ as
- *const u8,
- &mut self._bitfield_1 as *mut _ as
- *mut u8,
- ::std::mem::size_of::<u64>());
- }
- }
- #[inline]
- pub fn outer_l2_len(&self) -> u64 {
- let mut unit_field_val: u64 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u64 as
- *mut u8,
- ::std::mem::size_of::<u64>())
- };
- let mask = 71494644084506624u64 as u64;
- let val = (unit_field_val & mask) >> 49usize;
- unsafe { ::std::mem::transmute(val as u64) }
- }
- #[inline]
- pub fn set_outer_l2_len(&mut self, val: u64) {
- let mask = 71494644084506624u64 as u64;
- let val = val as u64 as u64;
- let mut unit_field_val: u64 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u64 as
- *mut u8,
- ::std::mem::size_of::<u64>())
- };
- unit_field_val &= !mask;
- unit_field_val |= (val << 49usize) & mask;
- unsafe {
- ::std::ptr::copy_nonoverlapping(&unit_field_val as *const _ as
- *const u8,
- &mut self._bitfield_1 as *mut _ as
- *mut u8,
- ::std::mem::size_of::<u64>());
- }
- }
- #[inline]
- pub fn new_bitfield_1(l2_len: u64, l3_len: u64, l4_len: u64,
- tso_segsz: u64, outer_l3_len: u64,
- outer_l2_len: u64) -> u64 {
- ({
- ({
- ({
- ({
- ({
- ({ 0 } |
- ((l2_len as u64 as u64) << 0usize) &
- (127u64 as u64))
- } |
- ((l3_len as u64 as u64) << 7usize) &
- (65408u64 as u64))
- } |
- ((l4_len as u64 as u64) << 16usize) &
- (16711680u64 as u64))
- } |
- ((tso_segsz as u64 as u64) << 24usize) &
- (1099494850560u64 as u64))
- } |
- ((outer_l3_len as u64 as u64) << 40usize) &
- (561850441793536u64 as u64))
- } |
- ((outer_l2_len as u64 as u64) << 49usize) &
- (71494644084506624u64 as u64))
- }
-}
-#[test]
-fn bindgen_test_layout_rte_mbuf__bindgen_ty_5() {
- assert_eq!(::std::mem::size_of::<rte_mbuf__bindgen_ty_5>() , 8usize ,
- concat ! ( "Size of: " , stringify ! ( rte_mbuf__bindgen_ty_5 )
- ));
- assert_eq! (::std::mem::align_of::<rte_mbuf__bindgen_ty_5>() , 8usize ,
- concat ! (
- "Alignment of " , stringify ! ( rte_mbuf__bindgen_ty_5 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf__bindgen_ty_5 ) ) . tx_offload
- as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mbuf__bindgen_ty_5
- ) , "::" , stringify ! ( tx_offload ) ));
-}
-impl Clone for rte_mbuf__bindgen_ty_5 {
- fn clone(&self) -> Self { *self }
-}
-#[test]
-fn bindgen_test_layout_rte_mbuf() {
- assert_eq!(::std::mem::size_of::<rte_mbuf>() , 128usize , concat ! (
- "Size of: " , stringify ! ( rte_mbuf ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf ) ) . cacheline0 as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mbuf ) , "::" ,
- stringify ! ( cacheline0 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf ) ) . buf_addr as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mbuf ) , "::" ,
- stringify ! ( buf_addr ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf ) ) . buf_physaddr as * const _
- as usize } , 8usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mbuf ) , "::" ,
- stringify ! ( buf_physaddr ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf ) ) . buf_len as * const _ as
- usize } , 16usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mbuf ) , "::" ,
- stringify ! ( buf_len ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf ) ) . rearm_data as * const _ as
- usize } , 18usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mbuf ) , "::" ,
- stringify ! ( rearm_data ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf ) ) . data_off as * const _ as
- usize } , 18usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mbuf ) , "::" ,
- stringify ! ( data_off ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf ) ) . nb_segs as * const _ as
- usize } , 22usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mbuf ) , "::" ,
- stringify ! ( nb_segs ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf ) ) . port as * const _ as usize
- } , 23usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mbuf ) , "::" ,
- stringify ! ( port ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf ) ) . ol_flags as * const _ as
- usize } , 24usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mbuf ) , "::" ,
- stringify ! ( ol_flags ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf ) ) . rx_descriptor_fields1 as *
- const _ as usize } , 32usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mbuf ) , "::" ,
- stringify ! ( rx_descriptor_fields1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf ) ) . pkt_len as * const _ as
- usize } , 36usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mbuf ) , "::" ,
- stringify ! ( pkt_len ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf ) ) . data_len as * const _ as
- usize } , 40usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mbuf ) , "::" ,
- stringify ! ( data_len ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf ) ) . vlan_tci as * const _ as
- usize } , 42usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mbuf ) , "::" ,
- stringify ! ( vlan_tci ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf ) ) . hash as * const _ as usize
- } , 44usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mbuf ) , "::" ,
- stringify ! ( hash ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf ) ) . seqn as * const _ as usize
- } , 52usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mbuf ) , "::" ,
- stringify ! ( seqn ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf ) ) . vlan_tci_outer as * const
- _ as usize } , 56usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mbuf ) , "::" ,
- stringify ! ( vlan_tci_outer ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf ) ) . cacheline1 as * const _ as
- usize } , 64usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mbuf ) , "::" ,
- stringify ! ( cacheline1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf ) ) . pool as * const _ as usize
- } , 72usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mbuf ) , "::" ,
- stringify ! ( pool ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf ) ) . next as * const _ as usize
- } , 80usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mbuf ) , "::" ,
- stringify ! ( next ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf ) ) . priv_size as * const _ as
- usize } , 96usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mbuf ) , "::" ,
- stringify ! ( priv_size ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const rte_mbuf ) ) . timesync as * const _ as
- usize } , 98usize , concat ! (
- "Alignment of field: " , stringify ! ( rte_mbuf ) , "::" ,
- stringify ! ( timesync ) ));
-}
-impl Default for rte_mbuf {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
-/// < Pool from which mbuf was allocated.
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct rte_mempool {
- pub _address: u8,
-}
-impl Clone for rte_mempool {
- fn clone(&self) -> Self { *self }
-}
diff --git a/tests/expectations/tests/struct_with_anon_union.rs b/tests/expectations/tests/struct_with_anon_union.rs
index eeb36756..5984ba6e 100644
--- a/tests/expectations/tests/struct_with_anon_union.rs
+++ b/tests/expectations/tests/struct_with_anon_union.rs
@@ -5,15 +5,40 @@
#[repr(C)]
-#[derive(Copy)]
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy)]
pub struct foo {
pub bar: foo__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Copy)]
-pub union foo__bindgen_ty_1 {
- pub a: ::std::os::raw::c_uint,
- pub b: ::std::os::raw::c_ushort,
+#[derive(Debug, Default, Copy)]
+pub struct foo__bindgen_ty_1 {
+ pub a: __BindgenUnionField<::std::os::raw::c_uint>,
+ pub b: __BindgenUnionField<::std::os::raw::c_ushort>,
+ pub bindgen_union_field: u32,
}
#[test]
fn bindgen_test_layout_foo__bindgen_ty_1() {
@@ -35,9 +60,6 @@ fn bindgen_test_layout_foo__bindgen_ty_1() {
impl Clone for foo__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
-impl Default for foo__bindgen_ty_1 {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
#[test]
fn bindgen_test_layout_foo() {
assert_eq!(::std::mem::size_of::<foo>() , 4usize , concat ! (
@@ -53,6 +75,3 @@ fn bindgen_test_layout_foo() {
impl Clone for foo {
fn clone(&self) -> Self { *self }
}
-impl Default for foo {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
diff --git a/tests/expectations/tests/struct_with_anon_union_1_0.rs b/tests/expectations/tests/struct_with_anon_union_1_0.rs
deleted file mode 100644
index 5984ba6e..00000000
--- a/tests/expectations/tests/struct_with_anon_union_1_0.rs
+++ /dev/null
@@ -1,77 +0,0 @@
-/* automatically generated by rust-bindgen */
-
-
-#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-
-
-#[repr(C)]
-pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
-impl <T> __BindgenUnionField<T> {
- #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
- #[inline]
- fn default() -> Self { Self::new() }
-}
-impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
- #[inline]
- fn clone(&self) -> Self { Self::new() }
-}
-impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
-impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
- fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
- fmt.write_str("__BindgenUnionField")
- }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct foo {
- pub bar: foo__bindgen_ty_1,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct foo__bindgen_ty_1 {
- pub a: __BindgenUnionField<::std::os::raw::c_uint>,
- pub b: __BindgenUnionField<::std::os::raw::c_ushort>,
- pub bindgen_union_field: u32,
-}
-#[test]
-fn bindgen_test_layout_foo__bindgen_ty_1() {
- assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 4usize , concat !
- ( "Size of: " , stringify ! ( foo__bindgen_ty_1 ) ));
- assert_eq! (::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize , concat
- ! ( "Alignment of " , stringify ! ( foo__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1 ) ) . a as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo__bindgen_ty_1 ) ,
- "::" , stringify ! ( a ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1 ) ) . b as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo__bindgen_ty_1 ) ,
- "::" , stringify ! ( b ) ));
-}
-impl Clone for foo__bindgen_ty_1 {
- fn clone(&self) -> Self { *self }
-}
-#[test]
-fn bindgen_test_layout_foo() {
- assert_eq!(::std::mem::size_of::<foo>() , 4usize , concat ! (
- "Size of: " , stringify ! ( foo ) ));
- assert_eq! (::std::mem::align_of::<foo>() , 4usize , concat ! (
- "Alignment of " , stringify ! ( foo ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo ) ) . bar as * const _ as usize } ,
- 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo ) , "::" ,
- stringify ! ( bar ) ));
-}
-impl Clone for foo {
- fn clone(&self) -> Self { *self }
-}
diff --git a/tests/expectations/tests/struct_with_anon_unnamed_union.rs b/tests/expectations/tests/struct_with_anon_unnamed_union.rs
index 43c3e19c..09dbbb59 100644
--- a/tests/expectations/tests/struct_with_anon_unnamed_union.rs
+++ b/tests/expectations/tests/struct_with_anon_unnamed_union.rs
@@ -5,15 +5,40 @@
#[repr(C)]
-#[derive(Copy)]
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy)]
pub struct foo {
pub __bindgen_anon_1: foo__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Copy)]
-pub union foo__bindgen_ty_1 {
- pub a: ::std::os::raw::c_uint,
- pub b: ::std::os::raw::c_ushort,
+#[derive(Debug, Default, Copy)]
+pub struct foo__bindgen_ty_1 {
+ pub a: __BindgenUnionField<::std::os::raw::c_uint>,
+ pub b: __BindgenUnionField<::std::os::raw::c_ushort>,
+ pub bindgen_union_field: u32,
}
#[test]
fn bindgen_test_layout_foo__bindgen_ty_1() {
@@ -35,9 +60,6 @@ fn bindgen_test_layout_foo__bindgen_ty_1() {
impl Clone for foo__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
-impl Default for foo__bindgen_ty_1 {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
#[test]
fn bindgen_test_layout_foo() {
assert_eq!(::std::mem::size_of::<foo>() , 4usize , concat ! (
@@ -48,6 +70,3 @@ fn bindgen_test_layout_foo() {
impl Clone for foo {
fn clone(&self) -> Self { *self }
}
-impl Default for foo {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
diff --git a/tests/expectations/tests/struct_with_anon_unnamed_union_1_0.rs b/tests/expectations/tests/struct_with_anon_unnamed_union_1_0.rs
deleted file mode 100644
index 09dbbb59..00000000
--- a/tests/expectations/tests/struct_with_anon_unnamed_union_1_0.rs
+++ /dev/null
@@ -1,72 +0,0 @@
-/* automatically generated by rust-bindgen */
-
-
-#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-
-
-#[repr(C)]
-pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
-impl <T> __BindgenUnionField<T> {
- #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
- #[inline]
- fn default() -> Self { Self::new() }
-}
-impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
- #[inline]
- fn clone(&self) -> Self { Self::new() }
-}
-impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
-impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
- fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
- fmt.write_str("__BindgenUnionField")
- }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct foo {
- pub __bindgen_anon_1: foo__bindgen_ty_1,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct foo__bindgen_ty_1 {
- pub a: __BindgenUnionField<::std::os::raw::c_uint>,
- pub b: __BindgenUnionField<::std::os::raw::c_ushort>,
- pub bindgen_union_field: u32,
-}
-#[test]
-fn bindgen_test_layout_foo__bindgen_ty_1() {
- assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 4usize , concat !
- ( "Size of: " , stringify ! ( foo__bindgen_ty_1 ) ));
- assert_eq! (::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize , concat
- ! ( "Alignment of " , stringify ! ( foo__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1 ) ) . a as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo__bindgen_ty_1 ) ,
- "::" , stringify ! ( a ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1 ) ) . b as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo__bindgen_ty_1 ) ,
- "::" , stringify ! ( b ) ));
-}
-impl Clone for foo__bindgen_ty_1 {
- fn clone(&self) -> Self { *self }
-}
-#[test]
-fn bindgen_test_layout_foo() {
- assert_eq!(::std::mem::size_of::<foo>() , 4usize , concat ! (
- "Size of: " , stringify ! ( foo ) ));
- assert_eq! (::std::mem::align_of::<foo>() , 4usize , concat ! (
- "Alignment of " , stringify ! ( foo ) ));
-}
-impl Clone for foo {
- fn clone(&self) -> Self { *self }
-}
diff --git a/tests/expectations/tests/struct_with_nesting.rs b/tests/expectations/tests/struct_with_nesting.rs
index f2bfa1a8..1a8e887d 100644
--- a/tests/expectations/tests/struct_with_nesting.rs
+++ b/tests/expectations/tests/struct_with_nesting.rs
@@ -5,17 +5,42 @@
#[repr(C)]
-#[derive(Copy)]
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy)]
pub struct foo {
pub a: ::std::os::raw::c_uint,
pub __bindgen_anon_1: foo__bindgen_ty_1,
}
#[repr(C)]
-#[derive(Copy)]
-pub union foo__bindgen_ty_1 {
- pub b: ::std::os::raw::c_uint,
- pub __bindgen_anon_1: foo__bindgen_ty_1__bindgen_ty_1,
- pub __bindgen_anon_2: foo__bindgen_ty_1__bindgen_ty_2,
+#[derive(Debug, Default, Copy)]
+pub struct foo__bindgen_ty_1 {
+ pub b: __BindgenUnionField<::std::os::raw::c_uint>,
+ pub __bindgen_anon_1: __BindgenUnionField<foo__bindgen_ty_1__bindgen_ty_1>,
+ pub __bindgen_anon_2: __BindgenUnionField<foo__bindgen_ty_1__bindgen_ty_2>,
+ pub bindgen_union_field: u32,
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
@@ -110,9 +135,6 @@ fn bindgen_test_layout_foo__bindgen_ty_1() {
impl Clone for foo__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
-impl Default for foo__bindgen_ty_1 {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
#[test]
fn bindgen_test_layout_foo() {
assert_eq!(::std::mem::size_of::<foo>() , 8usize , concat ! (
@@ -128,6 +150,3 @@ fn bindgen_test_layout_foo() {
impl Clone for foo {
fn clone(&self) -> Self { *self }
}
-impl Default for foo {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
diff --git a/tests/expectations/tests/struct_with_nesting_1_0.rs b/tests/expectations/tests/struct_with_nesting_1_0.rs
deleted file mode 100644
index 1a8e887d..00000000
--- a/tests/expectations/tests/struct_with_nesting_1_0.rs
+++ /dev/null
@@ -1,152 +0,0 @@
-/* automatically generated by rust-bindgen */
-
-
-#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-
-
-#[repr(C)]
-pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
-impl <T> __BindgenUnionField<T> {
- #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
- #[inline]
- fn default() -> Self { Self::new() }
-}
-impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
- #[inline]
- fn clone(&self) -> Self { Self::new() }
-}
-impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
-impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
- fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
- fmt.write_str("__BindgenUnionField")
- }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct foo {
- pub a: ::std::os::raw::c_uint,
- pub __bindgen_anon_1: foo__bindgen_ty_1,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct foo__bindgen_ty_1 {
- pub b: __BindgenUnionField<::std::os::raw::c_uint>,
- pub __bindgen_anon_1: __BindgenUnionField<foo__bindgen_ty_1__bindgen_ty_1>,
- pub __bindgen_anon_2: __BindgenUnionField<foo__bindgen_ty_1__bindgen_ty_2>,
- pub bindgen_union_field: u32,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct foo__bindgen_ty_1__bindgen_ty_1 {
- pub c1: ::std::os::raw::c_ushort,
- pub c2: ::std::os::raw::c_ushort,
-}
-#[test]
-fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_1() {
- assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1__bindgen_ty_1>() ,
- 4usize , concat ! (
- "Size of: " , stringify ! ( foo__bindgen_ty_1__bindgen_ty_1 )
- ));
- assert_eq! (::std::mem::align_of::<foo__bindgen_ty_1__bindgen_ty_1>() ,
- 2usize , concat ! (
- "Alignment of " , stringify ! (
- foo__bindgen_ty_1__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1__bindgen_ty_1 ) ) . c1
- as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- foo__bindgen_ty_1__bindgen_ty_1 ) , "::" , stringify ! ( c1 )
- ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1__bindgen_ty_1 ) ) . c2
- as * const _ as usize } , 2usize , concat ! (
- "Alignment of field: " , stringify ! (
- foo__bindgen_ty_1__bindgen_ty_1 ) , "::" , stringify ! ( c2 )
- ));
-}
-impl Clone for foo__bindgen_ty_1__bindgen_ty_1 {
- fn clone(&self) -> Self { *self }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct foo__bindgen_ty_1__bindgen_ty_2 {
- pub d1: ::std::os::raw::c_uchar,
- pub d2: ::std::os::raw::c_uchar,
- pub d3: ::std::os::raw::c_uchar,
- pub d4: ::std::os::raw::c_uchar,
-}
-#[test]
-fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() {
- assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1__bindgen_ty_2>() ,
- 4usize , concat ! (
- "Size of: " , stringify ! ( foo__bindgen_ty_1__bindgen_ty_2 )
- ));
- assert_eq! (::std::mem::align_of::<foo__bindgen_ty_1__bindgen_ty_2>() ,
- 1usize , concat ! (
- "Alignment of " , stringify ! (
- foo__bindgen_ty_1__bindgen_ty_2 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1__bindgen_ty_2 ) ) . d1
- as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- foo__bindgen_ty_1__bindgen_ty_2 ) , "::" , stringify ! ( d1 )
- ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1__bindgen_ty_2 ) ) . d2
- as * const _ as usize } , 1usize , concat ! (
- "Alignment of field: " , stringify ! (
- foo__bindgen_ty_1__bindgen_ty_2 ) , "::" , stringify ! ( d2 )
- ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1__bindgen_ty_2 ) ) . d3
- as * const _ as usize } , 2usize , concat ! (
- "Alignment of field: " , stringify ! (
- foo__bindgen_ty_1__bindgen_ty_2 ) , "::" , stringify ! ( d3 )
- ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1__bindgen_ty_2 ) ) . d4
- as * const _ as usize } , 3usize , concat ! (
- "Alignment of field: " , stringify ! (
- foo__bindgen_ty_1__bindgen_ty_2 ) , "::" , stringify ! ( d4 )
- ));
-}
-impl Clone for foo__bindgen_ty_1__bindgen_ty_2 {
- fn clone(&self) -> Self { *self }
-}
-#[test]
-fn bindgen_test_layout_foo__bindgen_ty_1() {
- assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 4usize , concat !
- ( "Size of: " , stringify ! ( foo__bindgen_ty_1 ) ));
- assert_eq! (::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize , concat
- ! ( "Alignment of " , stringify ! ( foo__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1 ) ) . b as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo__bindgen_ty_1 ) ,
- "::" , stringify ! ( b ) ));
-}
-impl Clone for foo__bindgen_ty_1 {
- fn clone(&self) -> Self { *self }
-}
-#[test]
-fn bindgen_test_layout_foo() {
- assert_eq!(::std::mem::size_of::<foo>() , 8usize , concat ! (
- "Size of: " , stringify ! ( foo ) ));
- assert_eq! (::std::mem::align_of::<foo>() , 4usize , concat ! (
- "Alignment of " , stringify ! ( foo ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo ) ) . a as * const _ as usize } ,
- 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo ) , "::" ,
- stringify ! ( a ) ));
-}
-impl Clone for foo {
- fn clone(&self) -> Self { *self }
-}
diff --git a/tests/expectations/tests/typeref.rs b/tests/expectations/tests/typeref.rs
index 4550efee..53119f09 100644
--- a/tests/expectations/tests/typeref.rs
+++ b/tests/expectations/tests/typeref.rs
@@ -5,6 +5,31 @@
#[repr(C)]
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy)]
pub struct nsFoo {
pub mBar: mozilla_StyleShapeSource,
}
@@ -20,8 +45,8 @@ fn bindgen_test_layout_nsFoo() {
"Alignment of field: " , stringify ! ( nsFoo ) , "::" ,
stringify ! ( mBar ) ));
}
-impl Default for nsFoo {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+impl Clone for nsFoo {
+ fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
@@ -61,19 +86,16 @@ impl Clone for mozilla_Position {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct mozilla_StyleShapeSource {
pub __bindgen_anon_1: mozilla_StyleShapeSource__bindgen_ty_1,
}
#[repr(C)]
-pub union mozilla_StyleShapeSource__bindgen_ty_1 {
- pub mPosition: *mut mozilla_Position,
- pub mFragmentOrURL: *mut mozilla_FragmentOrURL,
-}
-impl Default for mozilla_StyleShapeSource__bindgen_ty_1 {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
-impl Default for mozilla_StyleShapeSource {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+#[derive(Debug, Default, Copy, Clone)]
+pub struct mozilla_StyleShapeSource__bindgen_ty_1 {
+ pub mPosition: __BindgenUnionField<*mut mozilla_Position>,
+ pub mFragmentOrURL: __BindgenUnionField<*mut mozilla_FragmentOrURL>,
+ pub bindgen_union_field: u64,
}
#[repr(C)]
#[derive(Debug, Copy)]
diff --git a/tests/expectations/tests/typeref_1_0.rs b/tests/expectations/tests/typeref_1_0.rs
deleted file mode 100644
index 53119f09..00000000
--- a/tests/expectations/tests/typeref_1_0.rs
+++ /dev/null
@@ -1,133 +0,0 @@
-/* automatically generated by rust-bindgen */
-
-
-#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-
-
-#[repr(C)]
-pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
-impl <T> __BindgenUnionField<T> {
- #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
- #[inline]
- fn default() -> Self { Self::new() }
-}
-impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
- #[inline]
- fn clone(&self) -> Self { Self::new() }
-}
-impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
-impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
- fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
- fmt.write_str("__BindgenUnionField")
- }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct nsFoo {
- pub mBar: mozilla_StyleShapeSource,
-}
-#[test]
-fn bindgen_test_layout_nsFoo() {
- assert_eq!(::std::mem::size_of::<nsFoo>() , 8usize , concat ! (
- "Size of: " , stringify ! ( nsFoo ) ));
- assert_eq! (::std::mem::align_of::<nsFoo>() , 8usize , concat ! (
- "Alignment of " , stringify ! ( nsFoo ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const nsFoo ) ) . mBar as * const _ as usize }
- , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( nsFoo ) , "::" ,
- stringify ! ( mBar ) ));
-}
-impl Clone for nsFoo {
- fn clone(&self) -> Self { *self }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct mozilla_FragmentOrURL {
- pub mIsLocalRef: bool,
-}
-#[test]
-fn bindgen_test_layout_mozilla_FragmentOrURL() {
- assert_eq!(::std::mem::size_of::<mozilla_FragmentOrURL>() , 1usize ,
- concat ! ( "Size of: " , stringify ! ( mozilla_FragmentOrURL )
- ));
- assert_eq! (::std::mem::align_of::<mozilla_FragmentOrURL>() , 1usize ,
- concat ! (
- "Alignment of " , stringify ! ( mozilla_FragmentOrURL ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const mozilla_FragmentOrURL ) ) . mIsLocalRef
- as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( mozilla_FragmentOrURL )
- , "::" , stringify ! ( mIsLocalRef ) ));
-}
-impl Clone for mozilla_FragmentOrURL {
- fn clone(&self) -> Self { *self }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct mozilla_Position {
- pub _address: u8,
-}
-#[test]
-fn bindgen_test_layout_mozilla_Position() {
- assert_eq!(::std::mem::size_of::<mozilla_Position>() , 1usize , concat ! (
- "Size of: " , stringify ! ( mozilla_Position ) ));
- assert_eq! (::std::mem::align_of::<mozilla_Position>() , 1usize , concat !
- ( "Alignment of " , stringify ! ( mozilla_Position ) ));
-}
-impl Clone for mozilla_Position {
- fn clone(&self) -> Self { *self }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
-pub struct mozilla_StyleShapeSource {
- pub __bindgen_anon_1: mozilla_StyleShapeSource__bindgen_ty_1,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
-pub struct mozilla_StyleShapeSource__bindgen_ty_1 {
- pub mPosition: __BindgenUnionField<*mut mozilla_Position>,
- pub mFragmentOrURL: __BindgenUnionField<*mut mozilla_FragmentOrURL>,
- pub bindgen_union_field: u64,
-}
-#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct Bar {
- pub mFoo: *mut nsFoo,
-}
-#[test]
-fn bindgen_test_layout_Bar() {
- assert_eq!(::std::mem::size_of::<Bar>() , 8usize , concat ! (
- "Size of: " , stringify ! ( Bar ) ));
- assert_eq! (::std::mem::align_of::<Bar>() , 8usize , concat ! (
- "Alignment of " , stringify ! ( Bar ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const Bar ) ) . mFoo as * const _ as usize } ,
- 0usize , concat ! (
- "Alignment of field: " , stringify ! ( Bar ) , "::" ,
- stringify ! ( mFoo ) ));
-}
-impl Clone for Bar {
- fn clone(&self) -> Self { *self }
-}
-impl Default for Bar {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
-#[test]
-fn __bindgen_test_layout_mozilla_StyleShapeSource_open0_int_close0_instantiation() {
- assert_eq!(::std::mem::size_of::<mozilla_StyleShapeSource>() , 8usize ,
- concat ! (
- "Size of template specialization: " , stringify ! (
- mozilla_StyleShapeSource ) ));
- assert_eq!(::std::mem::align_of::<mozilla_StyleShapeSource>() , 8usize ,
- concat ! (
- "Alignment of template specialization: " , stringify ! (
- mozilla_StyleShapeSource ) ));
-}
diff --git a/tests/expectations/tests/union-in-ns.rs b/tests/expectations/tests/union-in-ns.rs
index 0151d434..8beb7a92 100644
--- a/tests/expectations/tests/union-in-ns.rs
+++ b/tests/expectations/tests/union-in-ns.rs
@@ -6,12 +6,41 @@
#[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]
pub mod root {
+ #[repr(C)]
+ pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+ impl <T> __BindgenUnionField<T> {
+ #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+ }
+ impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+ }
+ impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+ impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+ }
#[allow(unused_imports)]
use self::super::root;
#[repr(C)]
- #[derive(Copy)]
- pub union bar {
- pub baz: ::std::os::raw::c_int,
+ #[derive(Debug, Default, Copy)]
+ pub struct bar {
+ pub baz: root::__BindgenUnionField<::std::os::raw::c_int>,
+ pub bindgen_union_field: u32,
}
#[test]
fn bindgen_test_layout_bar() {
@@ -28,7 +57,4 @@ pub mod root {
impl Clone for bar {
fn clone(&self) -> Self { *self }
}
- impl Default for bar {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
- }
}
diff --git a/tests/expectations/tests/union-in-ns_1_0.rs b/tests/expectations/tests/union-in-ns_1_0.rs
deleted file mode 100644
index 8beb7a92..00000000
--- a/tests/expectations/tests/union-in-ns_1_0.rs
+++ /dev/null
@@ -1,60 +0,0 @@
-/* automatically generated by rust-bindgen */
-
-
-#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-
-
-#[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]
-pub mod root {
- #[repr(C)]
- pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
- impl <T> __BindgenUnionField<T> {
- #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
- #[inline]
- fn default() -> Self { Self::new() }
- }
- impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
- #[inline]
- fn clone(&self) -> Self { Self::new() }
- }
- impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
- impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
- fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
- fmt.write_str("__BindgenUnionField")
- }
- }
- #[allow(unused_imports)]
- use self::super::root;
- #[repr(C)]
- #[derive(Debug, Default, Copy)]
- pub struct bar {
- pub baz: root::__BindgenUnionField<::std::os::raw::c_int>,
- pub bindgen_union_field: u32,
- }
- #[test]
- fn bindgen_test_layout_bar() {
- assert_eq!(::std::mem::size_of::<bar>() , 4usize , concat ! (
- "Size of: " , stringify ! ( bar ) ));
- assert_eq! (::std::mem::align_of::<bar>() , 4usize , concat ! (
- "Alignment of " , stringify ! ( bar ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const bar ) ) . baz as * const _ as usize }
- , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( bar ) , "::" ,
- stringify ! ( baz ) ));
- }
- impl Clone for bar {
- fn clone(&self) -> Self { *self }
- }
-}
diff --git a/tests/expectations/tests/union_dtor.rs b/tests/expectations/tests/union_dtor.rs
index d33f4b07..429ec082 100644
--- a/tests/expectations/tests/union_dtor.rs
+++ b/tests/expectations/tests/union_dtor.rs
@@ -5,9 +5,35 @@
#[repr(C)]
-pub union UnionWithDtor {
- pub mFoo: ::std::os::raw::c_int,
- pub mBar: *mut ::std::os::raw::c_void,
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+#[repr(C)]
+#[derive(Debug, Default)]
+pub struct UnionWithDtor {
+ pub mFoo: __BindgenUnionField<::std::os::raw::c_int>,
+ pub mBar: __BindgenUnionField<*mut ::std::os::raw::c_void>,
+ pub bindgen_union_field: u64,
}
#[test]
fn bindgen_test_layout_UnionWithDtor() {
@@ -30,9 +56,6 @@ extern "C" {
#[link_name = "_ZN13UnionWithDtorD1Ev"]
pub fn UnionWithDtor_UnionWithDtor_destructor(this: *mut UnionWithDtor);
}
-impl Default for UnionWithDtor {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
impl UnionWithDtor {
#[inline]
pub unsafe fn destruct(&mut self) {
diff --git a/tests/expectations/tests/union_dtor_1_0.rs b/tests/expectations/tests/union_dtor_1_0.rs
deleted file mode 100644
index 429ec082..00000000
--- a/tests/expectations/tests/union_dtor_1_0.rs
+++ /dev/null
@@ -1,64 +0,0 @@
-/* automatically generated by rust-bindgen */
-
-
-#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-
-
-#[repr(C)]
-pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
-impl <T> __BindgenUnionField<T> {
- #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
- #[inline]
- fn default() -> Self { Self::new() }
-}
-impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
- #[inline]
- fn clone(&self) -> Self { Self::new() }
-}
-impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
-impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
- fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
- fmt.write_str("__BindgenUnionField")
- }
-}
-#[repr(C)]
-#[derive(Debug, Default)]
-pub struct UnionWithDtor {
- pub mFoo: __BindgenUnionField<::std::os::raw::c_int>,
- pub mBar: __BindgenUnionField<*mut ::std::os::raw::c_void>,
- pub bindgen_union_field: u64,
-}
-#[test]
-fn bindgen_test_layout_UnionWithDtor() {
- assert_eq!(::std::mem::size_of::<UnionWithDtor>() , 8usize , concat ! (
- "Size of: " , stringify ! ( UnionWithDtor ) ));
- assert_eq! (::std::mem::align_of::<UnionWithDtor>() , 8usize , concat ! (
- "Alignment of " , stringify ! ( UnionWithDtor ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const UnionWithDtor ) ) . mFoo as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( UnionWithDtor ) , "::"
- , stringify ! ( mFoo ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const UnionWithDtor ) ) . mBar as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( UnionWithDtor ) , "::"
- , stringify ! ( mBar ) ));
-}
-extern "C" {
- #[link_name = "_ZN13UnionWithDtorD1Ev"]
- pub fn UnionWithDtor_UnionWithDtor_destructor(this: *mut UnionWithDtor);
-}
-impl UnionWithDtor {
- #[inline]
- pub unsafe fn destruct(&mut self) {
- UnionWithDtor_UnionWithDtor_destructor(self)
- }
-}
diff --git a/tests/expectations/tests/union_fields.rs b/tests/expectations/tests/union_fields.rs
index 9d1638fd..45ce6473 100644
--- a/tests/expectations/tests/union_fields.rs
+++ b/tests/expectations/tests/union_fields.rs
@@ -5,11 +5,36 @@
#[repr(C)]
-#[derive(Copy)]
-pub union nsStyleUnion {
- pub mInt: ::std::os::raw::c_int,
- pub mFloat: f32,
- pub mPointer: *mut ::std::os::raw::c_void,
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy)]
+pub struct nsStyleUnion {
+ pub mInt: __BindgenUnionField<::std::os::raw::c_int>,
+ pub mFloat: __BindgenUnionField<f32>,
+ pub mPointer: __BindgenUnionField<*mut ::std::os::raw::c_void>,
+ pub bindgen_union_field: u64,
}
#[test]
fn bindgen_test_layout_nsStyleUnion() {
@@ -36,6 +61,3 @@ fn bindgen_test_layout_nsStyleUnion() {
impl Clone for nsStyleUnion {
fn clone(&self) -> Self { *self }
}
-impl Default for nsStyleUnion {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
diff --git a/tests/expectations/tests/union_fields_1_0.rs b/tests/expectations/tests/union_fields_1_0.rs
deleted file mode 100644
index 45ce6473..00000000
--- a/tests/expectations/tests/union_fields_1_0.rs
+++ /dev/null
@@ -1,63 +0,0 @@
-/* automatically generated by rust-bindgen */
-
-
-#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-
-
-#[repr(C)]
-pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
-impl <T> __BindgenUnionField<T> {
- #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
- #[inline]
- fn default() -> Self { Self::new() }
-}
-impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
- #[inline]
- fn clone(&self) -> Self { Self::new() }
-}
-impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
-impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
- fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
- fmt.write_str("__BindgenUnionField")
- }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct nsStyleUnion {
- pub mInt: __BindgenUnionField<::std::os::raw::c_int>,
- pub mFloat: __BindgenUnionField<f32>,
- pub mPointer: __BindgenUnionField<*mut ::std::os::raw::c_void>,
- pub bindgen_union_field: u64,
-}
-#[test]
-fn bindgen_test_layout_nsStyleUnion() {
- assert_eq!(::std::mem::size_of::<nsStyleUnion>() , 8usize , concat ! (
- "Size of: " , stringify ! ( nsStyleUnion ) ));
- assert_eq! (::std::mem::align_of::<nsStyleUnion>() , 8usize , concat ! (
- "Alignment of " , stringify ! ( nsStyleUnion ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const nsStyleUnion ) ) . mInt as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( nsStyleUnion ) , "::" ,
- stringify ! ( mInt ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const nsStyleUnion ) ) . mFloat as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( nsStyleUnion ) , "::" ,
- stringify ! ( mFloat ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const nsStyleUnion ) ) . mPointer as * const _
- as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( nsStyleUnion ) , "::" ,
- stringify ! ( mPointer ) ));
-}
-impl Clone for nsStyleUnion {
- fn clone(&self) -> Self { *self }
-}
diff --git a/tests/expectations/tests/union_template.rs b/tests/expectations/tests/union_template.rs
index ae854042..7f30e7b4 100644
--- a/tests/expectations/tests/union_template.rs
+++ b/tests/expectations/tests/union_template.rs
@@ -5,35 +5,54 @@
#[repr(C)]
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy, Clone)]
pub struct NastyStruct {
pub mIsSome: bool,
pub mStorage: NastyStruct__bindgen_ty_1,
pub __bindgen_anon_1: NastyStruct__bindgen_ty_2,
}
#[repr(C)]
-pub union NastyStruct__bindgen_ty_1 {
- pub mFoo: *mut ::std::os::raw::c_void,
- pub mDummy: ::std::os::raw::c_ulong,
-}
-impl Default for NastyStruct__bindgen_ty_1 {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+#[derive(Debug, Default, Copy, Clone)]
+pub struct NastyStruct__bindgen_ty_1 {
+ pub mFoo: __BindgenUnionField<*mut ::std::os::raw::c_void>,
+ pub mDummy: __BindgenUnionField<::std::os::raw::c_ulong>,
+ pub bindgen_union_field: u64,
}
#[repr(C)]
-pub union NastyStruct__bindgen_ty_2 {
- pub wat: ::std::os::raw::c_short,
- pub wut: *mut ::std::os::raw::c_int,
-}
-impl Default for NastyStruct__bindgen_ty_2 {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
-impl Default for NastyStruct {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+#[derive(Debug, Default, Copy, Clone)]
+pub struct NastyStruct__bindgen_ty_2 {
+ pub wat: __BindgenUnionField<::std::os::raw::c_short>,
+ pub wut: __BindgenUnionField<*mut ::std::os::raw::c_int>,
+ pub bindgen_union_field: u64,
}
#[repr(C)]
-pub union Whatever {
- pub mTPtr: *mut ::std::os::raw::c_void,
- pub mInt: ::std::os::raw::c_int,
-}
-impl Default for Whatever {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+#[derive(Debug, Default, Copy, Clone)]
+pub struct Whatever {
+ pub mTPtr: __BindgenUnionField<*mut ::std::os::raw::c_void>,
+ pub mInt: __BindgenUnionField<::std::os::raw::c_int>,
+ pub bindgen_union_field: u64,
}
diff --git a/tests/expectations/tests/union_template_1_0.rs b/tests/expectations/tests/union_template_1_0.rs
deleted file mode 100644
index 7f30e7b4..00000000
--- a/tests/expectations/tests/union_template_1_0.rs
+++ /dev/null
@@ -1,58 +0,0 @@
-/* automatically generated by rust-bindgen */
-
-
-#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-
-
-#[repr(C)]
-pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
-impl <T> __BindgenUnionField<T> {
- #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
- #[inline]
- fn default() -> Self { Self::new() }
-}
-impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
- #[inline]
- fn clone(&self) -> Self { Self::new() }
-}
-impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
-impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
- fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
- fmt.write_str("__BindgenUnionField")
- }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
-pub struct NastyStruct {
- pub mIsSome: bool,
- pub mStorage: NastyStruct__bindgen_ty_1,
- pub __bindgen_anon_1: NastyStruct__bindgen_ty_2,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
-pub struct NastyStruct__bindgen_ty_1 {
- pub mFoo: __BindgenUnionField<*mut ::std::os::raw::c_void>,
- pub mDummy: __BindgenUnionField<::std::os::raw::c_ulong>,
- pub bindgen_union_field: u64,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
-pub struct NastyStruct__bindgen_ty_2 {
- pub wat: __BindgenUnionField<::std::os::raw::c_short>,
- pub wut: __BindgenUnionField<*mut ::std::os::raw::c_int>,
- pub bindgen_union_field: u64,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy, Clone)]
-pub struct Whatever {
- pub mTPtr: __BindgenUnionField<*mut ::std::os::raw::c_void>,
- pub mInt: __BindgenUnionField<::std::os::raw::c_int>,
- pub bindgen_union_field: u64,
-}
diff --git a/tests/expectations/tests/union_with_anon_struct.rs b/tests/expectations/tests/union_with_anon_struct.rs
index c6237512..f0bb68d5 100644
--- a/tests/expectations/tests/union_with_anon_struct.rs
+++ b/tests/expectations/tests/union_with_anon_struct.rs
@@ -5,9 +5,34 @@
#[repr(C)]
-#[derive(Copy)]
-pub union foo {
- pub bar: foo__bindgen_ty_1,
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy)]
+pub struct foo {
+ pub bar: __BindgenUnionField<foo__bindgen_ty_1>,
+ pub bindgen_union_field: [u32; 2usize],
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
@@ -50,6 +75,3 @@ fn bindgen_test_layout_foo() {
impl Clone for foo {
fn clone(&self) -> Self { *self }
}
-impl Default for foo {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
diff --git a/tests/expectations/tests/union_with_anon_struct_1_0.rs b/tests/expectations/tests/union_with_anon_struct_1_0.rs
deleted file mode 100644
index f0bb68d5..00000000
--- a/tests/expectations/tests/union_with_anon_struct_1_0.rs
+++ /dev/null
@@ -1,77 +0,0 @@
-/* automatically generated by rust-bindgen */
-
-
-#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-
-
-#[repr(C)]
-pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
-impl <T> __BindgenUnionField<T> {
- #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
- #[inline]
- fn default() -> Self { Self::new() }
-}
-impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
- #[inline]
- fn clone(&self) -> Self { Self::new() }
-}
-impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
-impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
- fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
- fmt.write_str("__BindgenUnionField")
- }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct foo {
- pub bar: __BindgenUnionField<foo__bindgen_ty_1>,
- pub bindgen_union_field: [u32; 2usize],
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct foo__bindgen_ty_1 {
- pub a: ::std::os::raw::c_uint,
- pub b: ::std::os::raw::c_uint,
-}
-#[test]
-fn bindgen_test_layout_foo__bindgen_ty_1() {
- assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 8usize , concat !
- ( "Size of: " , stringify ! ( foo__bindgen_ty_1 ) ));
- assert_eq! (::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize , concat
- ! ( "Alignment of " , stringify ! ( foo__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1 ) ) . a as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo__bindgen_ty_1 ) ,
- "::" , stringify ! ( a ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1 ) ) . b as * const _ as
- usize } , 4usize , concat ! (
- "Alignment of field: " , stringify ! ( foo__bindgen_ty_1 ) ,
- "::" , stringify ! ( b ) ));
-}
-impl Clone for foo__bindgen_ty_1 {
- fn clone(&self) -> Self { *self }
-}
-#[test]
-fn bindgen_test_layout_foo() {
- assert_eq!(::std::mem::size_of::<foo>() , 8usize , concat ! (
- "Size of: " , stringify ! ( foo ) ));
- assert_eq! (::std::mem::align_of::<foo>() , 4usize , concat ! (
- "Alignment of " , stringify ! ( foo ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo ) ) . bar as * const _ as usize } ,
- 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo ) , "::" ,
- stringify ! ( bar ) ));
-}
-impl Clone for foo {
- fn clone(&self) -> Self { *self }
-}
diff --git a/tests/expectations/tests/union_with_anon_struct_bitfield.rs b/tests/expectations/tests/union_with_anon_struct_bitfield.rs
index 9679e092..e6acd105 100644
--- a/tests/expectations/tests/union_with_anon_struct_bitfield.rs
+++ b/tests/expectations/tests/union_with_anon_struct_bitfield.rs
@@ -5,10 +5,35 @@
#[repr(C)]
-#[derive(Copy)]
-pub union foo {
- pub a: ::std::os::raw::c_int,
- pub __bindgen_anon_1: foo__bindgen_ty_1,
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy)]
+pub struct foo {
+ pub a: __BindgenUnionField<::std::os::raw::c_int>,
+ pub __bindgen_anon_1: __BindgenUnionField<foo__bindgen_ty_1>,
+ pub bindgen_union_field: u32,
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
@@ -121,6 +146,3 @@ fn bindgen_test_layout_foo() {
impl Clone for foo {
fn clone(&self) -> Self { *self }
}
-impl Default for foo {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
diff --git a/tests/expectations/tests/union_with_anon_struct_bitfield_1_0.rs b/tests/expectations/tests/union_with_anon_struct_bitfield_1_0.rs
deleted file mode 100644
index e6acd105..00000000
--- a/tests/expectations/tests/union_with_anon_struct_bitfield_1_0.rs
+++ /dev/null
@@ -1,148 +0,0 @@
-/* automatically generated by rust-bindgen */
-
-
-#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-
-
-#[repr(C)]
-pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
-impl <T> __BindgenUnionField<T> {
- #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
- #[inline]
- fn default() -> Self { Self::new() }
-}
-impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
- #[inline]
- fn clone(&self) -> Self { Self::new() }
-}
-impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
-impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
- fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
- fmt.write_str("__BindgenUnionField")
- }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct foo {
- pub a: __BindgenUnionField<::std::os::raw::c_int>,
- pub __bindgen_anon_1: __BindgenUnionField<foo__bindgen_ty_1>,
- pub bindgen_union_field: u32,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct foo__bindgen_ty_1 {
- pub _bitfield_1: u32,
- pub __bindgen_align: [u32; 0usize],
-}
-#[test]
-fn bindgen_test_layout_foo__bindgen_ty_1() {
- assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 4usize , concat !
- ( "Size of: " , stringify ! ( foo__bindgen_ty_1 ) ));
- assert_eq! (::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize , concat
- ! ( "Alignment of " , stringify ! ( foo__bindgen_ty_1 ) ));
-}
-impl Clone for foo__bindgen_ty_1 {
- fn clone(&self) -> Self { *self }
-}
-impl foo__bindgen_ty_1 {
- #[inline]
- pub fn b(&self) -> ::std::os::raw::c_int {
- let mut unit_field_val: u32 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u32 as
- *mut u8,
- ::std::mem::size_of::<u32>())
- };
- let mask = 127u64 as u32;
- let val = (unit_field_val & mask) >> 0usize;
- unsafe { ::std::mem::transmute(val as u32) }
- }
- #[inline]
- pub fn set_b(&mut self, val: ::std::os::raw::c_int) {
- let mask = 127u64 as u32;
- let val = val as u32 as u32;
- let mut unit_field_val: u32 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u32 as
- *mut u8,
- ::std::mem::size_of::<u32>())
- };
- unit_field_val &= !mask;
- unit_field_val |= (val << 0usize) & mask;
- unsafe {
- ::std::ptr::copy_nonoverlapping(&unit_field_val as *const _ as
- *const u8,
- &mut self._bitfield_1 as *mut _ as
- *mut u8,
- ::std::mem::size_of::<u32>());
- }
- }
- #[inline]
- pub fn c(&self) -> ::std::os::raw::c_int {
- let mut unit_field_val: u32 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u32 as
- *mut u8,
- ::std::mem::size_of::<u32>())
- };
- let mask = 4294967168u64 as u32;
- let val = (unit_field_val & mask) >> 7usize;
- unsafe { ::std::mem::transmute(val as u32) }
- }
- #[inline]
- pub fn set_c(&mut self, val: ::std::os::raw::c_int) {
- let mask = 4294967168u64 as u32;
- let val = val as u32 as u32;
- let mut unit_field_val: u32 = unsafe { ::std::mem::uninitialized() };
- unsafe {
- ::std::ptr::copy_nonoverlapping(&self._bitfield_1 as *const _ as
- *const u8,
- &mut unit_field_val as *mut u32 as
- *mut u8,
- ::std::mem::size_of::<u32>())
- };
- unit_field_val &= !mask;
- unit_field_val |= (val << 7usize) & mask;
- unsafe {
- ::std::ptr::copy_nonoverlapping(&unit_field_val as *const _ as
- *const u8,
- &mut self._bitfield_1 as *mut _ as
- *mut u8,
- ::std::mem::size_of::<u32>());
- }
- }
- #[inline]
- pub fn new_bitfield_1(b: ::std::os::raw::c_int, c: ::std::os::raw::c_int)
- -> u32 {
- ({ ({ 0 } | ((b as u32 as u32) << 0usize) & (127u64 as u32)) } |
- ((c as u32 as u32) << 7usize) & (4294967168u64 as u32))
- }
-}
-#[test]
-fn bindgen_test_layout_foo() {
- assert_eq!(::std::mem::size_of::<foo>() , 4usize , concat ! (
- "Size of: " , stringify ! ( foo ) ));
- assert_eq! (::std::mem::align_of::<foo>() , 4usize , concat ! (
- "Alignment of " , stringify ! ( foo ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo ) ) . a as * const _ as usize } ,
- 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo ) , "::" ,
- stringify ! ( a ) ));
-}
-impl Clone for foo {
- fn clone(&self) -> Self { *self }
-}
diff --git a/tests/expectations/tests/union_with_anon_union.rs b/tests/expectations/tests/union_with_anon_union.rs
index 9f8b6713..668160a7 100644
--- a/tests/expectations/tests/union_with_anon_union.rs
+++ b/tests/expectations/tests/union_with_anon_union.rs
@@ -5,15 +5,41 @@
#[repr(C)]
-#[derive(Copy)]
-pub union foo {
- pub bar: foo__bindgen_ty_1,
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
}
#[repr(C)]
-#[derive(Copy)]
-pub union foo__bindgen_ty_1 {
- pub a: ::std::os::raw::c_uint,
- pub b: ::std::os::raw::c_ushort,
+#[derive(Debug, Default, Copy)]
+pub struct foo {
+ pub bar: __BindgenUnionField<foo__bindgen_ty_1>,
+ pub bindgen_union_field: u32,
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy)]
+pub struct foo__bindgen_ty_1 {
+ pub a: __BindgenUnionField<::std::os::raw::c_uint>,
+ pub b: __BindgenUnionField<::std::os::raw::c_ushort>,
+ pub bindgen_union_field: u32,
}
#[test]
fn bindgen_test_layout_foo__bindgen_ty_1() {
@@ -35,9 +61,6 @@ fn bindgen_test_layout_foo__bindgen_ty_1() {
impl Clone for foo__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
-impl Default for foo__bindgen_ty_1 {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
#[test]
fn bindgen_test_layout_foo() {
assert_eq!(::std::mem::size_of::<foo>() , 4usize , concat ! (
@@ -53,6 +76,3 @@ fn bindgen_test_layout_foo() {
impl Clone for foo {
fn clone(&self) -> Self { *self }
}
-impl Default for foo {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
diff --git a/tests/expectations/tests/union_with_anon_union_1_0.rs b/tests/expectations/tests/union_with_anon_union_1_0.rs
deleted file mode 100644
index 668160a7..00000000
--- a/tests/expectations/tests/union_with_anon_union_1_0.rs
+++ /dev/null
@@ -1,78 +0,0 @@
-/* automatically generated by rust-bindgen */
-
-
-#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-
-
-#[repr(C)]
-pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
-impl <T> __BindgenUnionField<T> {
- #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
- #[inline]
- fn default() -> Self { Self::new() }
-}
-impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
- #[inline]
- fn clone(&self) -> Self { Self::new() }
-}
-impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
-impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
- fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
- fmt.write_str("__BindgenUnionField")
- }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct foo {
- pub bar: __BindgenUnionField<foo__bindgen_ty_1>,
- pub bindgen_union_field: u32,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct foo__bindgen_ty_1 {
- pub a: __BindgenUnionField<::std::os::raw::c_uint>,
- pub b: __BindgenUnionField<::std::os::raw::c_ushort>,
- pub bindgen_union_field: u32,
-}
-#[test]
-fn bindgen_test_layout_foo__bindgen_ty_1() {
- assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 4usize , concat !
- ( "Size of: " , stringify ! ( foo__bindgen_ty_1 ) ));
- assert_eq! (::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize , concat
- ! ( "Alignment of " , stringify ! ( foo__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1 ) ) . a as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo__bindgen_ty_1 ) ,
- "::" , stringify ! ( a ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1 ) ) . b as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo__bindgen_ty_1 ) ,
- "::" , stringify ! ( b ) ));
-}
-impl Clone for foo__bindgen_ty_1 {
- fn clone(&self) -> Self { *self }
-}
-#[test]
-fn bindgen_test_layout_foo() {
- assert_eq!(::std::mem::size_of::<foo>() , 4usize , concat ! (
- "Size of: " , stringify ! ( foo ) ));
- assert_eq! (::std::mem::align_of::<foo>() , 4usize , concat ! (
- "Alignment of " , stringify ! ( foo ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo ) ) . bar as * const _ as usize } ,
- 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo ) , "::" ,
- stringify ! ( bar ) ));
-}
-impl Clone for foo {
- fn clone(&self) -> Self { *self }
-}
diff --git a/tests/expectations/tests/union_with_anon_unnamed_struct.rs b/tests/expectations/tests/union_with_anon_unnamed_struct.rs
index 1fbb9b07..98524422 100644
--- a/tests/expectations/tests/union_with_anon_unnamed_struct.rs
+++ b/tests/expectations/tests/union_with_anon_unnamed_struct.rs
@@ -5,10 +5,35 @@
#[repr(C)]
-#[derive(Copy)]
-pub union pixel {
- pub rgba: ::std::os::raw::c_uint,
- pub __bindgen_anon_1: pixel__bindgen_ty_1,
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy)]
+pub struct pixel {
+ pub rgba: __BindgenUnionField<::std::os::raw::c_uint>,
+ pub __bindgen_anon_1: __BindgenUnionField<pixel__bindgen_ty_1>,
+ pub bindgen_union_field: u32,
}
#[repr(C)]
#[derive(Debug, Default, Copy)]
@@ -64,6 +89,3 @@ fn bindgen_test_layout_pixel() {
impl Clone for pixel {
fn clone(&self) -> Self { *self }
}
-impl Default for pixel {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
diff --git a/tests/expectations/tests/union_with_anon_unnamed_struct_1_0.rs b/tests/expectations/tests/union_with_anon_unnamed_struct_1_0.rs
deleted file mode 100644
index 98524422..00000000
--- a/tests/expectations/tests/union_with_anon_unnamed_struct_1_0.rs
+++ /dev/null
@@ -1,91 +0,0 @@
-/* automatically generated by rust-bindgen */
-
-
-#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-
-
-#[repr(C)]
-pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
-impl <T> __BindgenUnionField<T> {
- #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
- #[inline]
- fn default() -> Self { Self::new() }
-}
-impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
- #[inline]
- fn clone(&self) -> Self { Self::new() }
-}
-impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
-impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
- fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
- fmt.write_str("__BindgenUnionField")
- }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct pixel {
- pub rgba: __BindgenUnionField<::std::os::raw::c_uint>,
- pub __bindgen_anon_1: __BindgenUnionField<pixel__bindgen_ty_1>,
- pub bindgen_union_field: u32,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct pixel__bindgen_ty_1 {
- pub r: ::std::os::raw::c_uchar,
- pub g: ::std::os::raw::c_uchar,
- pub b: ::std::os::raw::c_uchar,
- pub a: ::std::os::raw::c_uchar,
-}
-#[test]
-fn bindgen_test_layout_pixel__bindgen_ty_1() {
- assert_eq!(::std::mem::size_of::<pixel__bindgen_ty_1>() , 4usize , concat
- ! ( "Size of: " , stringify ! ( pixel__bindgen_ty_1 ) ));
- assert_eq! (::std::mem::align_of::<pixel__bindgen_ty_1>() , 1usize ,
- concat ! (
- "Alignment of " , stringify ! ( pixel__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const pixel__bindgen_ty_1 ) ) . r as * const _
- as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( pixel__bindgen_ty_1 ) ,
- "::" , stringify ! ( r ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const pixel__bindgen_ty_1 ) ) . g as * const _
- as usize } , 1usize , concat ! (
- "Alignment of field: " , stringify ! ( pixel__bindgen_ty_1 ) ,
- "::" , stringify ! ( g ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const pixel__bindgen_ty_1 ) ) . b as * const _
- as usize } , 2usize , concat ! (
- "Alignment of field: " , stringify ! ( pixel__bindgen_ty_1 ) ,
- "::" , stringify ! ( b ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const pixel__bindgen_ty_1 ) ) . a as * const _
- as usize } , 3usize , concat ! (
- "Alignment of field: " , stringify ! ( pixel__bindgen_ty_1 ) ,
- "::" , stringify ! ( a ) ));
-}
-impl Clone for pixel__bindgen_ty_1 {
- fn clone(&self) -> Self { *self }
-}
-#[test]
-fn bindgen_test_layout_pixel() {
- assert_eq!(::std::mem::size_of::<pixel>() , 4usize , concat ! (
- "Size of: " , stringify ! ( pixel ) ));
- assert_eq! (::std::mem::align_of::<pixel>() , 4usize , concat ! (
- "Alignment of " , stringify ! ( pixel ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const pixel ) ) . rgba as * const _ as usize }
- , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( pixel ) , "::" ,
- stringify ! ( rgba ) ));
-}
-impl Clone for pixel {
- fn clone(&self) -> Self { *self }
-}
diff --git a/tests/expectations/tests/union_with_anon_unnamed_union.rs b/tests/expectations/tests/union_with_anon_unnamed_union.rs
index cf7006ed..1a6f5f45 100644
--- a/tests/expectations/tests/union_with_anon_unnamed_union.rs
+++ b/tests/expectations/tests/union_with_anon_unnamed_union.rs
@@ -5,16 +5,42 @@
#[repr(C)]
-#[derive(Copy)]
-pub union foo {
- pub a: ::std::os::raw::c_uint,
- pub __bindgen_anon_1: foo__bindgen_ty_1,
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
}
#[repr(C)]
-#[derive(Copy)]
-pub union foo__bindgen_ty_1 {
- pub b: ::std::os::raw::c_ushort,
- pub c: ::std::os::raw::c_uchar,
+#[derive(Debug, Default, Copy)]
+pub struct foo {
+ pub a: __BindgenUnionField<::std::os::raw::c_uint>,
+ pub __bindgen_anon_1: __BindgenUnionField<foo__bindgen_ty_1>,
+ pub bindgen_union_field: u32,
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy)]
+pub struct foo__bindgen_ty_1 {
+ pub b: __BindgenUnionField<::std::os::raw::c_ushort>,
+ pub c: __BindgenUnionField<::std::os::raw::c_uchar>,
+ pub bindgen_union_field: u16,
}
#[test]
fn bindgen_test_layout_foo__bindgen_ty_1() {
@@ -36,9 +62,6 @@ fn bindgen_test_layout_foo__bindgen_ty_1() {
impl Clone for foo__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
-impl Default for foo__bindgen_ty_1 {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
#[test]
fn bindgen_test_layout_foo() {
assert_eq!(::std::mem::size_of::<foo>() , 4usize , concat ! (
@@ -54,6 +77,3 @@ fn bindgen_test_layout_foo() {
impl Clone for foo {
fn clone(&self) -> Self { *self }
}
-impl Default for foo {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
diff --git a/tests/expectations/tests/union_with_anon_unnamed_union_1_0.rs b/tests/expectations/tests/union_with_anon_unnamed_union_1_0.rs
deleted file mode 100644
index 1a6f5f45..00000000
--- a/tests/expectations/tests/union_with_anon_unnamed_union_1_0.rs
+++ /dev/null
@@ -1,79 +0,0 @@
-/* automatically generated by rust-bindgen */
-
-
-#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-
-
-#[repr(C)]
-pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
-impl <T> __BindgenUnionField<T> {
- #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
- #[inline]
- fn default() -> Self { Self::new() }
-}
-impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
- #[inline]
- fn clone(&self) -> Self { Self::new() }
-}
-impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
-impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
- fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
- fmt.write_str("__BindgenUnionField")
- }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct foo {
- pub a: __BindgenUnionField<::std::os::raw::c_uint>,
- pub __bindgen_anon_1: __BindgenUnionField<foo__bindgen_ty_1>,
- pub bindgen_union_field: u32,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct foo__bindgen_ty_1 {
- pub b: __BindgenUnionField<::std::os::raw::c_ushort>,
- pub c: __BindgenUnionField<::std::os::raw::c_uchar>,
- pub bindgen_union_field: u16,
-}
-#[test]
-fn bindgen_test_layout_foo__bindgen_ty_1() {
- assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 2usize , concat !
- ( "Size of: " , stringify ! ( foo__bindgen_ty_1 ) ));
- assert_eq! (::std::mem::align_of::<foo__bindgen_ty_1>() , 2usize , concat
- ! ( "Alignment of " , stringify ! ( foo__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1 ) ) . b as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo__bindgen_ty_1 ) ,
- "::" , stringify ! ( b ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1 ) ) . c as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo__bindgen_ty_1 ) ,
- "::" , stringify ! ( c ) ));
-}
-impl Clone for foo__bindgen_ty_1 {
- fn clone(&self) -> Self { *self }
-}
-#[test]
-fn bindgen_test_layout_foo() {
- assert_eq!(::std::mem::size_of::<foo>() , 4usize , concat ! (
- "Size of: " , stringify ! ( foo ) ));
- assert_eq! (::std::mem::align_of::<foo>() , 4usize , concat ! (
- "Alignment of " , stringify ! ( foo ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo ) ) . a as * const _ as usize } ,
- 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo ) , "::" ,
- stringify ! ( a ) ));
-}
-impl Clone for foo {
- fn clone(&self) -> Self { *self }
-}
diff --git a/tests/expectations/tests/union_with_big_member.rs b/tests/expectations/tests/union_with_big_member.rs
index c500ff75..679832fd 100644
--- a/tests/expectations/tests/union_with_big_member.rs
+++ b/tests/expectations/tests/union_with_big_member.rs
@@ -5,10 +5,35 @@
#[repr(C)]
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+#[repr(C)]
#[derive(Copy)]
-pub union WithBigArray {
- pub a: ::std::os::raw::c_int,
- pub b: [::std::os::raw::c_int; 33usize],
+pub struct WithBigArray {
+ pub a: __BindgenUnionField<::std::os::raw::c_int>,
+ pub b: __BindgenUnionField<[::std::os::raw::c_int; 33usize]>,
+ pub bindgen_union_field: [u32; 33usize],
}
#[test]
fn bindgen_test_layout_WithBigArray() {
@@ -34,10 +59,11 @@ impl Default for WithBigArray {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Copy)]
-pub union WithBigArray2 {
- pub a: ::std::os::raw::c_int,
- pub b: [::std::os::raw::c_char; 33usize],
+#[derive(Debug, Default, Copy)]
+pub struct WithBigArray2 {
+ pub a: __BindgenUnionField<::std::os::raw::c_int>,
+ pub b: __BindgenUnionField<[::std::os::raw::c_char; 33usize]>,
+ pub bindgen_union_field: [u32; 9usize],
}
#[test]
fn bindgen_test_layout_WithBigArray2() {
@@ -59,14 +85,12 @@ fn bindgen_test_layout_WithBigArray2() {
impl Clone for WithBigArray2 {
fn clone(&self) -> Self { *self }
}
-impl Default for WithBigArray2 {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
#[repr(C)]
#[derive(Copy)]
-pub union WithBigMember {
- pub a: ::std::os::raw::c_int,
- pub b: WithBigArray,
+pub struct WithBigMember {
+ pub a: __BindgenUnionField<::std::os::raw::c_int>,
+ pub b: __BindgenUnionField<WithBigArray>,
+ pub bindgen_union_field: [u32; 33usize],
}
#[test]
fn bindgen_test_layout_WithBigMember() {
diff --git a/tests/expectations/tests/union_with_big_member_1_0.rs b/tests/expectations/tests/union_with_big_member_1_0.rs
deleted file mode 100644
index 679832fd..00000000
--- a/tests/expectations/tests/union_with_big_member_1_0.rs
+++ /dev/null
@@ -1,117 +0,0 @@
-/* automatically generated by rust-bindgen */
-
-
-#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-
-
-#[repr(C)]
-pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
-impl <T> __BindgenUnionField<T> {
- #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
- #[inline]
- fn default() -> Self { Self::new() }
-}
-impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
- #[inline]
- fn clone(&self) -> Self { Self::new() }
-}
-impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
-impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
- fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
- fmt.write_str("__BindgenUnionField")
- }
-}
-#[repr(C)]
-#[derive(Copy)]
-pub struct WithBigArray {
- pub a: __BindgenUnionField<::std::os::raw::c_int>,
- pub b: __BindgenUnionField<[::std::os::raw::c_int; 33usize]>,
- pub bindgen_union_field: [u32; 33usize],
-}
-#[test]
-fn bindgen_test_layout_WithBigArray() {
- assert_eq!(::std::mem::size_of::<WithBigArray>() , 132usize , concat ! (
- "Size of: " , stringify ! ( WithBigArray ) ));
- assert_eq! (::std::mem::align_of::<WithBigArray>() , 4usize , concat ! (
- "Alignment of " , stringify ! ( WithBigArray ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const WithBigArray ) ) . a as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( WithBigArray ) , "::" ,
- stringify ! ( a ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const WithBigArray ) ) . b as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( WithBigArray ) , "::" ,
- stringify ! ( b ) ));
-}
-impl Clone for WithBigArray {
- fn clone(&self) -> Self { *self }
-}
-impl Default for WithBigArray {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct WithBigArray2 {
- pub a: __BindgenUnionField<::std::os::raw::c_int>,
- pub b: __BindgenUnionField<[::std::os::raw::c_char; 33usize]>,
- pub bindgen_union_field: [u32; 9usize],
-}
-#[test]
-fn bindgen_test_layout_WithBigArray2() {
- assert_eq!(::std::mem::size_of::<WithBigArray2>() , 36usize , concat ! (
- "Size of: " , stringify ! ( WithBigArray2 ) ));
- assert_eq! (::std::mem::align_of::<WithBigArray2>() , 4usize , concat ! (
- "Alignment of " , stringify ! ( WithBigArray2 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const WithBigArray2 ) ) . a as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( WithBigArray2 ) , "::"
- , stringify ! ( a ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const WithBigArray2 ) ) . b as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( WithBigArray2 ) , "::"
- , stringify ! ( b ) ));
-}
-impl Clone for WithBigArray2 {
- fn clone(&self) -> Self { *self }
-}
-#[repr(C)]
-#[derive(Copy)]
-pub struct WithBigMember {
- pub a: __BindgenUnionField<::std::os::raw::c_int>,
- pub b: __BindgenUnionField<WithBigArray>,
- pub bindgen_union_field: [u32; 33usize],
-}
-#[test]
-fn bindgen_test_layout_WithBigMember() {
- assert_eq!(::std::mem::size_of::<WithBigMember>() , 132usize , concat ! (
- "Size of: " , stringify ! ( WithBigMember ) ));
- assert_eq! (::std::mem::align_of::<WithBigMember>() , 4usize , concat ! (
- "Alignment of " , stringify ! ( WithBigMember ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const WithBigMember ) ) . a as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( WithBigMember ) , "::"
- , stringify ! ( a ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const WithBigMember ) ) . b as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( WithBigMember ) , "::"
- , stringify ! ( b ) ));
-}
-impl Clone for WithBigMember {
- fn clone(&self) -> Self { *self }
-}
-impl Default for WithBigMember {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
diff --git a/tests/expectations/tests/union_with_nesting.rs b/tests/expectations/tests/union_with_nesting.rs
index 82f22a24..7e32f0c0 100644
--- a/tests/expectations/tests/union_with_nesting.rs
+++ b/tests/expectations/tests/union_with_nesting.rs
@@ -5,22 +5,48 @@
#[repr(C)]
-#[derive(Copy)]
-pub union foo {
- pub a: ::std::os::raw::c_uint,
- pub __bindgen_anon_1: foo__bindgen_ty_1,
+pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
}
#[repr(C)]
-#[derive(Copy)]
+#[derive(Debug, Default, Copy)]
+pub struct foo {
+ pub a: __BindgenUnionField<::std::os::raw::c_uint>,
+ pub __bindgen_anon_1: __BindgenUnionField<foo__bindgen_ty_1>,
+ pub bindgen_union_field: u32,
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy)]
pub struct foo__bindgen_ty_1 {
pub __bindgen_anon_1: foo__bindgen_ty_1__bindgen_ty_1,
pub __bindgen_anon_2: foo__bindgen_ty_1__bindgen_ty_2,
}
#[repr(C)]
-#[derive(Copy)]
-pub union foo__bindgen_ty_1__bindgen_ty_1 {
- pub b1: ::std::os::raw::c_ushort,
- pub b2: ::std::os::raw::c_ushort,
+#[derive(Debug, Default, Copy)]
+pub struct foo__bindgen_ty_1__bindgen_ty_1 {
+ pub b1: __BindgenUnionField<::std::os::raw::c_ushort>,
+ pub b2: __BindgenUnionField<::std::os::raw::c_ushort>,
+ pub bindgen_union_field: u16,
}
#[test]
fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_1() {
@@ -48,14 +74,12 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_1() {
impl Clone for foo__bindgen_ty_1__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
-impl Default for foo__bindgen_ty_1__bindgen_ty_1 {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
#[repr(C)]
-#[derive(Copy)]
-pub union foo__bindgen_ty_1__bindgen_ty_2 {
- pub c1: ::std::os::raw::c_ushort,
- pub c2: ::std::os::raw::c_ushort,
+#[derive(Debug, Default, Copy)]
+pub struct foo__bindgen_ty_1__bindgen_ty_2 {
+ pub c1: __BindgenUnionField<::std::os::raw::c_ushort>,
+ pub c2: __BindgenUnionField<::std::os::raw::c_ushort>,
+ pub bindgen_union_field: u16,
}
#[test]
fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() {
@@ -83,9 +107,6 @@ fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() {
impl Clone for foo__bindgen_ty_1__bindgen_ty_2 {
fn clone(&self) -> Self { *self }
}
-impl Default for foo__bindgen_ty_1__bindgen_ty_2 {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
#[test]
fn bindgen_test_layout_foo__bindgen_ty_1() {
assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 4usize , concat !
@@ -96,9 +117,6 @@ fn bindgen_test_layout_foo__bindgen_ty_1() {
impl Clone for foo__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
-impl Default for foo__bindgen_ty_1 {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
#[test]
fn bindgen_test_layout_foo() {
assert_eq!(::std::mem::size_of::<foo>() , 4usize , concat ! (
@@ -114,6 +132,3 @@ fn bindgen_test_layout_foo() {
impl Clone for foo {
fn clone(&self) -> Self { *self }
}
-impl Default for foo {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
diff --git a/tests/expectations/tests/union_with_nesting_1_0.rs b/tests/expectations/tests/union_with_nesting_1_0.rs
deleted file mode 100644
index 7e32f0c0..00000000
--- a/tests/expectations/tests/union_with_nesting_1_0.rs
+++ /dev/null
@@ -1,134 +0,0 @@
-/* automatically generated by rust-bindgen */
-
-
-#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-
-
-#[repr(C)]
-pub struct __BindgenUnionField<T>(::std::marker::PhantomData<T>);
-impl <T> __BindgenUnionField<T> {
- #[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 <T> ::std::default::Default for __BindgenUnionField<T> {
- #[inline]
- fn default() -> Self { Self::new() }
-}
-impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
- #[inline]
- fn clone(&self) -> Self { Self::new() }
-}
-impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
-impl <T> ::std::fmt::Debug for __BindgenUnionField<T> {
- fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
- fmt.write_str("__BindgenUnionField")
- }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct foo {
- pub a: __BindgenUnionField<::std::os::raw::c_uint>,
- pub __bindgen_anon_1: __BindgenUnionField<foo__bindgen_ty_1>,
- pub bindgen_union_field: u32,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct foo__bindgen_ty_1 {
- pub __bindgen_anon_1: foo__bindgen_ty_1__bindgen_ty_1,
- pub __bindgen_anon_2: foo__bindgen_ty_1__bindgen_ty_2,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct foo__bindgen_ty_1__bindgen_ty_1 {
- pub b1: __BindgenUnionField<::std::os::raw::c_ushort>,
- pub b2: __BindgenUnionField<::std::os::raw::c_ushort>,
- pub bindgen_union_field: u16,
-}
-#[test]
-fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_1() {
- assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1__bindgen_ty_1>() ,
- 2usize , concat ! (
- "Size of: " , stringify ! ( foo__bindgen_ty_1__bindgen_ty_1 )
- ));
- assert_eq! (::std::mem::align_of::<foo__bindgen_ty_1__bindgen_ty_1>() ,
- 2usize , concat ! (
- "Alignment of " , stringify ! (
- foo__bindgen_ty_1__bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1__bindgen_ty_1 ) ) . b1
- as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- foo__bindgen_ty_1__bindgen_ty_1 ) , "::" , stringify ! ( b1 )
- ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1__bindgen_ty_1 ) ) . b2
- as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- foo__bindgen_ty_1__bindgen_ty_1 ) , "::" , stringify ! ( b2 )
- ));
-}
-impl Clone for foo__bindgen_ty_1__bindgen_ty_1 {
- fn clone(&self) -> Self { *self }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct foo__bindgen_ty_1__bindgen_ty_2 {
- pub c1: __BindgenUnionField<::std::os::raw::c_ushort>,
- pub c2: __BindgenUnionField<::std::os::raw::c_ushort>,
- pub bindgen_union_field: u16,
-}
-#[test]
-fn bindgen_test_layout_foo__bindgen_ty_1__bindgen_ty_2() {
- assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1__bindgen_ty_2>() ,
- 2usize , concat ! (
- "Size of: " , stringify ! ( foo__bindgen_ty_1__bindgen_ty_2 )
- ));
- assert_eq! (::std::mem::align_of::<foo__bindgen_ty_1__bindgen_ty_2>() ,
- 2usize , concat ! (
- "Alignment of " , stringify ! (
- foo__bindgen_ty_1__bindgen_ty_2 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1__bindgen_ty_2 ) ) . c1
- as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- foo__bindgen_ty_1__bindgen_ty_2 ) , "::" , stringify ! ( c1 )
- ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo__bindgen_ty_1__bindgen_ty_2 ) ) . c2
- as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- foo__bindgen_ty_1__bindgen_ty_2 ) , "::" , stringify ! ( c2 )
- ));
-}
-impl Clone for foo__bindgen_ty_1__bindgen_ty_2 {
- fn clone(&self) -> Self { *self }
-}
-#[test]
-fn bindgen_test_layout_foo__bindgen_ty_1() {
- assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 4usize , concat !
- ( "Size of: " , stringify ! ( foo__bindgen_ty_1 ) ));
- assert_eq! (::std::mem::align_of::<foo__bindgen_ty_1>() , 2usize , concat
- ! ( "Alignment of " , stringify ! ( foo__bindgen_ty_1 ) ));
-}
-impl Clone for foo__bindgen_ty_1 {
- fn clone(&self) -> Self { *self }
-}
-#[test]
-fn bindgen_test_layout_foo() {
- assert_eq!(::std::mem::size_of::<foo>() , 4usize , concat ! (
- "Size of: " , stringify ! ( foo ) ));
- assert_eq! (::std::mem::align_of::<foo>() , 4usize , concat ! (
- "Alignment of " , stringify ! ( foo ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo ) ) . a as * const _ as usize } ,
- 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo ) , "::" ,
- stringify ! ( a ) ));
-}
-impl Clone for foo {
- fn clone(&self) -> Self { *self }
-}
diff --git a/tests/expectations/tests/use-core.rs b/tests/expectations/tests/use-core.rs
index 9d4eeaf0..14ac1373 100644
--- a/tests/expectations/tests/use-core.rs
+++ b/tests/expectations/tests/use-core.rs
@@ -6,6 +6,30 @@
extern crate core;
#[repr(C)]
+pub struct __BindgenUnionField<T>(::core::marker::PhantomData<T>);
+impl <T> __BindgenUnionField<T> {
+ #[inline]
+ pub fn new() -> Self { __BindgenUnionField(::core::marker::PhantomData) }
+ #[inline]
+ pub unsafe fn as_ref(&self) -> &T { ::core::mem::transmute(self) }
+ #[inline]
+ pub unsafe fn as_mut(&mut self) -> &mut T { ::core::mem::transmute(self) }
+}
+impl <T> ::core::default::Default for __BindgenUnionField<T> {
+ #[inline]
+ fn default() -> Self { Self::new() }
+}
+impl <T> ::core::clone::Clone for __BindgenUnionField<T> {
+ #[inline]
+ fn clone(&self) -> Self { Self::new() }
+}
+impl <T> ::core::marker::Copy for __BindgenUnionField<T> { }
+impl <T> ::core::fmt::Debug for __BindgenUnionField<T> {
+ fn fmt(&self, fmt: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
+ fmt.write_str("__BindgenUnionField")
+ }
+}
+#[repr(C)]
#[derive(Debug, Copy)]
pub struct foo {
pub a: ::std::os::raw::c_int,
@@ -41,10 +65,11 @@ impl Default for foo {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
}
#[repr(C)]
-#[derive(Copy)]
-pub union _bindgen_ty_1 {
- pub bar: ::std::os::raw::c_int,
- pub baz: ::std::os::raw::c_long,
+#[derive(Debug, Default, Copy)]
+pub struct _bindgen_ty_1 {
+ pub bar: __BindgenUnionField<::std::os::raw::c_int>,
+ pub baz: __BindgenUnionField<::std::os::raw::c_long>,
+ pub bindgen_union_field: u64,
}
#[test]
fn bindgen_test_layout__bindgen_ty_1() {
@@ -66,9 +91,6 @@ fn bindgen_test_layout__bindgen_ty_1() {
impl Clone for _bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
-impl Default for _bindgen_ty_1 {
- fn default() -> Self { unsafe { ::core::mem::zeroed() } }
-}
extern "C" {
#[link_name = "bazz"]
pub static mut bazz: _bindgen_ty_1;
diff --git a/tests/expectations/tests/use-core_1_0.rs b/tests/expectations/tests/use-core_1_0.rs
deleted file mode 100644
index 14ac1373..00000000
--- a/tests/expectations/tests/use-core_1_0.rs
+++ /dev/null
@@ -1,99 +0,0 @@
-/* automatically generated by rust-bindgen */
-
-
-#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-
-extern crate core;
-
-#[repr(C)]
-pub struct __BindgenUnionField<T>(::core::marker::PhantomData<T>);
-impl <T> __BindgenUnionField<T> {
- #[inline]
- pub fn new() -> Self { __BindgenUnionField(::core::marker::PhantomData) }
- #[inline]
- pub unsafe fn as_ref(&self) -> &T { ::core::mem::transmute(self) }
- #[inline]
- pub unsafe fn as_mut(&mut self) -> &mut T { ::core::mem::transmute(self) }
-}
-impl <T> ::core::default::Default for __BindgenUnionField<T> {
- #[inline]
- fn default() -> Self { Self::new() }
-}
-impl <T> ::core::clone::Clone for __BindgenUnionField<T> {
- #[inline]
- fn clone(&self) -> Self { Self::new() }
-}
-impl <T> ::core::marker::Copy for __BindgenUnionField<T> { }
-impl <T> ::core::fmt::Debug for __BindgenUnionField<T> {
- fn fmt(&self, fmt: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
- fmt.write_str("__BindgenUnionField")
- }
-}
-#[repr(C)]
-#[derive(Debug, Copy)]
-pub struct foo {
- pub a: ::std::os::raw::c_int,
- pub b: ::std::os::raw::c_int,
- pub bar: *mut ::std::os::raw::c_void,
-}
-#[test]
-fn bindgen_test_layout_foo() {
- assert_eq!(::core::mem::size_of::<foo>() , 16usize , concat ! (
- "Size of: " , stringify ! ( foo ) ));
- assert_eq! (::core::mem::align_of::<foo>() , 8usize , concat ! (
- "Alignment of " , stringify ! ( foo ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo ) ) . a as * const _ as usize } ,
- 0usize , concat ! (
- "Alignment of field: " , stringify ! ( foo ) , "::" ,
- stringify ! ( a ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo ) ) . b as * const _ as usize } ,
- 4usize , concat ! (
- "Alignment of field: " , stringify ! ( foo ) , "::" ,
- stringify ! ( b ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const foo ) ) . bar as * const _ as usize } ,
- 8usize , concat ! (
- "Alignment of field: " , stringify ! ( foo ) , "::" ,
- stringify ! ( bar ) ));
-}
-impl Clone for foo {
- fn clone(&self) -> Self { *self }
-}
-impl Default for foo {
- fn default() -> Self { unsafe { ::core::mem::zeroed() } }
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct _bindgen_ty_1 {
- pub bar: __BindgenUnionField<::std::os::raw::c_int>,
- pub baz: __BindgenUnionField<::std::os::raw::c_long>,
- pub bindgen_union_field: u64,
-}
-#[test]
-fn bindgen_test_layout__bindgen_ty_1() {
- assert_eq!(::core::mem::size_of::<_bindgen_ty_1>() , 8usize , concat ! (
- "Size of: " , stringify ! ( _bindgen_ty_1 ) ));
- assert_eq! (::core::mem::align_of::<_bindgen_ty_1>() , 8usize , concat ! (
- "Alignment of " , stringify ! ( _bindgen_ty_1 ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const _bindgen_ty_1 ) ) . bar as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( _bindgen_ty_1 ) , "::"
- , stringify ! ( bar ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const _bindgen_ty_1 ) ) . baz as * const _ as
- usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( _bindgen_ty_1 ) , "::"
- , stringify ! ( baz ) ));
-}
-impl Clone for _bindgen_ty_1 {
- fn clone(&self) -> Self { *self }
-}
-extern "C" {
- #[link_name = "bazz"]
- pub static mut bazz: _bindgen_ty_1;
-}
-pub type fooFunction =
- ::core::option::Option<unsafe extern "C" fn(bar: ::std::os::raw::c_int)>;
diff --git a/tests/headers/16-byte-alignment.h b/tests/headers/16-byte-alignment.h
index 68fe1eb3..7a7f7548 100644
--- a/tests/headers/16-byte-alignment.h
+++ b/tests/headers/16-byte-alignment.h
@@ -1,3 +1,4 @@
+
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
diff --git a/tests/headers/16-byte-alignment_1_0.h b/tests/headers/16-byte-alignment_1_0.h
deleted file mode 100644
index 8e4fcb2d..00000000
--- a/tests/headers/16-byte-alignment_1_0.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// bindgen-flags: --rust-target 1.0
-
-typedef unsigned char uint8_t;
-typedef unsigned short uint16_t;
-typedef unsigned int uint32_t;
-
-struct rte_ipv4_tuple {
- uint32_t src_addr;
- uint32_t dst_addr;
- union {
- struct {
- uint16_t dport;
- uint16_t sport;
- };
- uint32_t sctp_tag;
- };
-};
-
-struct rte_ipv6_tuple {
- uint8_t src_addr[16];
- uint8_t dst_addr[16];
- union {
- struct {
- uint16_t dport;
- uint16_t sport;
- };
- uint32_t sctp_tag;
- };
-};
-
-union rte_thash_tuple {
- struct rte_ipv4_tuple v4;
- struct rte_ipv6_tuple v6;
-} __attribute__((aligned(16)));
diff --git a/tests/headers/anon_struct_in_union_1_0.h b/tests/headers/anon_struct_in_union_1_0.h
deleted file mode 100644
index fe0a030c..00000000
--- a/tests/headers/anon_struct_in_union_1_0.h
+++ /dev/null
@@ -1,9 +0,0 @@
-// bindgen-flags: --rust-target 1.0
-
-struct s {
- union {
- struct inner {
- int b;
- } field;
- } u;
-};
diff --git a/tests/headers/anon_union_1_0.hpp b/tests/headers/anon_union_1_0.hpp
deleted file mode 100644
index 83f408c1..00000000
--- a/tests/headers/anon_union_1_0.hpp
+++ /dev/null
@@ -1,22 +0,0 @@
-// bindgen-flags: --rust-target 1.0
-
-template<typename T>
-struct TErrorResult {
- enum UnionState {
- HasMessage,
- HasException,
- };
- int mResult;
- struct Message;
- struct DOMExceptionInfo;
- union {
- Message* mMessage;
- DOMExceptionInfo* mDOMExceptionInfo;
- };
-
- bool mMightHaveUnreported;
- UnionState mUnionState;
-};
-
-struct ErrorResult : public TErrorResult<int> {
-};
diff --git a/tests/headers/class_1_0.hpp b/tests/headers/class_1_0.hpp
deleted file mode 100644
index f73487d1..00000000
--- a/tests/headers/class_1_0.hpp
+++ /dev/null
@@ -1,58 +0,0 @@
-// bindgen-flags: --rust-target 1.0
-
-class C {
- int a;
- // More than rust limits (32)
- char big_array[33];
-};
-
-class C_with_zero_length_array {
- int a;
- // More than rust limits (32)
- char big_array[33];
- char zero_length_array[0];
-};
-
-class C_with_incomplete_array {
- int a;
- // More than rust limits (32)
- char big_array[33];
- char incomplete_array[];
-};
-
-class C_with_zero_length_array_and_incomplete_array {
- int a;
- // More than rust limits (32)
- char big_array[33];
- char zero_length_array[0];
- char incomplete_array[];
-};
-
-class WithDtor {
- int b;
-
- ~WithDtor() {}
-};
-
-class IncompleteArrayNonCopiable {
- void* whatever;
- C incomplete_array[];
-};
-
-union Union {
- float d;
- int i;
-};
-
-class WithUnion {
- Union data;
-};
-
-class RealAbstractionWithTonsOfMethods {
- void foo();
-public:
- void bar() const;
- void bar();
- void bar(int foo);
- static void sta();
-};
diff --git a/tests/headers/class_with_inner_struct.hpp b/tests/headers/class_with_inner_struct.hpp
index 79a8b95b..ec729fe6 100644
--- a/tests/headers/class_with_inner_struct.hpp
+++ b/tests/headers/class_with_inner_struct.hpp
@@ -1,6 +1,5 @@
// bindgen-flags: -- -std=c++11
-
class A {
unsigned c;
struct Segment { int begin, end; };
diff --git a/tests/headers/class_with_inner_struct_1_0.hpp b/tests/headers/class_with_inner_struct_1_0.hpp
deleted file mode 100644
index 5145337f..00000000
--- a/tests/headers/class_with_inner_struct_1_0.hpp
+++ /dev/null
@@ -1,44 +0,0 @@
-// bindgen-flags: --rust-target 1.0 -- -std=c++11
-
-
-class A {
- unsigned c;
- struct Segment { int begin, end; };
- union {
- int f;
- } named_union;
- union {
- int d;
- };
-};
-
-class B {
- unsigned d;
- struct Segment { int begin, end; };
-};
-
-
-enum class StepSyntax {
- Keyword, // step-start and step-end
- FunctionalWithoutKeyword, // steps(...)
- FunctionalWithStartKeyword, // steps(..., start)
- FunctionalWithEndKeyword, // steps(..., end)
-};
-
-class C {
- unsigned d;
- union {
- struct {
- float mX1;
- float mY1;
- float mX2;
- float mY2;
- } mFunc;
- struct {
- StepSyntax mStepSyntax;
- unsigned int mSteps;
- };
- };
- // To ensure it doesn't collide
- struct Segment { int begin, end; };
-};
diff --git a/tests/headers/forward_declared_complex_types_1_0.hpp b/tests/headers/forward_declared_complex_types_1_0.hpp
deleted file mode 100644
index ff6076fc..00000000
--- a/tests/headers/forward_declared_complex_types_1_0.hpp
+++ /dev/null
@@ -1,18 +0,0 @@
-// bindgen-flags: --rust-target 1.0
-
-struct Foo_empty {};
-struct Foo;
-
-struct Bar {
- Foo *f;
-};
-
-void baz_struct(Foo* f);
-
-union Union;
-
-void baz_union(Union* u);
-
-class Quux;
-
-void baz_class(Quux* q);
diff --git a/tests/headers/issue-493.hpp b/tests/headers/issue-493.hpp
index 8a4f1da3..975ef5ce 100644
--- a/tests/headers/issue-493.hpp
+++ b/tests/headers/issue-493.hpp
@@ -44,4 +44,4 @@ public:
__raw __r;
};
};
-};
+}; \ No newline at end of file
diff --git a/tests/headers/issue-493_1_0.hpp b/tests/headers/issue-493_1_0.hpp
deleted file mode 100644
index d9373a8c..00000000
--- a/tests/headers/issue-493_1_0.hpp
+++ /dev/null
@@ -1,49 +0,0 @@
-// bindgen-flags: --rust-target 1.0
-
-template<class _CharT, class _Traits, class _Allocator>
-class basic_string
-{
-public:
- typedef unsigned long long size_type;
- typedef char value_type;
- typedef value_type * pointer;
-
- struct __long
- {
- size_type __cap_;
- size_type __size_;
- pointer __data_;
- };
-
- enum {__min_cap = (sizeof(__long) - 1)/sizeof(value_type) > 2 ?
- (sizeof(__long) - 1)/sizeof(value_type) : 2};
-
- struct __short
- {
- union
- {
- unsigned char __size_;
- value_type __lx;
- };
- value_type __data_[__min_cap];
- };
-
- union __ulx{__long __lx; __short __lxx;};
-
- enum {__n_words = sizeof(__ulx) / sizeof(size_type)};
-
- struct __raw
- {
- size_type __words[__n_words];
- };
-
- struct __rep
- {
- union
- {
- __long __l;
- __short __s;
- __raw __r;
- };
- };
-};
diff --git a/tests/headers/jsval_layout_opaque_1_0.hpp b/tests/headers/jsval_layout_opaque_1_0.hpp
deleted file mode 100644
index ca31cc01..00000000
--- a/tests/headers/jsval_layout_opaque_1_0.hpp
+++ /dev/null
@@ -1,424 +0,0 @@
-// bindgen-flags: --rust-target 1.0 -- -std=c++11
-
-/**
- * These typedefs are hacky, but keep our tests consistent across 64-bit
- * platforms, otherwise the id's change and our CI is unhappy.
- */
-typedef unsigned char uint8_t;
-typedef int int32_t;
-typedef unsigned int uint32_t;
-typedef unsigned long long uint64_t;
-typedef unsigned long long size_t;
-typedef unsigned long long uintptr_t;
-
-
-#define JS_PUNBOX64
-#define IS_LITTLE_ENDIAN
-
-/*
- * Try to get jsvals 64-bit aligned. We could almost assert that all values are
- * aligned, but MSVC and GCC occasionally break alignment.
- */
-#if defined(__GNUC__) || defined(__xlc__) || defined(__xlC__)
-# define JSVAL_ALIGNMENT __attribute__((aligned (8)))
-#elif defined(_MSC_VER)
- /*
- * Structs can be aligned with MSVC, but not if they are used as parameters,
- * so we just don't try to align.
- */
-# define JSVAL_ALIGNMENT
-#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
-# define JSVAL_ALIGNMENT
-#elif defined(__HP_cc) || defined(__HP_aCC)
-# define JSVAL_ALIGNMENT
-#endif
-
-#if defined(JS_PUNBOX64)
-# define JSVAL_TAG_SHIFT 47
-#endif
-
-/*
- * We try to use enums so that printing a jsval_layout in the debugger shows
- * nice symbolic type tags, however we can only do this when we can force the
- * underlying type of the enum to be the desired size.
- */
-#if !defined(__SUNPRO_CC) && !defined(__xlC__)
-
-#if defined(_MSC_VER)
-# define JS_ENUM_HEADER(id, type) enum id : type
-# define JS_ENUM_FOOTER(id)
-#else
-# define JS_ENUM_HEADER(id, type) enum id
-# define JS_ENUM_FOOTER(id) __attribute__((packed))
-#endif
-
-/* Remember to propagate changes to the C defines below. */
-JS_ENUM_HEADER(JSValueType, uint8_t)
-{
- JSVAL_TYPE_DOUBLE = 0x00,
- JSVAL_TYPE_INT32 = 0x01,
- JSVAL_TYPE_UNDEFINED = 0x02,
- JSVAL_TYPE_BOOLEAN = 0x03,
- JSVAL_TYPE_MAGIC = 0x04,
- JSVAL_TYPE_STRING = 0x05,
- JSVAL_TYPE_SYMBOL = 0x06,
- JSVAL_TYPE_NULL = 0x07,
- JSVAL_TYPE_OBJECT = 0x08,
-
- /* These never appear in a jsval; they are only provided as an out-of-band value. */
- JSVAL_TYPE_UNKNOWN = 0x20,
- JSVAL_TYPE_MISSING = 0x21
-} JS_ENUM_FOOTER(JSValueType);
-
-static_assert(sizeof(JSValueType) == 1,
- "compiler typed enum support is apparently buggy");
-
-#if defined(JS_NUNBOX32)
-
-/* Remember to propagate changes to the C defines below. */
-JS_ENUM_HEADER(JSValueTag, uint32_t)
-{
- JSVAL_TAG_CLEAR = 0xFFFFFF80,
- JSVAL_TAG_INT32 = JSVAL_TAG_CLEAR | JSVAL_TYPE_INT32,
- JSVAL_TAG_UNDEFINED = JSVAL_TAG_CLEAR | JSVAL_TYPE_UNDEFINED,
- JSVAL_TAG_STRING = JSVAL_TAG_CLEAR | JSVAL_TYPE_STRING,
- JSVAL_TAG_SYMBOL = JSVAL_TAG_CLEAR | JSVAL_TYPE_SYMBOL,
- JSVAL_TAG_BOOLEAN = JSVAL_TAG_CLEAR | JSVAL_TYPE_BOOLEAN,
- JSVAL_TAG_MAGIC = JSVAL_TAG_CLEAR | JSVAL_TYPE_MAGIC,
- JSVAL_TAG_NULL = JSVAL_TAG_CLEAR | JSVAL_TYPE_NULL,
- JSVAL_TAG_OBJECT = JSVAL_TAG_CLEAR | JSVAL_TYPE_OBJECT
-} JS_ENUM_FOOTER(JSValueTag);
-
-static_assert(sizeof(JSValueTag) == sizeof(uint32_t),
- "compiler typed enum support is apparently buggy");
-
-#elif defined(JS_PUNBOX64)
-
-/* Remember to propagate changes to the C defines below. */
-JS_ENUM_HEADER(JSValueTag, uint32_t)
-{
- JSVAL_TAG_MAX_DOUBLE = 0x1FFF0,
- JSVAL_TAG_INT32 = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_INT32,
- JSVAL_TAG_UNDEFINED = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_UNDEFINED,
- JSVAL_TAG_STRING = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_STRING,
- JSVAL_TAG_SYMBOL = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_SYMBOL,
- JSVAL_TAG_BOOLEAN = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_BOOLEAN,
- JSVAL_TAG_MAGIC = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_MAGIC,
- JSVAL_TAG_NULL = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_NULL,
- JSVAL_TAG_OBJECT = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_OBJECT
-} JS_ENUM_FOOTER(JSValueTag);
-
-static_assert(sizeof(JSValueTag) == sizeof(uint32_t),
- "compiler typed enum support is apparently buggy");
-
-JS_ENUM_HEADER(JSValueShiftedTag, uint64_t)
-{
- JSVAL_SHIFTED_TAG_MAX_DOUBLE = ((((uint64_t)JSVAL_TAG_MAX_DOUBLE) << JSVAL_TAG_SHIFT) | 0xFFFFFFFF),
- JSVAL_SHIFTED_TAG_INT32 = (((uint64_t)JSVAL_TAG_INT32) << JSVAL_TAG_SHIFT),
- JSVAL_SHIFTED_TAG_UNDEFINED = (((uint64_t)JSVAL_TAG_UNDEFINED) << JSVAL_TAG_SHIFT),
- JSVAL_SHIFTED_TAG_STRING = (((uint64_t)JSVAL_TAG_STRING) << JSVAL_TAG_SHIFT),
- JSVAL_SHIFTED_TAG_SYMBOL = (((uint64_t)JSVAL_TAG_SYMBOL) << JSVAL_TAG_SHIFT),
- JSVAL_SHIFTED_TAG_BOOLEAN = (((uint64_t)JSVAL_TAG_BOOLEAN) << JSVAL_TAG_SHIFT),
- JSVAL_SHIFTED_TAG_MAGIC = (((uint64_t)JSVAL_TAG_MAGIC) << JSVAL_TAG_SHIFT),
- JSVAL_SHIFTED_TAG_NULL = (((uint64_t)JSVAL_TAG_NULL) << JSVAL_TAG_SHIFT),
- JSVAL_SHIFTED_TAG_OBJECT = (((uint64_t)JSVAL_TAG_OBJECT) << JSVAL_TAG_SHIFT)
-} JS_ENUM_FOOTER(JSValueShiftedTag);
-
-static_assert(sizeof(JSValueShiftedTag) == sizeof(uint64_t),
- "compiler typed enum support is apparently buggy");
-
-#endif
-
-/*
- * All our supported compilers implement C++11 |enum Foo : T| syntax, so don't
- * expose these macros. (This macro exists *only* because gcc bug 51242
- * <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51242> makes bit-fields of
- * typed enums trigger a warning that can't be turned off. Don't expose it
- * beyond this file!)
- */
-#undef JS_ENUM_HEADER
-#undef JS_ENUM_FOOTER
-
-#else /* !defined(__SUNPRO_CC) && !defined(__xlC__) */
-
-typedef uint8_t JSValueType;
-#define JSVAL_TYPE_DOUBLE ((uint8_t)0x00)
-#define JSVAL_TYPE_INT32 ((uint8_t)0x01)
-#define JSVAL_TYPE_UNDEFINED ((uint8_t)0x02)
-#define JSVAL_TYPE_BOOLEAN ((uint8_t)0x03)
-#define JSVAL_TYPE_MAGIC ((uint8_t)0x04)
-#define JSVAL_TYPE_STRING ((uint8_t)0x05)
-#define JSVAL_TYPE_SYMBOL ((uint8_t)0x06)
-#define JSVAL_TYPE_NULL ((uint8_t)0x07)
-#define JSVAL_TYPE_OBJECT ((uint8_t)0x08)
-#define JSVAL_TYPE_UNKNOWN ((uint8_t)0x20)
-
-#if defined(JS_NUNBOX32)
-
-typedef uint32_t JSValueTag;
-#define JSVAL_TAG_CLEAR ((uint32_t)(0xFFFFFF80))
-#define JSVAL_TAG_INT32 ((uint32_t)(JSVAL_TAG_CLEAR | JSVAL_TYPE_INT32))
-#define JSVAL_TAG_UNDEFINED ((uint32_t)(JSVAL_TAG_CLEAR | JSVAL_TYPE_UNDEFINED))
-#define JSVAL_TAG_STRING ((uint32_t)(JSVAL_TAG_CLEAR | JSVAL_TYPE_STRING))
-#define JSVAL_TAG_SYMBOL ((uint32_t)(JSVAL_TAG_CLEAR | JSVAL_TYPE_SYMBOL))
-#define JSVAL_TAG_BOOLEAN ((uint32_t)(JSVAL_TAG_CLEAR | JSVAL_TYPE_BOOLEAN))
-#define JSVAL_TAG_MAGIC ((uint32_t)(JSVAL_TAG_CLEAR | JSVAL_TYPE_MAGIC))
-#define JSVAL_TAG_NULL ((uint32_t)(JSVAL_TAG_CLEAR | JSVAL_TYPE_NULL))
-#define JSVAL_TAG_OBJECT ((uint32_t)(JSVAL_TAG_CLEAR | JSVAL_TYPE_OBJECT))
-
-#elif defined(JS_PUNBOX64)
-
-typedef uint32_t JSValueTag;
-#define JSVAL_TAG_MAX_DOUBLE ((uint32_t)(0x1FFF0))
-#define JSVAL_TAG_INT32 (uint32_t)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_INT32)
-#define JSVAL_TAG_UNDEFINED (uint32_t)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_UNDEFINED)
-#define JSVAL_TAG_STRING (uint32_t)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_STRING)
-#define JSVAL_TAG_SYMBOL (uint32_t)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_SYMBOL)
-#define JSVAL_TAG_BOOLEAN (uint32_t)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_BOOLEAN)
-#define JSVAL_TAG_MAGIC (uint32_t)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_MAGIC)
-#define JSVAL_TAG_NULL (uint32_t)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_NULL)
-#define JSVAL_TAG_OBJECT (uint32_t)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_OBJECT)
-
-typedef uint64_t JSValueShiftedTag;
-#define JSVAL_SHIFTED_TAG_MAX_DOUBLE ((((uint64_t)JSVAL_TAG_MAX_DOUBLE) << JSVAL_TAG_SHIFT) | 0xFFFFFFFF)
-#define JSVAL_SHIFTED_TAG_INT32 (((uint64_t)JSVAL_TAG_INT32) << JSVAL_TAG_SHIFT)
-#define JSVAL_SHIFTED_TAG_UNDEFINED (((uint64_t)JSVAL_TAG_UNDEFINED) << JSVAL_TAG_SHIFT)
-#define JSVAL_SHIFTED_TAG_STRING (((uint64_t)JSVAL_TAG_STRING) << JSVAL_TAG_SHIFT)
-#define JSVAL_SHIFTED_TAG_SYMBOL (((uint64_t)JSVAL_TAG_SYMBOL) << JSVAL_TAG_SHIFT)
-#define JSVAL_SHIFTED_TAG_BOOLEAN (((uint64_t)JSVAL_TAG_BOOLEAN) << JSVAL_TAG_SHIFT)
-#define JSVAL_SHIFTED_TAG_MAGIC (((uint64_t)JSVAL_TAG_MAGIC) << JSVAL_TAG_SHIFT)
-#define JSVAL_SHIFTED_TAG_NULL (((uint64_t)JSVAL_TAG_NULL) << JSVAL_TAG_SHIFT)
-#define JSVAL_SHIFTED_TAG_OBJECT (((uint64_t)JSVAL_TAG_OBJECT) << JSVAL_TAG_SHIFT)
-
-#endif /* JS_PUNBOX64 */
-#endif /* !defined(__SUNPRO_CC) && !defined(__xlC__) */
-
-#if defined(JS_NUNBOX32)
-
-#define JSVAL_TYPE_TO_TAG(type) ((JSValueTag)(JSVAL_TAG_CLEAR | (type)))
-
-#define JSVAL_LOWER_INCL_TAG_OF_OBJ_OR_NULL_SET JSVAL_TAG_NULL
-#define JSVAL_UPPER_EXCL_TAG_OF_PRIMITIVE_SET JSVAL_TAG_OBJECT
-#define JSVAL_UPPER_INCL_TAG_OF_NUMBER_SET JSVAL_TAG_INT32
-#define JSVAL_LOWER_INCL_TAG_OF_GCTHING_SET JSVAL_TAG_STRING
-
-#elif defined(JS_PUNBOX64)
-
-#define JSVAL_PAYLOAD_MASK 0x00007FFFFFFFFFFFLL
-#define JSVAL_TAG_MASK 0xFFFF800000000000LL
-#define JSVAL_TYPE_TO_TAG(type) ((JSValueTag)(JSVAL_TAG_MAX_DOUBLE | (type)))
-#define JSVAL_TYPE_TO_SHIFTED_TAG(type) (((uint64_t)JSVAL_TYPE_TO_TAG(type)) << JSVAL_TAG_SHIFT)
-
-#define JSVAL_LOWER_INCL_TAG_OF_OBJ_OR_NULL_SET JSVAL_TAG_NULL
-#define JSVAL_UPPER_EXCL_TAG_OF_PRIMITIVE_SET JSVAL_TAG_OBJECT
-#define JSVAL_UPPER_INCL_TAG_OF_NUMBER_SET JSVAL_TAG_INT32
-#define JSVAL_LOWER_INCL_TAG_OF_GCTHING_SET JSVAL_TAG_STRING
-
-#define JSVAL_LOWER_INCL_SHIFTED_TAG_OF_OBJ_OR_NULL_SET JSVAL_SHIFTED_TAG_NULL
-#define JSVAL_UPPER_EXCL_SHIFTED_TAG_OF_PRIMITIVE_SET JSVAL_SHIFTED_TAG_OBJECT
-#define JSVAL_UPPER_EXCL_SHIFTED_TAG_OF_NUMBER_SET JSVAL_SHIFTED_TAG_UNDEFINED
-#define JSVAL_LOWER_INCL_SHIFTED_TAG_OF_GCTHING_SET JSVAL_SHIFTED_TAG_STRING
-
-#endif /* JS_PUNBOX64 */
-
-typedef enum JSWhyMagic
-{
- /** a hole in a native object's elements */
- JS_ELEMENTS_HOLE,
-
- /** there is not a pending iterator value */
- JS_NO_ITER_VALUE,
-
- /** exception value thrown when closing a generator */
- JS_GENERATOR_CLOSING,
-
- /** compiler sentinel value */
- JS_NO_CONSTANT,
-
- /** used in debug builds to catch tracing errors */
- JS_THIS_POISON,
-
- /** used in debug builds to catch tracing errors */
- JS_ARG_POISON,
-
- /** an empty subnode in the AST serializer */
- JS_SERIALIZE_NO_NODE,
-
- /** lazy arguments value on the stack */
- JS_LAZY_ARGUMENTS,
-
- /** optimized-away 'arguments' value */
- JS_OPTIMIZED_ARGUMENTS,
-
- /** magic value passed to natives to indicate construction */
- JS_IS_CONSTRUCTING,
-
- /** arguments.callee has been overwritten */
- JS_OVERWRITTEN_CALLEE,
-
- /** value of static block object slot */
- JS_BLOCK_NEEDS_CLONE,
-
- /** see class js::HashableValue */
- JS_HASH_KEY_EMPTY,
-
- /** error while running Ion code */
- JS_ION_ERROR,
-
- /** missing recover instruction result */
- JS_ION_BAILOUT,
-
- /** optimized out slot */
- JS_OPTIMIZED_OUT,
-
- /** uninitialized lexical bindings that produce ReferenceError on touch. */
- JS_UNINITIALIZED_LEXICAL,
-
- /** for local use */
- JS_GENERIC_MAGIC,
-
- JS_WHY_MAGIC_COUNT
-} JSWhyMagic;
-
-#if defined(IS_LITTLE_ENDIAN)
-# if defined(JS_NUNBOX32)
-typedef union jsval_layout
-{
- uint64_t asBits;
- struct {
- union {
- int32_t i32;
- uint32_t u32;
- uint32_t boo; // Don't use |bool| -- it must be four bytes.
- JSString* str;
- JS::Symbol* sym;
- JSObject* obj;
- js::gc::Cell* cell;
- void* ptr;
- JSWhyMagic why;
- size_t word;
- uintptr_t uintptr;
- } payload;
- JSValueTag tag;
- } s;
- double asDouble;
- void* asPtr;
-} JSVAL_ALIGNMENT jsval_layout;
-# elif defined(JS_PUNBOX64)
-typedef union jsval_layout
-{
- uint64_t asBits;
-#if !defined(_WIN64)
- /* MSVC does not pack these correctly :-( */
- struct {
- uint64_t payload47 : 47;
- JSValueTag tag : 17;
- } debugView;
-#endif
- struct {
- union {
- int32_t i32;
- uint32_t u32;
- JSWhyMagic why;
- } payload;
- } s;
- double asDouble;
- void* asPtr;
- size_t asWord;
- uintptr_t asUIntPtr;
-} JSVAL_ALIGNMENT jsval_layout;
-# endif /* JS_PUNBOX64 */
-#else /* defined(IS_LITTLE_ENDIAN) */
-# if defined(JS_NUNBOX32)
-typedef union jsval_layout
-{
- uint64_t asBits;
- struct {
- JSValueTag tag;
- union {
- int32_t i32;
- uint32_t u32;
- uint32_t boo; // Don't use |bool| -- it must be four bytes.
- JSString* str;
- JS::Symbol* sym;
- JSObject* obj;
- js::gc::Cell* cell;
- void* ptr;
- JSWhyMagic why;
- size_t word;
- uintptr_t uintptr;
- } payload;
- } s;
- double asDouble;
- void* asPtr;
-} JSVAL_ALIGNMENT jsval_layout;
-# elif defined(JS_PUNBOX64)
-typedef union jsval_layout
-{
- uint64_t asBits;
- struct {
- JSValueTag tag : 17;
- uint64_t payload47 : 47;
- } debugView;
- struct {
- uint32_t padding;
- union {
- int32_t i32;
- uint32_t u32;
- JSWhyMagic why;
- } payload;
- } s;
- double asDouble;
- void* asPtr;
- size_t asWord;
- uintptr_t asUIntPtr;
-} JSVAL_ALIGNMENT jsval_layout;
-# endif /* JS_PUNBOX64 */
-#endif /* defined(IS_LITTLE_ENDIAN) */
-
-/*
- * For codesize purposes on some platforms, it's important that the
- * compiler know that JS::Values constructed from constant values can be
- * folded to constant bit patterns at compile time, rather than
- * constructed at runtime. Doing this requires a fair amount of C++11
- * features, which are not supported on all of our compilers. Set up
- * some defines and helper macros in an attempt to confine the ugliness
- * here, rather than scattering it all about the file. The important
- * features are:
- *
- * - constexpr;
- * - defaulted functions;
- * - C99-style designated initializers.
- */
-#if defined(__clang__)
-# if __has_feature(cxx_constexpr) && __has_feature(cxx_defaulted_functions)
-# define JS_VALUE_IS_CONSTEXPR
-# endif
-#elif defined(__GNUC__)
-/*
- * We need 4.5 for defaulted functions, 4.6 for constexpr, 4.7 because 4.6
- * doesn't understand |(X) { .field = ... }| syntax, and 4.7.3 because
- * versions prior to that have bugs in the C++ front-end that cause crashes.
- */
-# if MOZ_GCC_VERSION_AT_LEAST(4, 7, 3)
-# define JS_VALUE_IS_CONSTEXPR
-# endif
-#endif
-
-#if defined(JS_VALUE_IS_CONSTEXPR)
-# define JS_RETURN_LAYOUT_FROM_BITS(BITS) \
- return (jsval_layout) { .asBits = (BITS) }
-# define JS_VALUE_CONSTEXPR MOZ_CONSTEXPR
-# define JS_VALUE_CONSTEXPR_VAR MOZ_CONSTEXPR_VAR
-#else
-# define JS_RETURN_LAYOUT_FROM_BITS(BITS) \
- jsval_layout l; \
- l.asBits = (BITS); \
- return l;
-# define JS_VALUE_CONSTEXPR
-# define JS_VALUE_CONSTEXPR_VAR const
-#endif
-
-struct Value {
- jsval_layout data;
-};
diff --git a/tests/headers/layout_eth_conf.h b/tests/headers/layout_eth_conf.h
index f5fd605a..a742ee5f 100644
--- a/tests/headers/layout_eth_conf.h
+++ b/tests/headers/layout_eth_conf.h
@@ -424,4 +424,4 @@ struct rte_eth_conf {
uint32_t dcb_capability_en;
struct rte_fdir_conf fdir_conf; /**< FDIR configuration. */
struct rte_intr_conf intr_conf; /**< Interrupt mode configuration. */
-};
+}; \ No newline at end of file
diff --git a/tests/headers/layout_eth_conf_1_0.h b/tests/headers/layout_eth_conf_1_0.h
deleted file mode 100644
index 54630f24..00000000
--- a/tests/headers/layout_eth_conf_1_0.h
+++ /dev/null
@@ -1,429 +0,0 @@
-// bindgen-flags: --rust-target 1.0
-
-typedef unsigned char uint8_t;
-typedef unsigned short uint16_t;
-typedef unsigned int uint32_t;
-typedef unsigned long long uint64_t;
-
-/**
- * Simple flags are used for rte_eth_conf.rxmode.mq_mode.
- */
-#define ETH_MQ_RX_RSS_FLAG 0x1
-#define ETH_MQ_RX_DCB_FLAG 0x2
-#define ETH_MQ_RX_VMDQ_FLAG 0x4
-
-/* Definitions used for VMDQ and DCB functionality */
-#define ETH_VMDQ_MAX_VLAN_FILTERS 64 /**< Maximum nb. of VMDQ vlan filters. */
-#define ETH_DCB_NUM_USER_PRIORITIES 8 /**< Maximum nb. of DCB priorities. */
-#define ETH_VMDQ_DCB_NUM_QUEUES 128 /**< Maximum nb. of VMDQ DCB queues. */
-#define ETH_DCB_NUM_QUEUES 128 /**< Maximum nb. of DCB queues. */
-
-/**
- * A set of values to identify what method is to be used to route
- * packets to multiple queues.
- */
-enum rte_eth_rx_mq_mode {
- /** None of DCB,RSS or VMDQ mode */
- ETH_MQ_RX_NONE = 0,
-
- /** For RX side, only RSS is on */
- ETH_MQ_RX_RSS = ETH_MQ_RX_RSS_FLAG,
- /** For RX side,only DCB is on. */
- ETH_MQ_RX_DCB = ETH_MQ_RX_DCB_FLAG,
- /** Both DCB and RSS enable */
- ETH_MQ_RX_DCB_RSS = ETH_MQ_RX_RSS_FLAG | ETH_MQ_RX_DCB_FLAG,
-
- /** Only VMDQ, no RSS nor DCB */
- ETH_MQ_RX_VMDQ_ONLY = ETH_MQ_RX_VMDQ_FLAG,
- /** RSS mode with VMDQ */
- ETH_MQ_RX_VMDQ_RSS = ETH_MQ_RX_RSS_FLAG | ETH_MQ_RX_VMDQ_FLAG,
- /** Use VMDQ+DCB to route traffic to queues */
- ETH_MQ_RX_VMDQ_DCB = ETH_MQ_RX_VMDQ_FLAG | ETH_MQ_RX_DCB_FLAG,
- /** Enable both VMDQ and DCB in VMDq */
- ETH_MQ_RX_VMDQ_DCB_RSS = ETH_MQ_RX_RSS_FLAG | ETH_MQ_RX_DCB_FLAG |
- ETH_MQ_RX_VMDQ_FLAG,
-};
-
-/**
- * A structure used to configure the RX features of an Ethernet port.
- */
-struct rte_eth_rxmode {
- /** The multi-queue packet distribution mode to be used, e.g. RSS. */
- enum rte_eth_rx_mq_mode mq_mode;
- uint32_t max_rx_pkt_len; /**< Only used if jumbo_frame enabled. */
- uint16_t split_hdr_size; /**< hdr buf size (header_split enabled).*/
- __extension__
- uint16_t header_split : 1, /**< Header Split enable. */
- hw_ip_checksum : 1, /**< IP/UDP/TCP checksum offload enable. */
- hw_vlan_filter : 1, /**< VLAN filter enable. */
- hw_vlan_strip : 1, /**< VLAN strip enable. */
- hw_vlan_extend : 1, /**< Extended VLAN enable. */
- jumbo_frame : 1, /**< Jumbo Frame Receipt enable. */
- hw_strip_crc : 1, /**< Enable CRC stripping by hardware. */
- enable_scatter : 1, /**< Enable scatter packets rx handler */
- enable_lro : 1; /**< Enable LRO */
-};
-
-/**
- * A set of values to identify what method is to be used to transmit
- * packets using multi-TCs.
- */
-enum rte_eth_tx_mq_mode {
- ETH_MQ_TX_NONE = 0, /**< It is in neither DCB nor VT mode. */
- ETH_MQ_TX_DCB, /**< For TX side,only DCB is on. */
- ETH_MQ_TX_VMDQ_DCB, /**< For TX side,both DCB and VT is on. */
- ETH_MQ_TX_VMDQ_ONLY, /**< Only VT on, no DCB */
-};
-
-/**
- * A structure used to configure the TX features of an Ethernet port.
- */
-struct rte_eth_txmode {
- enum rte_eth_tx_mq_mode mq_mode; /**< TX multi-queues mode. */
-
- /* For i40e specifically */
- uint16_t pvid;
- __extension__
- uint8_t hw_vlan_reject_tagged : 1,
- /**< If set, reject sending out tagged pkts */
- hw_vlan_reject_untagged : 1,
- /**< If set, reject sending out untagged pkts */
- hw_vlan_insert_pvid : 1;
- /**< If set, enable port based VLAN insertion */
-};
-
-/**
- * A structure used to configure the Receive Side Scaling (RSS) feature
- * of an Ethernet port.
- * If not NULL, the *rss_key* pointer of the *rss_conf* structure points
- * to an array holding the RSS key to use for hashing specific header
- * fields of received packets. The length of this array should be indicated
- * by *rss_key_len* below. Otherwise, a default random hash key is used by
- * the device driver.
- *
- * The *rss_key_len* field of the *rss_conf* structure indicates the length
- * in bytes of the array pointed by *rss_key*. To be compatible, this length
- * will be checked in i40e only. Others assume 40 bytes to be used as before.
- *
- * The *rss_hf* field of the *rss_conf* structure indicates the different
- * types of IPv4/IPv6 packets to which the RSS hashing must be applied.
- * Supplying an *rss_hf* equal to zero disables the RSS feature.
- */
-struct rte_eth_rss_conf {
- uint8_t *rss_key; /**< If not NULL, 40-byte hash key. */
- uint8_t rss_key_len; /**< hash key length in bytes. */
- uint64_t rss_hf; /**< Hash functions to apply - see below. */
-};
-
-/**
- * This enum indicates the possible number of traffic classes
- * in DCB configratioins
- */
-enum rte_eth_nb_tcs {
- ETH_4_TCS = 4, /**< 4 TCs with DCB. */
- ETH_8_TCS = 8 /**< 8 TCs with DCB. */
-};
-
-/**
- * This enum indicates the possible number of queue pools
- * in VMDQ configurations.
- */
-enum rte_eth_nb_pools {
- ETH_8_POOLS = 8, /**< 8 VMDq pools. */
- ETH_16_POOLS = 16, /**< 16 VMDq pools. */
- ETH_32_POOLS = 32, /**< 32 VMDq pools. */
- ETH_64_POOLS = 64 /**< 64 VMDq pools. */
-};
-
-/**
- * A structure used to configure the VMDQ+DCB feature
- * of an Ethernet port.
- *
- * Using this feature, packets are routed to a pool of queues, based
- * on the vlan id in the vlan tag, and then to a specific queue within
- * that pool, using the user priority vlan tag field.
- *
- * A default pool may be used, if desired, to route all traffic which
- * does not match the vlan filter rules.
- */
-struct rte_eth_vmdq_dcb_conf {
- enum rte_eth_nb_pools nb_queue_pools; /**< With DCB, 16 or 32 pools */
- uint8_t enable_default_pool; /**< If non-zero, use a default pool */
- uint8_t default_pool; /**< The default pool, if applicable */
- uint8_t nb_pool_maps; /**< We can have up to 64 filters/mappings */
- struct {
- uint16_t vlan_id; /**< The vlan id of the received frame */
- uint64_t pools; /**< Bitmask of pools for packet rx */
- } pool_map[ETH_VMDQ_MAX_VLAN_FILTERS]; /**< VMDq vlan pool maps. */
- uint8_t dcb_tc[ETH_DCB_NUM_USER_PRIORITIES];
- /**< Selects a queue in a pool */
-};
-
-/* This structure may be extended in future. */
-struct rte_eth_dcb_rx_conf {
- enum rte_eth_nb_tcs nb_tcs; /**< Possible DCB TCs, 4 or 8 TCs */
- /** Traffic class each UP mapped to. */
- uint8_t dcb_tc[ETH_DCB_NUM_USER_PRIORITIES];
-};
-
-struct rte_eth_vmdq_dcb_tx_conf {
- enum rte_eth_nb_pools nb_queue_pools; /**< With DCB, 16 or 32 pools. */
- /** Traffic class each UP mapped to. */
- uint8_t dcb_tc[ETH_DCB_NUM_USER_PRIORITIES];
-};
-
-struct rte_eth_dcb_tx_conf {
- enum rte_eth_nb_tcs nb_tcs; /**< Possible DCB TCs, 4 or 8 TCs. */
- /** Traffic class each UP mapped to. */
- uint8_t dcb_tc[ETH_DCB_NUM_USER_PRIORITIES];
-};
-
-struct rte_eth_vmdq_tx_conf {
- enum rte_eth_nb_pools nb_queue_pools; /**< VMDq mode, 64 pools. */
-};
-
-struct rte_eth_vmdq_rx_conf {
- enum rte_eth_nb_pools nb_queue_pools; /**< VMDq only mode, 8 or 64 pools */
- uint8_t enable_default_pool; /**< If non-zero, use a default pool */
- uint8_t default_pool; /**< The default pool, if applicable */
- uint8_t enable_loop_back; /**< Enable VT loop back */
- uint8_t nb_pool_maps; /**< We can have up to 64 filters/mappings */
- uint32_t rx_mode; /**< Flags from ETH_VMDQ_ACCEPT_* */
- struct {
- uint16_t vlan_id; /**< The vlan id of the received frame */
- uint64_t pools; /**< Bitmask of pools for packet rx */
- } pool_map[ETH_VMDQ_MAX_VLAN_FILTERS]; /**< VMDq vlan pool maps. */
-};
-
-/**
- * Flow Director setting modes: none, signature or perfect.
- */
-enum rte_fdir_mode {
- RTE_FDIR_MODE_NONE = 0, /**< Disable FDIR support. */
- RTE_FDIR_MODE_SIGNATURE, /**< Enable FDIR signature filter mode. */
- RTE_FDIR_MODE_PERFECT, /**< Enable FDIR perfect filter mode. */
- RTE_FDIR_MODE_PERFECT_MAC_VLAN, /**< Enable FDIR filter mode - MAC VLAN. */
- RTE_FDIR_MODE_PERFECT_TUNNEL, /**< Enable FDIR filter mode - tunnel. */
-};
-
-/**
- * Memory space that can be configured to store Flow Director filters
- * in the board memory.
- */
-enum rte_fdir_pballoc_type {
- RTE_FDIR_PBALLOC_64K = 0, /**< 64k. */
- RTE_FDIR_PBALLOC_128K, /**< 128k. */
- RTE_FDIR_PBALLOC_256K, /**< 256k. */
-};
-
-/**
- * Select report mode of FDIR hash information in RX descriptors.
- */
-enum rte_fdir_status_mode {
- RTE_FDIR_NO_REPORT_STATUS = 0, /**< Never report FDIR hash. */
- RTE_FDIR_REPORT_STATUS, /**< Only report FDIR hash for matching pkts. */
- RTE_FDIR_REPORT_STATUS_ALWAYS, /**< Always report FDIR hash. */
-};
-
-/**
- * A structure used to define the input for IPV4 flow
- */
-struct rte_eth_ipv4_flow {
- uint32_t src_ip; /**< IPv4 source address in big endian. */
- uint32_t dst_ip; /**< IPv4 destination address in big endian. */
- uint8_t tos; /**< Type of service to match. */
- uint8_t ttl; /**< Time to live to match. */
- uint8_t proto; /**< Protocol, next header in big endian. */
-};
-
-/**
- * A structure used to define the input for IPV6 flow
- */
-struct rte_eth_ipv6_flow {
- uint32_t src_ip[4]; /**< IPv6 source address in big endian. */
- uint32_t dst_ip[4]; /**< IPv6 destination address in big endian. */
- uint8_t tc; /**< Traffic class to match. */
- uint8_t proto; /**< Protocol, next header to match. */
- uint8_t hop_limits; /**< Hop limits to match. */
-};
-
-/**
- * A structure used to configure FDIR masks that are used by the device
- * to match the various fields of RX packet headers.
- */
-struct rte_eth_fdir_masks {
- uint16_t vlan_tci_mask; /**< Bit mask for vlan_tci in big endian */
- /** Bit mask for ipv4 flow in big endian. */
- struct rte_eth_ipv4_flow ipv4_mask;
- /** Bit maks for ipv6 flow in big endian. */
- struct rte_eth_ipv6_flow ipv6_mask;
- /** Bit mask for L4 source port in big endian. */
- uint16_t src_port_mask;
- /** Bit mask for L4 destination port in big endian. */
- uint16_t dst_port_mask;
- /** 6 bit mask for proper 6 bytes of Mac address, bit 0 matches the
- first byte on the wire */
- uint8_t mac_addr_byte_mask;
- /** Bit mask for tunnel ID in big endian. */
- uint32_t tunnel_id_mask;
- uint8_t tunnel_type_mask; /**< 1 - Match tunnel type,
- 0 - Ignore tunnel type. */
-};
-
-/**
- * Payload type
- */
-enum rte_eth_payload_type {
- RTE_ETH_PAYLOAD_UNKNOWN = 0,
- RTE_ETH_RAW_PAYLOAD,
- RTE_ETH_L2_PAYLOAD,
- RTE_ETH_L3_PAYLOAD,
- RTE_ETH_L4_PAYLOAD,
- RTE_ETH_PAYLOAD_MAX = 8,
-};
-
-#define RTE_ETH_FDIR_MAX_FLEXLEN 16 /**< Max length of flexbytes. */
-#define RTE_ETH_INSET_SIZE_MAX 128 /**< Max length of input set. */
-
-/**
- * A structure used to select bytes extracted from the protocol layers to
- * flexible payload for filter
- */
-struct rte_eth_flex_payload_cfg {
- enum rte_eth_payload_type type; /**< Payload type */
- uint16_t src_offset[RTE_ETH_FDIR_MAX_FLEXLEN];
- /**< Offset in bytes from the beginning of packet's payload
- src_offset[i] indicates the flexbyte i's offset in original
- packet payload. This value should be less than
- flex_payload_limit in struct rte_eth_fdir_info.*/
-};
-
-/**
- * A structure used to define FDIR masks for flexible payload
- * for each flow type
- */
-struct rte_eth_fdir_flex_mask {
- uint16_t flow_type;
- uint8_t mask[RTE_ETH_FDIR_MAX_FLEXLEN];
- /**< Mask for the whole flexible payload */
-};
-
-
-/*
- * A packet can be identified by hardware as different flow types. Different
- * NIC hardwares may support different flow types.
- * Basically, the NIC hardware identifies the flow type as deep protocol as
- * possible, and exclusively. For example, if a packet is identified as
- * 'RTE_ETH_FLOW_NONFRAG_IPV4_TCP', it will not be any of other flow types,
- * though it is an actual IPV4 packet.
- * Note that the flow types are used to define RSS offload types in
- * rte_ethdev.h.
- */
-#define RTE_ETH_FLOW_UNKNOWN 0
-#define RTE_ETH_FLOW_RAW 1
-#define RTE_ETH_FLOW_IPV4 2
-#define RTE_ETH_FLOW_FRAG_IPV4 3
-#define RTE_ETH_FLOW_NONFRAG_IPV4_TCP 4
-#define RTE_ETH_FLOW_NONFRAG_IPV4_UDP 5
-#define RTE_ETH_FLOW_NONFRAG_IPV4_SCTP 6
-#define RTE_ETH_FLOW_NONFRAG_IPV4_OTHER 7
-#define RTE_ETH_FLOW_IPV6 8
-#define RTE_ETH_FLOW_FRAG_IPV6 9
-#define RTE_ETH_FLOW_NONFRAG_IPV6_TCP 10
-#define RTE_ETH_FLOW_NONFRAG_IPV6_UDP 11
-#define RTE_ETH_FLOW_NONFRAG_IPV6_SCTP 12
-#define RTE_ETH_FLOW_NONFRAG_IPV6_OTHER 13
-#define RTE_ETH_FLOW_L2_PAYLOAD 14
-#define RTE_ETH_FLOW_IPV6_EX 15
-#define RTE_ETH_FLOW_IPV6_TCP_EX 16
-#define RTE_ETH_FLOW_IPV6_UDP_EX 17
-#define RTE_ETH_FLOW_PORT 18
- /**< Consider device port number as a flow differentiator */
-#define RTE_ETH_FLOW_VXLAN 19 /**< VXLAN protocol based flow */
-#define RTE_ETH_FLOW_GENEVE 20 /**< GENEVE protocol based flow */
-#define RTE_ETH_FLOW_NVGRE 21 /**< NVGRE protocol based flow */
-#define RTE_ETH_FLOW_MAX 22
-
-/**
- * A structure used to define all flexible payload related setting
- * include flex payload and flex mask
- */
-struct rte_eth_fdir_flex_conf {
- uint16_t nb_payloads; /**< The number of following payload cfg */
- uint16_t nb_flexmasks; /**< The number of following mask */
- struct rte_eth_flex_payload_cfg flex_set[RTE_ETH_PAYLOAD_MAX];
- /**< Flex payload configuration for each payload type */
- struct rte_eth_fdir_flex_mask flex_mask[RTE_ETH_FLOW_MAX];
- /**< Flex mask configuration for each flow type */
-};
-
-/**
- * A structure used to configure the Flow Director (FDIR) feature
- * of an Ethernet port.
- *
- * If mode is RTE_FDIR_DISABLE, the pballoc value is ignored.
- */
-struct rte_fdir_conf {
- enum rte_fdir_mode mode; /**< Flow Director mode. */
- enum rte_fdir_pballoc_type pballoc; /**< Space for FDIR filters. */
- enum rte_fdir_status_mode status; /**< How to report FDIR hash. */
- /** RX queue of packets matching a "drop" filter in perfect mode. */
- uint8_t drop_queue;
- struct rte_eth_fdir_masks mask;
- struct rte_eth_fdir_flex_conf flex_conf;
- /**< Flex payload configuration. */
-};
-
-/**
- * A structure used to enable/disable specific device interrupts.
- */
-struct rte_intr_conf {
- /** enable/disable lsc interrupt. 0 (default) - disable, 1 enable */
- uint16_t lsc;
- /** enable/disable rxq interrupt. 0 (default) - disable, 1 enable */
- uint16_t rxq;
-};
-
-/**
- * A structure used to configure an Ethernet port.
- * Depending upon the RX multi-queue mode, extra advanced
- * configuration settings may be needed.
- */
-struct rte_eth_conf {
- uint32_t link_speeds; /**< bitmap of ETH_LINK_SPEED_XXX of speeds to be
- used. ETH_LINK_SPEED_FIXED disables link
- autonegotiation, and a unique speed shall be
- set. Otherwise, the bitmap defines the set of
- speeds to be advertised. If the special value
- ETH_LINK_SPEED_AUTONEG (0) is used, all speeds
- supported are advertised. */
- struct rte_eth_rxmode rxmode; /**< Port RX configuration. */
- struct rte_eth_txmode txmode; /**< Port TX configuration. */
- uint32_t lpbk_mode; /**< Loopback operation mode. By default the value
- is 0, meaning the loopback mode is disabled.
- Read the datasheet of given ethernet controller
- for details. The possible values of this field
- are defined in implementation of each driver. */
- struct {
- struct rte_eth_rss_conf rss_conf; /**< Port RSS configuration */
- struct rte_eth_vmdq_dcb_conf vmdq_dcb_conf;
- /**< Port vmdq+dcb configuration. */
- struct rte_eth_dcb_rx_conf dcb_rx_conf;
- /**< Port dcb RX configuration. */
- struct rte_eth_vmdq_rx_conf vmdq_rx_conf;
- /**< Port vmdq RX configuration. */
- } rx_adv_conf; /**< Port RX filtering configuration (union). */
- union {
- struct rte_eth_vmdq_dcb_tx_conf vmdq_dcb_tx_conf;
- /**< Port vmdq+dcb TX configuration. */
- struct rte_eth_dcb_tx_conf dcb_tx_conf;
- /**< Port dcb TX configuration. */
- struct rte_eth_vmdq_tx_conf vmdq_tx_conf;
- /**< Port vmdq TX configuration. */
- } tx_adv_conf; /**< Port TX DCB configuration (union). */
- /** Currently,Priority Flow Control(PFC) are supported,if DCB with PFC
- is needed,and the variable must be set ETH_DCB_PFC_SUPPORT. */
- uint32_t dcb_capability_en;
- struct rte_fdir_conf fdir_conf; /**< FDIR configuration. */
- struct rte_intr_conf intr_conf; /**< Interrupt mode configuration. */
-};
diff --git a/tests/headers/layout_mbuf.h b/tests/headers/layout_mbuf.h
index 0bb653b0..dc1c1b24 100644
--- a/tests/headers/layout_mbuf.h
+++ b/tests/headers/layout_mbuf.h
@@ -1,3 +1,4 @@
+
#define RTE_CACHE_LINE_MIN_SIZE 64 /**< Minimum Cache line size. */
#define RTE_CACHE_LINE_SIZE 64
@@ -183,4 +184,4 @@ struct rte_mbuf {
/** Timesync flags for use with IEEE1588. */
uint16_t timesync;
-} __rte_cache_aligned;
+} __rte_cache_aligned; \ No newline at end of file
diff --git a/tests/headers/layout_mbuf_1_0.h b/tests/headers/layout_mbuf_1_0.h
deleted file mode 100644
index ab8bbb54..00000000
--- a/tests/headers/layout_mbuf_1_0.h
+++ /dev/null
@@ -1,189 +0,0 @@
-// bindgen-flags: --rust-target 1.0
-
-
-#define RTE_CACHE_LINE_MIN_SIZE 64 /**< Minimum Cache line size. */
-
-#define RTE_CACHE_LINE_SIZE 64
-
-typedef char int8_t;
-typedef short int16_t;
-typedef int int32_t;
-typedef long long int64_t;
-
-typedef unsigned char uint8_t;
-typedef unsigned short uint16_t;
-typedef unsigned int uint32_t;
-typedef unsigned long long uint64_t;
-
-typedef uint64_t phys_addr_t;
-
-/**
- * Force alignment
- */
-#define __rte_aligned(a) __attribute__((__aligned__(a)))
-
-/**
- * Force alignment to cache line.
- */
-#define __rte_cache_aligned __rte_aligned(RTE_CACHE_LINE_SIZE)
-
-/**
- * Force minimum cache line alignment.
- */
-#define __rte_cache_min_aligned __rte_aligned(RTE_CACHE_LINE_MIN_SIZE)
-
-/* define a set of marker types that can be used to refer to set points in the
- * mbuf */
-__extension__
-typedef void *MARKER[0]; /**< generic marker for a point in a structure */
-__extension__
-typedef uint8_t MARKER8[0]; /**< generic marker with 1B alignment */
-__extension__
-typedef uint64_t MARKER64[0]; /**< marker that allows us to overwrite 8 bytes
- * with a single assignment */
-
-/** C extension macro for environments lacking C11 features. */
-#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L
-#define RTE_STD_C11 __extension__
-#else
-#define RTE_STD_C11
-#endif
-
-/**
- * The atomic counter structure.
- */
-typedef struct {
- volatile int16_t cnt; /**< An internal counter value. */
-} rte_atomic16_t;
-
-/**
- * The generic rte_mbuf, containing a packet mbuf.
- */
-struct rte_mbuf {
- MARKER cacheline0;
-
- void *buf_addr; /**< Virtual address of segment buffer. */
- phys_addr_t buf_physaddr; /**< Physical address of segment buffer. */
-
- uint16_t buf_len; /**< Length of segment buffer. */
-
- /* next 6 bytes are initialised on RX descriptor rearm */
- MARKER8 rearm_data;
- uint16_t data_off;
-
- /**
- * 16-bit Reference counter.
- * It should only be accessed using the following functions:
- * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and
- * rte_mbuf_refcnt_set(). The functionality of these functions (atomic,
- * or non-atomic) is controlled by the CONFIG_RTE_MBUF_REFCNT_ATOMIC
- * config option.
- */
- RTE_STD_C11
- union {
- rte_atomic16_t refcnt_atomic; /**< Atomically accessed refcnt */
- uint16_t refcnt; /**< Non-atomically accessed refcnt */
- };
- uint8_t nb_segs; /**< Number of segments. */
- uint8_t port; /**< Input port. */
-
- uint64_t ol_flags; /**< Offload features. */
-
- /* remaining bytes are set on RX when pulling packet from descriptor */
- MARKER rx_descriptor_fields1;
-
- /*
- * The packet type, which is the combination of outer/inner L2, L3, L4
- * and tunnel types. The packet_type is about data really present in the
- * mbuf. Example: if vlan stripping is enabled, a received vlan packet
- * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the
- * vlan is stripped from the data.
- */
- RTE_STD_C11
- union {
- uint32_t packet_type; /**< L2/L3/L4 and tunnel information. */
- struct {
- uint32_t l2_type:4; /**< (Outer) L2 type. */
- uint32_t l3_type:4; /**< (Outer) L3 type. */
- uint32_t l4_type:4; /**< (Outer) L4 type. */
- uint32_t tun_type:4; /**< Tunnel type. */
- uint32_t inner_l2_type:4; /**< Inner L2 type. */
- uint32_t inner_l3_type:4; /**< Inner L3 type. */
- uint32_t inner_l4_type:4; /**< Inner L4 type. */
- };
- };
-
- uint32_t pkt_len; /**< Total pkt len: sum of all segments. */
- uint16_t data_len; /**< Amount of data in segment buffer. */
- /** VLAN TCI (CPU order), valid if PKT_RX_VLAN_STRIPPED is set. */
- uint16_t vlan_tci;
-
- union {
- uint32_t rss; /**< RSS hash result if RSS enabled */
- struct {
- RTE_STD_C11
- union {
- struct {
- uint16_t hash;
- uint16_t id;
- };
- uint32_t lo;
- /**< Second 4 flexible bytes */
- };
- uint32_t hi;
- /**< First 4 flexible bytes or FD ID, dependent on
- PKT_RX_FDIR_* flag in ol_flags. */
- } fdir; /**< Filter identifier if FDIR enabled */
- struct {
- uint32_t lo;
- uint32_t hi;
- } sched; /**< Hierarchical scheduler */
- uint32_t usr; /**< User defined tags. See rte_distributor_process() */
- } hash; /**< hash information */
-
- uint32_t seqn; /**< Sequence number. See also rte_reorder_insert() */
-
- /** Outer VLAN TCI (CPU order), valid if PKT_RX_QINQ_STRIPPED is set. */
- uint16_t vlan_tci_outer;
-
- /* second cache line - fields only used in slow path or on TX */
- MARKER cacheline1 __rte_cache_min_aligned;
-
- RTE_STD_C11
- union {
- void *userdata; /**< Can be used for external metadata */
- uint64_t udata64; /**< Allow 8-byte userdata on 32-bit */
- };
-
- struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */
- struct rte_mbuf *next; /**< Next segment of scattered packet. */
-
- /* fields to support TX offloads */
- RTE_STD_C11
- union {
- uint64_t tx_offload; /**< combined for easy fetch */
- __extension__
- struct {
- uint64_t l2_len:7;
- /**< L2 (MAC) Header Length for non-tunneling pkt.
- * Outer_L4_len + ... + Inner_L2_len for tunneling pkt.
- */
- uint64_t l3_len:9; /**< L3 (IP) Header Length. */
- uint64_t l4_len:8; /**< L4 (TCP/UDP) Header Length. */
- uint64_t tso_segsz:16; /**< TCP TSO segment size */
-
- /* fields for TX offloading of tunnels */
- uint64_t outer_l3_len:9; /**< Outer L3 (IP) Hdr Length. */
- uint64_t outer_l2_len:7; /**< Outer L2 (MAC) Hdr Length. */
-
- /* uint64_t unused:8; */
- };
- };
-
- /** Size of the application private data. In case of an indirect
- * mbuf, it stores the direct mbuf private data size. */
- uint16_t priv_size;
-
- /** Timesync flags for use with IEEE1588. */
- uint16_t timesync;
-} __rte_cache_aligned;
diff --git a/tests/headers/struct_with_anon_union_1_0.h b/tests/headers/struct_with_anon_union_1_0.h
deleted file mode 100644
index 5cedd4a3..00000000
--- a/tests/headers/struct_with_anon_union_1_0.h
+++ /dev/null
@@ -1,8 +0,0 @@
-// bindgen-flags: --rust-target 1.0
-
-struct foo {
- union {
- unsigned int a;
- unsigned short b;
- } bar;
-};
diff --git a/tests/headers/struct_with_anon_unnamed_union_1_0.h b/tests/headers/struct_with_anon_unnamed_union_1_0.h
deleted file mode 100644
index 99ee6a2e..00000000
--- a/tests/headers/struct_with_anon_unnamed_union_1_0.h
+++ /dev/null
@@ -1,8 +0,0 @@
-// bindgen-flags: --rust-target 1.0
-
-struct foo {
- union {
- unsigned int a;
- unsigned short b;
- };
-};
diff --git a/tests/headers/struct_with_nesting_1_0.h b/tests/headers/struct_with_nesting_1_0.h
deleted file mode 100644
index c5fbae46..00000000
--- a/tests/headers/struct_with_nesting_1_0.h
+++ /dev/null
@@ -1,19 +0,0 @@
-// bindgen-flags: --rust-target 1.0
-
-struct foo {
- unsigned int a;
- union {
- unsigned int b;
- struct {
- unsigned short c1;
- unsigned short c2;
- };
-
- struct {
- unsigned char d1;
- unsigned char d2;
- unsigned char d3;
- unsigned char d4;
- };
- };
-};
diff --git a/tests/headers/typeref_1_0.hpp b/tests/headers/typeref_1_0.hpp
deleted file mode 100644
index 4a54d9b0..00000000
--- a/tests/headers/typeref_1_0.hpp
+++ /dev/null
@@ -1,30 +0,0 @@
-// bindgen-flags: --rust-target 1.0
-
-struct nsFoo;
-
-namespace mozilla {
-
-struct FragmentOrURL { bool mIsLocalRef; };
-struct Position { };
-
-} // namespace mozilla
-
-class Bar {
- nsFoo* mFoo;
-};
-
-namespace mozilla {
-
-template<typename ReferenceBox>
-struct StyleShapeSource {
- union {
- Position* mPosition;
- FragmentOrURL* mFragmentOrURL;
- };
-};
-
-} // namespace mozilla
-
-struct nsFoo {
- mozilla::StyleShapeSource<int> mBar;
-};
diff --git a/tests/headers/union-in-ns_1_0.hpp b/tests/headers/union-in-ns_1_0.hpp
deleted file mode 100644
index f3ae2210..00000000
--- a/tests/headers/union-in-ns_1_0.hpp
+++ /dev/null
@@ -1,5 +0,0 @@
-// bindgen-flags: --rust-target 1.0 --enable-cxx-namespaces
-
-union bar {
- int baz;
-};
diff --git a/tests/headers/union_dtor_1_0.hpp b/tests/headers/union_dtor_1_0.hpp
deleted file mode 100644
index 01f76366..00000000
--- a/tests/headers/union_dtor_1_0.hpp
+++ /dev/null
@@ -1,7 +0,0 @@
-// bindgen-flags: --rust-target 1.0
-
-union UnionWithDtor {
- ~UnionWithDtor();
- int mFoo;
- void* mBar;
-};
diff --git a/tests/headers/union_fields_1_0.hpp b/tests/headers/union_fields_1_0.hpp
deleted file mode 100644
index fdf94ed7..00000000
--- a/tests/headers/union_fields_1_0.hpp
+++ /dev/null
@@ -1,7 +0,0 @@
-// bindgen-flags: --rust-target 1.0
-
-typedef union {
- int mInt;
- float mFloat;
- void* mPointer;
-} nsStyleUnion;
diff --git a/tests/headers/union_template_1_0.hpp b/tests/headers/union_template_1_0.hpp
deleted file mode 100644
index 53df1175..00000000
--- a/tests/headers/union_template_1_0.hpp
+++ /dev/null
@@ -1,21 +0,0 @@
-// bindgen-flags: --rust-target 1.0
-
-template<typename T>
-struct NastyStruct {
- bool mIsSome;
- union {
- void* mFoo;
- unsigned long mDummy;
- } mStorage;
-
- union {
- short wat;
- int* wut;
- };
-};
-
-template<typename T>
-union Whatever {
- void* mTPtr;
- int mInt;
-};
diff --git a/tests/headers/union_with_anon_struct_1_0.h b/tests/headers/union_with_anon_struct_1_0.h
deleted file mode 100644
index 2672f542..00000000
--- a/tests/headers/union_with_anon_struct_1_0.h
+++ /dev/null
@@ -1,8 +0,0 @@
-// bindgen-flags: --rust-target 1.0
-
-union foo {
- struct {
- unsigned int a;
- unsigned int b;
- } bar;
-};
diff --git a/tests/headers/union_with_anon_struct_bitfield_1_0.h b/tests/headers/union_with_anon_struct_bitfield_1_0.h
deleted file mode 100644
index 168b9bae..00000000
--- a/tests/headers/union_with_anon_struct_bitfield_1_0.h
+++ /dev/null
@@ -1,9 +0,0 @@
-// bindgen-flags: --rust-target 1.0
-
-union foo {
- int a;
- struct {
- int b : 7;
- int c : 25;
- };
-};
diff --git a/tests/headers/union_with_anon_union_1_0.h b/tests/headers/union_with_anon_union_1_0.h
deleted file mode 100644
index 898da16d..00000000
--- a/tests/headers/union_with_anon_union_1_0.h
+++ /dev/null
@@ -1,8 +0,0 @@
-// bindgen-flags: --rust-target 1.0
-
-union foo {
- union {
- unsigned int a;
- unsigned short b;
- } bar;
-};
diff --git a/tests/headers/union_with_anon_unnamed_struct_1_0.h b/tests/headers/union_with_anon_unnamed_struct_1_0.h
deleted file mode 100644
index f086e765..00000000
--- a/tests/headers/union_with_anon_unnamed_struct_1_0.h
+++ /dev/null
@@ -1,11 +0,0 @@
-// bindgen-flags: --rust-target 1.0
-
-union pixel {
- unsigned int rgba;
- struct {
- unsigned char r;
- unsigned char g;
- unsigned char b;
- unsigned char a;
- };
-};
diff --git a/tests/headers/union_with_anon_unnamed_union_1_0.h b/tests/headers/union_with_anon_unnamed_union_1_0.h
deleted file mode 100644
index bbc2f6b4..00000000
--- a/tests/headers/union_with_anon_unnamed_union_1_0.h
+++ /dev/null
@@ -1,9 +0,0 @@
-// bindgen-flags: --rust-target 1.0
-
-union foo {
- unsigned int a;
- union {
- unsigned short b;
- unsigned char c;
- };
-};
diff --git a/tests/headers/union_with_big_member_1_0.h b/tests/headers/union_with_big_member_1_0.h
deleted file mode 100644
index e1faa402..00000000
--- a/tests/headers/union_with_big_member_1_0.h
+++ /dev/null
@@ -1,16 +0,0 @@
-// bindgen-flags: --rust-target 1.0
-
-union WithBigArray {
- int a;
- int b[33];
-};
-
-union WithBigArray2 {
- int a;
- char b[33];
-};
-
-union WithBigMember {
- int a;
- union WithBigArray b;
-};
diff --git a/tests/headers/union_with_nesting_1_0.h b/tests/headers/union_with_nesting_1_0.h
deleted file mode 100644
index 4bd34574..00000000
--- a/tests/headers/union_with_nesting_1_0.h
+++ /dev/null
@@ -1,16 +0,0 @@
-// bindgen-flags: --rust-target 1.0
-
-union foo {
- unsigned int a;
- struct {
- union {
- unsigned short b1;
- unsigned short b2;
- };
-
- union {
- unsigned short c1;
- unsigned short c2;
- };
- };
-};
diff --git a/tests/headers/use-core_1_0.h b/tests/headers/use-core_1_0.h
deleted file mode 100644
index afa54d42..00000000
--- a/tests/headers/use-core_1_0.h
+++ /dev/null
@@ -1,13 +0,0 @@
-// bindgen-flags: --rust-target 1.0 --use-core --raw-line "extern crate core;"
-
-struct foo {
- int a, b;
- void* bar;
-};
-
-union {
- int bar;
- long baz;
-} bazz;
-
-typedef void (*fooFunction)(int bar);