summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan McKay <me@dylanmckay.io>2017-07-06 12:23:56 +1200
committerDylan McKay <me@dylanmckay.io>2017-07-08 11:38:23 +1200
commit239a0154cdab5fa0052f2ce98129e2c169dc1cc4 (patch)
treeb52435287980d77af247fc49b0a3f34dd5bb72ed
parent3bb248ba247c2b8b3433c03102276b925b5025d0 (diff)
Intelligently convert C/C++ comments to Rust
With this change, we can correctly parse C++ block comments. ``` /** * Does a thing * * More documentation. This test does something * useful. */ ``` into ``` /// Does a thing /// /// More documentation. This test does something /// useful. ``` Fixes servo/rust-bindgen#426.
-rw-r--r--src/ir/comment.rs94
-rw-r--r--src/ir/comp.rs3
-rw-r--r--src/ir/enum_ty.rs3
-rw-r--r--src/ir/function.rs3
-rw-r--r--src/ir/item.rs6
-rw-r--r--src/ir/mod.rs1
-rw-r--r--tests/expectations/tests/accessors.rs22
-rw-r--r--tests/expectations/tests/annotation_hide.rs4
-rw-r--r--tests/expectations/tests/class_use_as.rs4
-rw-r--r--tests/expectations/tests/convert-cpp-comment-to-rust.rs46
-rw-r--r--tests/expectations/tests/layout_align.rs12
-rw-r--r--tests/expectations/tests/layout_arp.rs38
-rw-r--r--tests/expectations/tests/layout_array.rs82
-rw-r--r--tests/expectations/tests/layout_array_too_long.rs38
-rw-r--r--tests/expectations/tests/layout_cmdline_token.rs50
-rw-r--r--tests/expectations/tests/layout_eth_conf.rs316
-rw-r--r--tests/expectations/tests/layout_kni_mbuf.rs10
-rw-r--r--tests/expectations/tests/layout_large_align_field.rs76
-rw-r--r--tests/expectations/tests/layout_mbuf.rs80
-rw-r--r--tests/expectations/tests/no-derive-debug.rs8
-rw-r--r--tests/expectations/tests/no-derive-default.rs8
-rw-r--r--tests/expectations/tests/no_copy.rs2
-rw-r--r--tests/expectations/tests/opaque_in_struct.rs2
-rw-r--r--tests/expectations/tests/opaque_pointer.rs8
-rw-r--r--tests/expectations/tests/opaque_typedef.rs2
-rw-r--r--tests/expectations/tests/private.rs8
-rw-r--r--tests/expectations/tests/replace_use.rs4
-rw-r--r--tests/expectations/tests/replaces_double.rs4
-rw-r--r--tests/expectations/tests/template.rs26
-rw-r--r--tests/headers/convert-cpp-comment-to-rust.hpp14
30 files changed, 516 insertions, 458 deletions
diff --git a/src/ir/comment.rs b/src/ir/comment.rs
new file mode 100644
index 00000000..15237b91
--- /dev/null
+++ b/src/ir/comment.rs
@@ -0,0 +1,94 @@
+//! Utilities for manipulating C/C++ comments.
+
+/// The type of a comment.
+#[derive(Debug, PartialEq, Eq)]
+enum Kind {
+ /// A `///` comment, or something of the like.
+ /// All lines in a comment should start with the same symbol.
+ SingleLines,
+ /// A `/**` comment, where each other line can start with `*` and the
+ /// entire block ends with `*/`.
+ MultiLine,
+}
+/// Preprocesses a C/C++ comment so that it is a valid Rust comment.
+pub fn preprocess(comment: String) -> String {
+ match self::kind(&comment) {
+ Some(Kind::SingleLines) => preprocess_single_lines(&comment),
+ Some(Kind::MultiLine) => preprocess_multi_line(&comment),
+ None => comment.to_owned(),
+ }
+}
+
+/// Gets the kind of the doc comment, if it is one.
+fn kind(comment: &str) -> Option<Kind> {
+ if comment.starts_with("/*") {
+ Some(Kind::MultiLine)
+ } else if comment.starts_with("//") {
+ Some(Kind::SingleLines)
+ } else {
+ None
+ }
+}
+
+/// Preprocesses mulitple single line comments.
+///
+/// Handles lines starting with both `//` and `///`.
+fn preprocess_single_lines(comment: &str) -> String {
+ assert!(comment.starts_with("//"), "comment is not single line");
+
+ let lines: Vec<_> = comment.lines()
+ .map(|l| l.trim_left_matches('/').trim())
+ .map(|l| format!("/// {}", l).trim().to_owned())
+ .collect();
+ lines.join("\n")
+}
+
+fn preprocess_multi_line(comment: &str) -> String {
+ let comment = comment.trim_left_matches('/')
+ .trim_left_matches("*")
+ .trim_left_matches("!")
+ .trim_right_matches('/')
+ .trim_right_matches('*')
+ .trim();
+
+ // Strip any potential `*` characters preceding each line.
+ let mut lines: Vec<_> = comment.lines()
+ .map(|line| line.trim().trim_left_matches('*').trim())
+ .skip_while(|line| line.is_empty()) // Skip the first empty lines.
+ .map(|line| format!("/// {}", line).trim().to_owned())
+ .collect();
+
+ // Remove the trailing `*/`.
+ let last_idx = lines.len() - 1;
+ if lines[last_idx].is_empty() {
+ lines.remove(last_idx);
+ }
+
+ lines.join("\n")
+}
+
+#[cfg(test)]
+mod test {
+ use super::*;
+
+ #[test]
+ fn picks_up_single_and_multi_line_doc_comments() {
+ assert_eq!(kind("/// hello"), Some(Kind::SingleLines));
+ assert_eq!(kind("/** world */"), Some(Kind::MultiLine));
+ }
+
+ #[test]
+ fn processes_single_lines_correctly() {
+ assert_eq!(preprocess("/// hello".to_owned()), "/// hello");
+ assert_eq!(preprocess("// hello".to_owned()), "/// hello");
+ }
+
+ #[test]
+ fn processes_multi_lines_correctly() {
+ assert_eq!(preprocess("/** hello \n * world \n * foo \n */".to_owned()),
+ "/// hello\n/// world\n/// foo");
+
+ assert_eq!(preprocess("/**\nhello\n*world\n*foo\n*/".to_owned()),
+ "/// hello\n/// world\n/// foo");
+ }
+}
diff --git a/src/ir/comp.rs b/src/ir/comp.rs
index 6dfc9980..4854949f 100644
--- a/src/ir/comp.rs
+++ b/src/ir/comp.rs
@@ -1,6 +1,7 @@
//! Compound types (unions and structs) in our intermediate representation.
use super::annotations::Annotations;
+use super::comment;
use super::context::{BindgenContext, ItemId};
use super::derive::{CanDeriveCopy, CanDeriveDebug, CanDeriveDefault};
use super::dot::DotAttributes;
@@ -1101,7 +1102,7 @@ impl CompInfo {
Some(potential_id),
ctx);
- let comment = cur.raw_comment();
+ let comment = cur.raw_comment().map(comment::preprocess);
let annotations = Annotations::new(&cur);
let name = cur.spelling();
let is_mutable = cursor.is_mutable_field();
diff --git a/src/ir/enum_ty.rs b/src/ir/enum_ty.rs
index 38de01d9..731961a6 100644
--- a/src/ir/enum_ty.rs
+++ b/src/ir/enum_ty.rs
@@ -1,5 +1,6 @@
//! Intermediate representation for C/C++ enumerations.
+use super::comment;
use super::context::{BindgenContext, ItemId};
use super::item::Item;
use super::ty::TypeKind;
@@ -113,7 +114,7 @@ impl Enum {
})
});
- let comment = cursor.raw_comment();
+ let comment = cursor.raw_comment().map(comment::preprocess);
variants.push(EnumVariant::new(name,
comment,
val,
diff --git a/src/ir/function.rs b/src/ir/function.rs
index 9865997d..299bd65c 100644
--- a/src/ir/function.rs
+++ b/src/ir/function.rs
@@ -1,5 +1,6 @@
//! Intermediate representation for C/C++ functions and methods.
+use super::comment;
use super::context::{BindgenContext, ItemId};
use super::dot::DotAttributes;
use super::item::Item;
@@ -405,7 +406,7 @@ impl ClangSubItemParser for Function {
mangled_name = None;
}
- let comment = cursor.raw_comment();
+ let comment = cursor.raw_comment().map(comment::preprocess);
let function = Self::new(name, mangled_name, sig, comment);
Ok(ParseResult::New(function, Some(cursor)))
diff --git a/src/ir/item.rs b/src/ir/item.rs
index 3564c6e8..540dd791 100644
--- a/src/ir/item.rs
+++ b/src/ir/item.rs
@@ -2,6 +2,7 @@
use super::super::codegen::CONSTIFIED_ENUM_MODULE_REPR_NAME;
use super::annotations::Annotations;
+use super::comment;
use super::context::{BindgenContext, ItemId, PartialType};
use super::derive::{CanDeriveCopy, CanDeriveDebug, CanDeriveDefault};
use super::dot::DotAttributes;
@@ -1001,7 +1002,7 @@ impl ClangItemParser for Item {
return Err(ParseError::Continue);
}
- let comment = cursor.raw_comment();
+ let comment = cursor.raw_comment().map(comment::preprocess);
let annotations = Annotations::new(&cursor);
let current_module = ctx.current_module();
@@ -1207,7 +1208,8 @@ impl ClangItemParser for Item {
};
let comment = decl.raw_comment()
- .or_else(|| location.raw_comment());
+ .or_else(|| location.raw_comment())
+ .map(comment::preprocess);
let annotations = Annotations::new(&decl)
.or_else(|| Annotations::new(&location));
diff --git a/src/ir/mod.rs b/src/ir/mod.rs
index d703e53d..ae67015c 100644
--- a/src/ir/mod.rs
+++ b/src/ir/mod.rs
@@ -5,6 +5,7 @@
pub mod annotations;
pub mod comp;
+pub mod comment;
pub mod context;
pub mod derive;
pub mod dot;
diff --git a/tests/expectations/tests/accessors.rs b/tests/expectations/tests/accessors.rs
index ac02e711..df1732c4 100644
--- a/tests/expectations/tests/accessors.rs
+++ b/tests/expectations/tests/accessors.rs
@@ -8,11 +8,11 @@
#[derive(Debug, Default, Copy)]
pub struct SomeAccessors {
pub mNoAccessor: ::std::os::raw::c_int,
- /** <div rustbindgen accessor></div> */
+ /// <div rustbindgen accessor></div>
pub mBothAccessors: ::std::os::raw::c_int,
- /** <div rustbindgen accessor="unsafe"></div> */
+ /// <div rustbindgen accessor="unsafe"></div>
pub mUnsafeAccessors: ::std::os::raw::c_int,
- /** <div rustbindgen accessor="immutable"></div> */
+ /// <div rustbindgen accessor="immutable"></div>
pub mImmutableAccessor: ::std::os::raw::c_int,
}
#[test]
@@ -68,7 +68,7 @@ impl SomeAccessors {
&self.mImmutableAccessor
}
}
-/** <div rustbindgen accessor></div> */
+/// <div rustbindgen accessor></div>
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct AllAccessors {
@@ -114,7 +114,7 @@ impl AllAccessors {
&mut self.mAlsoBothAccessors
}
}
-/** <div rustbindgen accessor="unsafe"></div> */
+/// <div rustbindgen accessor="unsafe"></div>
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct AllUnsafeAccessors {
@@ -162,16 +162,16 @@ impl AllUnsafeAccessors {
&mut self.mAlsoBothAccessors
}
}
-/** <div rustbindgen accessor></div> */
+/// <div rustbindgen accessor></div>
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct ContradictAccessors {
pub mBothAccessors: ::std::os::raw::c_int,
- /** <div rustbindgen accessor="false"></div> */
+ /// <div rustbindgen accessor="false"></div>
pub mNoAccessors: ::std::os::raw::c_int,
- /** <div rustbindgen accessor="unsafe"></div> */
+ /// <div rustbindgen accessor="unsafe"></div>
pub mUnsafeAccessors: ::std::os::raw::c_int,
- /** <div rustbindgen accessor="immutable"></div> */
+ /// <div rustbindgen accessor="immutable"></div>
pub mImmutableAccessor: ::std::os::raw::c_int,
}
#[test]
@@ -229,7 +229,7 @@ impl ContradictAccessors {
&self.mImmutableAccessor
}
}
-/** <div rustbindgen accessor replaces="Replaced"></div> */
+/// <div rustbindgen accessor replaces="Replaced"></div>
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct Replaced {
@@ -258,7 +258,7 @@ impl Replaced {
&mut self.mAccessor
}
}
-/** <div rustbindgen accessor></div> */
+/// <div rustbindgen accessor></div>
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct Wrapper {
diff --git a/tests/expectations/tests/annotation_hide.rs b/tests/expectations/tests/annotation_hide.rs
index 0b669041..7305091a 100644
--- a/tests/expectations/tests/annotation_hide.rs
+++ b/tests/expectations/tests/annotation_hide.rs
@@ -4,9 +4,7 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-/**
- * <div rustbindgen opaque></div>
- */
+/// <div rustbindgen opaque></div>
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct D {
diff --git a/tests/expectations/tests/class_use_as.rs b/tests/expectations/tests/class_use_as.rs
index 61a78e21..15cc61f6 100644
--- a/tests/expectations/tests/class_use_as.rs
+++ b/tests/expectations/tests/class_use_as.rs
@@ -4,9 +4,7 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-/**
- * <div rustbindgen="true" replaces="whatever"></div>
- */
+/// <div rustbindgen="true" replaces="whatever"></div>
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct whatever {
diff --git a/tests/expectations/tests/convert-cpp-comment-to-rust.rs b/tests/expectations/tests/convert-cpp-comment-to-rust.rs
new file mode 100644
index 00000000..08570f16
--- /dev/null
+++ b/tests/expectations/tests/convert-cpp-comment-to-rust.rs
@@ -0,0 +1,46 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
+
+
+pub type mbedtls_mpi_uint = ::std::os::raw::c_uint;
+/// \brief MPI structure
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct mbedtls_mpi {
+ /// < integer sign
+ pub s: ::std::os::raw::c_int,
+ /// < total # of limbs
+ pub n: ::std::os::raw::c_ulong,
+ /// < pointer to limbs
+ pub p: *mut mbedtls_mpi_uint,
+}
+#[test]
+fn bindgen_test_layout_mbedtls_mpi() {
+ assert_eq!(::std::mem::size_of::<mbedtls_mpi>() , 24usize , concat ! (
+ "Size of: " , stringify ! ( mbedtls_mpi ) ));
+ assert_eq! (::std::mem::align_of::<mbedtls_mpi>() , 8usize , concat ! (
+ "Alignment of " , stringify ! ( mbedtls_mpi ) ));
+ assert_eq! (unsafe {
+ & ( * ( 0 as * const mbedtls_mpi ) ) . s as * const _ as usize
+ } , 0usize , concat ! (
+ "Alignment of field: " , stringify ! ( mbedtls_mpi ) , "::" ,
+ stringify ! ( s ) ));
+ assert_eq! (unsafe {
+ & ( * ( 0 as * const mbedtls_mpi ) ) . n as * const _ as usize
+ } , 8usize , concat ! (
+ "Alignment of field: " , stringify ! ( mbedtls_mpi ) , "::" ,
+ stringify ! ( n ) ));
+ assert_eq! (unsafe {
+ & ( * ( 0 as * const mbedtls_mpi ) ) . p as * const _ as usize
+ } , 16usize , concat ! (
+ "Alignment of field: " , stringify ! ( mbedtls_mpi ) , "::" ,
+ stringify ! ( p ) ));
+}
+impl Clone for mbedtls_mpi {
+ fn clone(&self) -> Self { *self }
+}
+impl Default for mbedtls_mpi {
+ fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+}
diff --git a/tests/expectations/tests/layout_align.rs b/tests/expectations/tests/layout_align.rs
index a8f981e8..c2548938 100644
--- a/tests/expectations/tests/layout_align.rs
+++ b/tests/expectations/tests/layout_align.rs
@@ -40,15 +40,15 @@ impl <T> ::std::marker::Copy for __IncompleteArrayField<T> { }
#[repr(C)]
#[derive(Debug, Copy)]
pub struct rte_kni_fifo {
- /**< Next position to be written*/
+ /// < Next position to be written
pub write: ::std::os::raw::c_uint,
- /**< Next position to be read */
+ /// < Next position to be read
pub read: ::std::os::raw::c_uint,
- /**< Circular buffer length */
+ /// < Circular buffer length
pub len: ::std::os::raw::c_uint,
- /**< Pointer size - for 32/64 bit OS */
+ /// < Pointer size - for 32/64 bit OS
pub elem_size: ::std::os::raw::c_uint,
- /**< The buffer contains mbuf pointers */
+ /// < The buffer contains mbuf pointers
pub buffer: __IncompleteArrayField<*mut ::std::os::raw::c_void>,
pub __bindgen_align: [u64; 0usize],
}
@@ -68,7 +68,7 @@ impl Default for rte_kni_fifo {
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct rte_eth_link {
- /**< ETH_SPEED_NUM_ */
+ /// < ETH_SPEED_NUM_
pub link_speed: u32,
pub _bitfield_1: u8,
pub __bindgen_padding_0: [u8; 3usize],
diff --git a/tests/expectations/tests/layout_arp.rs b/tests/expectations/tests/layout_arp.rs
index 03f4b440..8f853068 100644
--- a/tests/expectations/tests/layout_arp.rs
+++ b/tests/expectations/tests/layout_arp.rs
@@ -12,21 +12,19 @@ pub const ARP_OP_REVREQUEST: ::std::os::raw::c_uint = 3;
pub const ARP_OP_REVREPLY: ::std::os::raw::c_uint = 4;
pub const ARP_OP_INVREQUEST: ::std::os::raw::c_uint = 8;
pub const ARP_OP_INVREPLY: ::std::os::raw::c_uint = 9;
-/**
- * Ethernet address:
- * A universally administered address is uniquely assigned to a device by its
- * manufacturer. The first three octets (in transmission order) contain the
- * Organizationally Unique Identifier (OUI). The following three (MAC-48 and
- * EUI-48) octets are assigned by that organization with the only constraint
- * of uniqueness.
- * A locally administered address is assigned to a device by a network
- * administrator and does not contain OUIs.
- * See http://standards.ieee.org/regauth/groupmac/tutorial.html
- */
+/// Ethernet address:
+/// A universally administered address is uniquely assigned to a device by its
+/// manufacturer. The first three octets (in transmission order) contain the
+/// Organizationally Unique Identifier (OUI). The following three (MAC-48 and
+/// EUI-48) octets are assigned by that organization with the only constraint
+/// of uniqueness.
+/// A locally administered address is assigned to a device by a network
+/// administrator and does not contain OUIs.
+/// See http://standards.ieee.org/regauth/groupmac/tutorial.html
#[repr(C, packed)]
#[derive(Debug, Default, Copy)]
pub struct ether_addr {
- /**< Addr bytes in tx order */
+ /// < Addr bytes in tx order
pub addr_bytes: [u8; 6usize],
}
#[test]
@@ -44,19 +42,17 @@ fn bindgen_test_layout_ether_addr() {
impl Clone for ether_addr {
fn clone(&self) -> Self { *self }
}
-/**
- * ARP header IPv4 payload.
- */
+/// ARP header IPv4 payload.
#[repr(C, packed)]
#[derive(Debug, Default, Copy)]
pub struct arp_ipv4 {
- /**< sender hardware address */
+ /// < sender hardware address
pub arp_sha: ether_addr,
- /**< sender IP address */
+ /// < sender IP address
pub arp_sip: u32,
- /**< target hardware address */
+ /// < target hardware address
pub arp_tha: ether_addr,
- /**< target IP address */
+ /// < target IP address
pub arp_tip: u32,
}
#[test]
@@ -89,9 +85,7 @@ fn bindgen_test_layout_arp_ipv4() {
impl Clone for arp_ipv4 {
fn clone(&self) -> Self { *self }
}
-/**
- * ARP header.
- */
+/// ARP header.
#[repr(C, packed)]
#[derive(Debug, Default, Copy)]
pub struct arp_hdr {
diff --git a/tests/expectations/tests/layout_array.rs b/tests/expectations/tests/layout_array.rs
index 3ca0ffe8..06bc213c 100644
--- a/tests/expectations/tests/layout_array.rs
+++ b/tests/expectations/tests/layout_array.rs
@@ -13,63 +13,53 @@ pub const RTE_HEAP_NUM_FREELISTS: ::std::os::raw::c_uint = 13;
pub struct rte_mempool {
_unused: [u8; 0],
}
-/**
- * Prototype for implementation specific data provisioning function.
- *
- * The function should provide the implementation specific memory for
- * for use by the other mempool ops functions in a given mempool ops struct.
- * E.g. the default ops provides an instance of the rte_ring for this purpose.
- * it will most likely point to a different type of data structure, and
- * will be transparent to the application programmer.
- * This function should set mp->pool_data.
- */
+/// Prototype for implementation specific data provisioning function.
+///
+/// The function should provide the implementation specific memory for
+/// for use by the other mempool ops functions in a given mempool ops struct.
+/// E.g. the default ops provides an instance of the rte_ring for this purpose.
+/// it will most likely point to a different type of data structure, and
+/// will be transparent to the application programmer.
+/// This function should set mp->pool_data.
pub type rte_mempool_alloc_t =
::std::option::Option<unsafe extern "C" fn(mp: *mut rte_mempool)
-> ::std::os::raw::c_int>;
-/**
- * Free the opaque private data pointed to by mp->pool_data pointer.
- */
+/// Free the opaque private data pointed to by mp->pool_data pointer.
pub type rte_mempool_free_t =
::std::option::Option<unsafe extern "C" fn(mp: *mut rte_mempool)>;
-/**
- * Enqueue an object into the external pool.
- */
+/// Enqueue an object into the external pool.
pub type rte_mempool_enqueue_t =
::std::option::Option<unsafe extern "C" fn(mp: *mut rte_mempool,
obj_table:
*const *const ::std::os::raw::c_void,
n: ::std::os::raw::c_uint)
-> ::std::os::raw::c_int>;
-/**
- * Dequeue an object from the external pool.
- */
+/// Dequeue an object from the external pool.
pub type rte_mempool_dequeue_t =
::std::option::Option<unsafe extern "C" fn(mp: *mut rte_mempool,
obj_table:
*mut *mut ::std::os::raw::c_void,
n: ::std::os::raw::c_uint)
-> ::std::os::raw::c_int>;
-/**
- * Return the number of available objects in the external pool.
- */
+/// Return the number of available objects in the external pool.
pub type rte_mempool_get_count =
::std::option::Option<unsafe extern "C" fn(mp: *const rte_mempool)
-> ::std::os::raw::c_uint>;
-/** Structure defining mempool operations structure */
+/// Structure defining mempool operations structure
#[repr(C)]
#[derive(Debug, Copy)]
pub struct rte_mempool_ops {
- /**< Name of mempool ops struct. */
+ /// < Name of mempool ops struct.
pub name: [::std::os::raw::c_char; 32usize],
- /**< Allocate private data. */
+ /// < Allocate private data.
pub alloc: rte_mempool_alloc_t,
- /**< Free the external pool. */
+ /// < Free the external pool.
pub free: rte_mempool_free_t,
- /**< Enqueue an object. */
+ /// < Enqueue an object.
pub enqueue: rte_mempool_enqueue_t,
- /**< Dequeue an object. */
+ /// < Dequeue an object.
pub dequeue: rte_mempool_dequeue_t,
- /**< Get qty of available objs. */
+ /// < Get qty of available objs.
pub get_count: rte_mempool_get_count,
pub __bindgen_padding_0: [u64; 7usize],
}
@@ -114,13 +104,11 @@ impl Clone for rte_mempool_ops {
impl Default for rte_mempool_ops {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
-/**
- * The rte_spinlock_t type.
- */
+/// The rte_spinlock_t type.
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct rte_spinlock_t {
- /**< lock status 0 = unlocked, 1 = locked */
+ /// < lock status 0 = unlocked, 1 = locked
pub locked: ::std::os::raw::c_int,
}
#[test]
@@ -138,26 +126,22 @@ fn bindgen_test_layout_rte_spinlock_t() {
impl Clone for rte_spinlock_t {
fn clone(&self) -> Self { *self }
}
-/**
- * Structure storing the table of registered ops structs, each of which contain
- * the function pointers for the mempool ops functions.
- * Each process has its own storage for this ops struct array so that
- * the mempools can be shared across primary and secondary processes.
- * The indices used to access the array are valid across processes, whereas
- * any function pointers stored directly in the mempool struct would not be.
- * This results in us simply having "ops_index" in the mempool struct.
- */
+/// Structure storing the table of registered ops structs, each of which contain
+/// the function pointers for the mempool ops functions.
+/// Each process has its own storage for this ops struct array so that
+/// the mempools can be shared across primary and secondary processes.
+/// The indices used to access the array are valid across processes, whereas
+/// any function pointers stored directly in the mempool struct would not be.
+/// This results in us simply having "ops_index" in the mempool struct.
#[repr(C)]
#[derive(Debug, Copy)]
pub struct rte_mempool_ops_table {
- /**< Spinlock for add/delete. */
+ /// < Spinlock for add/delete.
pub sl: rte_spinlock_t,
- /**< Number of used ops structs in the table. */
+ /// < Number of used ops structs in the table.
pub num_ops: u32,
pub __bindgen_padding_0: [u64; 7usize],
- /**
- * Storage for all possible ops structs.
- */
+ /// Storage for all possible ops structs.
pub ops: [rte_mempool_ops; 16usize],
}
#[test]
@@ -187,9 +171,7 @@ impl Clone for rte_mempool_ops_table {
impl Default for rte_mempool_ops_table {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
-/**
- * Structure to hold malloc heap
- */
+/// Structure to hold malloc heap
#[repr(C)]
#[derive(Debug, Copy)]
pub struct malloc_heap {
diff --git a/tests/expectations/tests/layout_array_too_long.rs b/tests/expectations/tests/layout_array_too_long.rs
index 2dae536a..b80d0656 100644
--- a/tests/expectations/tests/layout_array_too_long.rs
+++ b/tests/expectations/tests/layout_array_too_long.rs
@@ -18,15 +18,15 @@ pub enum _bindgen_ty_1 {
IP_MIN_FRAG_NUM = 2,
IP_MAX_FRAG_NUM = 4,
}
-/** @internal fragmented mbuf */
+/// @internal fragmented mbuf
#[repr(C)]
#[derive(Debug, Copy)]
pub struct ip_frag {
- /**< offset into the packet */
+ /// < offset into the packet
pub ofs: u16,
- /**< length of fragment */
+ /// < length of fragment
pub len: u16,
- /**< fragment mbuf */
+ /// < fragment mbuf
pub mb: *mut rte_mbuf,
}
#[test]
@@ -57,15 +57,15 @@ impl Clone for ip_frag {
impl Default for ip_frag {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
-/** @internal <src addr, dst_addr, id> to uniquely indetify fragmented datagram. */
+/// @internal <src addr, dst_addr, id> to uniquely indetify fragmented datagram.
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct ip_frag_key {
- /**< src address, first 8 bytes used for IPv4 */
+ /// < src address, first 8 bytes used for IPv4
pub src_dst: [u64; 4usize],
- /**< dst address */
+ /// < dst address
pub id: u32,
- /**< src/dst key length */
+ /// < src/dst key length
pub key_len: u32,
}
#[test]
@@ -93,26 +93,24 @@ fn bindgen_test_layout_ip_frag_key() {
impl Clone for ip_frag_key {
fn clone(&self) -> Self { *self }
}
-/**
- * @internal Fragmented packet to reassemble.
- * First two entries in the frags[] array are for the last and first fragments.
- */
+/// @internal Fragmented packet to reassemble.
+/// First two entries in the frags[] array are for the last and first fragments.
#[repr(C)]
#[derive(Debug, Copy)]
pub struct ip_frag_pkt {
- /**< LRU list */
+ /// < LRU list
pub lru: ip_frag_pkt__bindgen_ty_1,
- /**< fragmentation key */
+ /// < fragmentation key
pub key: ip_frag_key,
- /**< creation timestamp */
+ /// < creation timestamp
pub start: u64,
- /**< expected reassembled size */
+ /// < expected reassembled size
pub total_size: u32,
- /**< size of fragments received */
+ /// < size of fragments received
pub frag_size: u32,
- /**< index of next entry to fill */
+ /// < index of next entry to fill
pub last_idx: u32,
- /**< fragments */
+ /// < fragments
pub frags: [ip_frag; 4usize],
pub __bindgen_padding_0: [u64; 6usize],
}
@@ -196,7 +194,7 @@ impl Clone for ip_frag_pkt {
impl Default for ip_frag_pkt {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
-/**< fragment mbuf */
+/// < fragment mbuf
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct rte_mbuf {
diff --git a/tests/expectations/tests/layout_cmdline_token.rs b/tests/expectations/tests/layout_cmdline_token.rs
index a6113a34..94968579 100644
--- a/tests/expectations/tests/layout_cmdline_token.rs
+++ b/tests/expectations/tests/layout_cmdline_token.rs
@@ -4,10 +4,8 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-/**
- * Stores a pointer to the ops struct, and the offset: the place to
- * write the parsed result in the destination structure.
- */
+/// Stores a pointer to the ops struct, and the offset: the place to
+/// write the parsed result in the destination structure.
#[repr(C)]
#[derive(Debug, Copy)]
pub struct cmdline_token_hdr {
@@ -38,29 +36,27 @@ impl Default for cmdline_token_hdr {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
pub type cmdline_parse_token_hdr_t = cmdline_token_hdr;
-/**
- * A token is defined by this structure.
- *
- * parse() takes the token as first argument, then the source buffer
- * starting at the token we want to parse. The 3rd arg is a pointer
- * where we store the parsed data (as binary). It returns the number of
- * parsed chars on success and a negative value on error.
- *
- * complete_get_nb() returns the number of possible values for this
- * token if completion is possible. If it is NULL or if it returns 0,
- * no completion is possible.
- *
- * complete_get_elt() copy in dstbuf (the size is specified in the
- * parameter) the i-th possible completion for this token. returns 0
- * on success or and a negative value on error.
- *
- * get_help() fills the dstbuf with the help for the token. It returns
- * -1 on error and 0 on success.
- */
+/// A token is defined by this structure.
+///
+/// parse() takes the token as first argument, then the source buffer
+/// starting at the token we want to parse. The 3rd arg is a pointer
+/// where we store the parsed data (as binary). It returns the number of
+/// parsed chars on success and a negative value on error.
+///
+/// complete_get_nb() returns the number of possible values for this
+/// token if completion is possible. If it is NULL or if it returns 0,
+/// no completion is possible.
+///
+/// complete_get_elt() copy in dstbuf (the size is specified in the
+/// parameter) the i-th possible completion for this token. returns 0
+/// on success or and a negative value on error.
+///
+/// get_help() fills the dstbuf with the help for the token. It returns
+/// -1 on error and 0 on success.
#[repr(C)]
#[derive(Debug, Copy)]
pub struct cmdline_token_ops {
- /** parse(token ptr, buf, res pts, buf len) */
+ /// parse(token ptr, buf, res pts, buf len)
pub parse: ::std::option::Option<unsafe extern "C" fn(arg1:
*mut cmdline_parse_token_hdr_t,
arg2:
@@ -70,11 +66,11 @@ pub struct cmdline_token_ops {
arg4:
::std::os::raw::c_uint)
-> ::std::os::raw::c_int>,
- /** return the num of possible choices for this token */
+ /// return the num of possible choices for this token
pub complete_get_nb: ::std::option::Option<unsafe extern "C" fn(arg1:
*mut cmdline_parse_token_hdr_t)
-> ::std::os::raw::c_int>,
- /** return the elt x for this token (token, idx, dstbuf, size) */
+ /// return the elt x for this token (token, idx, dstbuf, size)
pub complete_get_elt: ::std::option::Option<unsafe extern "C" fn(arg1:
*mut cmdline_parse_token_hdr_t,
arg2:
@@ -84,7 +80,7 @@ pub struct cmdline_token_ops {
arg4:
::std::os::raw::c_uint)
-> ::std::os::raw::c_int>,
- /** get help for this token (token, dstbuf, size) */
+ /// get help for this token (token, dstbuf, size)
pub get_help: ::std::option::Option<unsafe extern "C" fn(arg1:
*mut cmdline_parse_token_hdr_t,
arg2:
diff --git a/tests/expectations/tests/layout_eth_conf.rs b/tests/expectations/tests/layout_eth_conf.rs
index d35f8d81..f5cafbfc 100644
--- a/tests/expectations/tests/layout_eth_conf.rs
+++ b/tests/expectations/tests/layout_eth_conf.rs
@@ -61,10 +61,8 @@ 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.
- */
+/// 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,
@@ -76,17 +74,15 @@ pub enum rte_eth_rx_mq_mode {
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.
- */
+/// 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. */
+ /// 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. */
+ /// < Only used if jumbo_frame enabled.
pub max_rx_pkt_len: u32,
- /**< hdr buf size (header_split enabled).*/
+ /// < hdr buf size (header_split enabled).
pub split_hdr_size: u16,
pub _bitfield_1: [u8; 2usize],
}
@@ -487,10 +483,8 @@ impl rte_eth_rxmode {
}
}
#[repr(u32)]
-/**
- * A set of values to identify what method is to be used to transmit
- * packets using multi-TCs.
- */
+/// 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,
@@ -498,13 +492,11 @@ pub enum rte_eth_tx_mq_mode {
ETH_MQ_TX_VMDQ_DCB = 2,
ETH_MQ_TX_VMDQ_ONLY = 3,
}
-/**
- * A structure used to configure the TX features of an Ethernet port.
- */
+/// 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. */
+ /// < TX multi-queues mode.
pub mq_mode: rte_eth_tx_mq_mode,
pub pvid: u16,
pub _bitfield_1: u8,
@@ -657,31 +649,29 @@ impl rte_eth_txmode {
} | ((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.
- */
+/// 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. */
+ /// < If not NULL, 40-byte hash key.
pub rss_key: *mut u8,
- /**< hash key length in bytes. */
+ /// < hash key length in bytes.
pub rss_key_len: u8,
- /**< Hash functions to apply - see below. */
+ /// < Hash functions to apply - see below.
pub rss_hf: u64,
}
#[test]
@@ -713,17 +703,13 @@ 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
- */
+/// 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.
- */
+/// 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,
@@ -731,37 +717,35 @@ pub enum rte_eth_nb_pools {
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.
- */
+/// 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)]
pub struct rte_eth_vmdq_dcb_conf {
- /**< With DCB, 16 or 32 pools */
+ /// < With DCB, 16 or 32 pools
pub nb_queue_pools: rte_eth_nb_pools,
- /**< If non-zero, use a default pool */
+ /// < If non-zero, use a default pool
pub enable_default_pool: u8,
- /**< The default pool, if applicable */
+ /// < The default pool, if applicable
pub default_pool: u8,
- /**< We can have up to 64 filters/mappings */
+ /// < We can have up to 64 filters/mappings
pub nb_pool_maps: u8,
- /**< VMDq vlan pool maps. */
+ /// < 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 */
+ /// < The vlan id of the received frame
pub vlan_id: u16,
- /**< Bitmask of pools for packet rx */
+ /// < Bitmask of pools for packet rx
pub pools: u64,
}
#[test]
@@ -836,9 +820,9 @@ impl Default for rte_eth_vmdq_dcb_conf {
#[repr(C)]
#[derive(Debug, Copy)]
pub struct rte_eth_dcb_rx_conf {
- /**< Possible DCB TCs, 4 or 8 TCs */
+ /// < Possible DCB TCs, 4 or 8 TCs
pub nb_tcs: rte_eth_nb_tcs,
- /** Traffic class each UP mapped to. */
+ /// Traffic class each UP mapped to.
pub dcb_tc: [u8; 8usize],
}
#[test]
@@ -868,9 +852,9 @@ impl Default for rte_eth_dcb_rx_conf {
#[repr(C)]
#[derive(Debug, Copy)]
pub struct rte_eth_vmdq_dcb_tx_conf {
- /**< With DCB, 16 or 32 pools. */
+ /// < With DCB, 16 or 32 pools.
pub nb_queue_pools: rte_eth_nb_pools,
- /** Traffic class each UP mapped to. */
+ /// Traffic class each UP mapped to.
pub dcb_tc: [u8; 8usize],
}
#[test]
@@ -902,9 +886,9 @@ impl Default for rte_eth_vmdq_dcb_tx_conf {
#[repr(C)]
#[derive(Debug, Copy)]
pub struct rte_eth_dcb_tx_conf {
- /**< Possible DCB TCs, 4 or 8 TCs. */
+ /// < Possible DCB TCs, 4 or 8 TCs.
pub nb_tcs: rte_eth_nb_tcs,
- /** Traffic class each UP mapped to. */
+ /// Traffic class each UP mapped to.
pub dcb_tc: [u8; 8usize],
}
#[test]
@@ -934,7 +918,7 @@ impl Default for rte_eth_dcb_tx_conf {
#[repr(C)]
#[derive(Debug, Copy)]
pub struct rte_eth_vmdq_tx_conf {
- /**< VMDq mode, 64 pools. */
+ /// < VMDq mode, 64 pools.
pub nb_queue_pools: rte_eth_nb_pools,
}
#[test]
@@ -958,27 +942,27 @@ impl Default for rte_eth_vmdq_tx_conf {
}
#[repr(C)]
pub struct rte_eth_vmdq_rx_conf {
- /**< VMDq only mode, 8 or 64 pools */
+ /// < VMDq only mode, 8 or 64 pools
pub nb_queue_pools: rte_eth_nb_pools,
- /**< If non-zero, use a default pool */
+ /// < If non-zero, use a default pool
pub enable_default_pool: u8,
- /**< The default pool, if applicable */
+ /// < The default pool, if applicable
pub default_pool: u8,
- /**< Enable VT loop back */
+ /// < Enable VT loop back
pub enable_loop_back: u8,
- /**< We can have up to 64 filters/mappings */
+ /// < We can have up to 64 filters/mappings
pub nb_pool_maps: u8,
- /**< Flags from ETH_VMDQ_ACCEPT_* */
+ /// < Flags from ETH_VMDQ_ACCEPT_*
pub rx_mode: u32,
- /**< VMDq vlan pool maps. */
+ /// < 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 */
+ /// < The vlan id of the received frame
pub vlan_id: u16,
- /**< Bitmask of pools for packet rx */
+ /// < Bitmask of pools for packet rx
pub pools: u64,
}
#[test]
@@ -1056,9 +1040,7 @@ 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.
- */
+/// 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,
@@ -1068,10 +1050,8 @@ pub enum rte_fdir_mode {
RTE_FDIR_MODE_PERFECT_TUNNEL = 4,
}
#[repr(u32)]
-/**
- * Memory space that can be configured to store Flow Director filters
- * in the board memory.
- */
+/// 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,
@@ -1079,30 +1059,26 @@ pub enum rte_fdir_pballoc_type {
RTE_FDIR_PBALLOC_256K = 2,
}
#[repr(u32)]
-/**
- * Select report mode of FDIR hash information in RX descriptors.
- */
+/// 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
- */
+/// 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. */
+ /// < IPv4 source address in big endian.
pub src_ip: u32,
- /**< IPv4 destination address in big endian. */
+ /// < IPv4 destination address in big endian.
pub dst_ip: u32,
- /**< Type of service to match. */
+ /// < Type of service to match.
pub tos: u8,
- /**< Time to live to match. */
+ /// < Time to live to match.
pub ttl: u8,
- /**< Protocol, next header in big endian. */
+ /// < Protocol, next header in big endian.
pub proto: u8,
}
#[test]
@@ -1140,21 +1116,19 @@ fn bindgen_test_layout_rte_eth_ipv4_flow() {
impl Clone for rte_eth_ipv4_flow {
fn clone(&self) -> Self { *self }
}
-/**
- * A structure used to define the input for IPV6 flow
- */
+/// 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. */
+ /// < IPv6 source address in big endian.
pub src_ip: [u32; 4usize],
- /**< IPv6 destination address in big endian. */
+ /// < IPv6 destination address in big endian.
pub dst_ip: [u32; 4usize],
- /**< Traffic class to match. */
+ /// < Traffic class to match.
pub tc: u8,
- /**< Protocol, next header to match. */
+ /// < Protocol, next header to match.
pub proto: u8,
- /**< Hop limits to match. */
+ /// < Hop limits to match.
pub hop_limits: u8,
}
#[test]
@@ -1192,30 +1166,28 @@ fn bindgen_test_layout_rte_eth_ipv6_flow() {
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.
- */
+/// 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 */
+ /// < Bit mask for vlan_tci in big endian
pub vlan_tci_mask: u16,
- /** Bit mask for ipv4 flow in big endian. */
+ /// Bit mask for ipv4 flow in big endian.
pub ipv4_mask: rte_eth_ipv4_flow,
- /** Bit maks for ipv6 flow in big endian. */
+ /// Bit maks for ipv6 flow in big endian.
pub ipv6_mask: rte_eth_ipv6_flow,
- /** Bit mask for L4 source port in big endian. */
+ /// Bit mask for L4 source port in big endian.
pub src_port_mask: u16,
- /** Bit mask for L4 destination port in big endian. */
+ /// 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 */
+ /// 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. */
+ /// Bit mask for tunnel ID in big endian.
pub tunnel_id_mask: u32,
- /**< 1 - Match tunnel type,
- 0 - Ignore tunnel type. */
+ /// < 1 - Match tunnel type,
+/// 0 - Ignore tunnel type.
pub tunnel_type_mask: u8,
}
#[test]
@@ -1270,9 +1242,7 @@ impl Clone for rte_eth_fdir_masks {
fn clone(&self) -> Self { *self }
}
#[repr(u32)]
-/**
- * Payload type
- */
+/// Payload type
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum rte_eth_payload_type {
RTE_ETH_PAYLOAD_UNKNOWN = 0,
@@ -1282,14 +1252,12 @@ pub enum rte_eth_payload_type {
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
- */
+/// 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 */
+ /// < Payload type
pub type_: rte_eth_payload_type,
pub src_offset: [u16; 16usize],
}
@@ -1319,10 +1287,8 @@ impl Clone for rte_eth_flex_payload_cfg {
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
- */
+/// 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 {
@@ -1351,16 +1317,14 @@ fn bindgen_test_layout_rte_eth_fdir_flex_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
- */
+/// 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 */
+ /// < The number of following payload cfg
pub nb_payloads: u16,
- /**< The number of following mask */
+ /// < 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],
@@ -1400,22 +1364,20 @@ impl Clone for rte_eth_fdir_flex_conf {
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.
- */
+/// 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. */
+ /// < Flow Director mode.
pub mode: rte_fdir_mode,
- /**< Space for FDIR filters. */
+ /// < Space for FDIR filters.
pub pballoc: rte_fdir_pballoc_type,
- /**< How to report FDIR hash. */
+ /// < How to report FDIR hash.
pub status: rte_fdir_status_mode,
- /** RX queue of packets matching a "drop" filter in perfect 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,
@@ -1463,15 +1425,13 @@ impl Clone for rte_fdir_conf {
impl Default for rte_fdir_conf {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
-/**
- * A structure used to enable/disable specific device interrupts.
- */
+/// 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 */
+ /// enable/disable lsc interrupt. 0 (default) - disable, 1 enable
pub lsc: u16,
- /** enable/disable rxq interrupt. 0 (default) - disable, 1 enable */
+ /// enable/disable rxq interrupt. 0 (default) - disable, 1 enable
pub rxq: u16,
}
#[test]
@@ -1494,46 +1454,44 @@ fn bindgen_test_layout_rte_intr_conf() {
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.
- */
+/// A structure used to configure an Ethernet port.
+/// Depending upon the RX multi-queue mode, extra advanced
+/// configuration settings may be needed.
#[repr(C)]
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. */
+ /// < 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. */
+ /// < Port RX configuration.
pub rxmode: rte_eth_rxmode,
- /**< Port TX configuration. */
+ /// < 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. */
+ /// < 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). */
+ /// < Port RX filtering configuration (union).
pub rx_adv_conf: rte_eth_conf__bindgen_ty_1,
- /**< Port TX DCB configuration (union). */
+ /// < 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. */
+ /// 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. */
+ /// < FDIR configuration.
pub fdir_conf: rte_fdir_conf,
- /**< Interrupt mode configuration. */
+ /// < Interrupt mode configuration.
pub intr_conf: rte_intr_conf,
}
#[repr(C)]
pub struct rte_eth_conf__bindgen_ty_1 {
- /**< Port RSS configuration */
+ /// < 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,
diff --git a/tests/expectations/tests/layout_kni_mbuf.rs b/tests/expectations/tests/layout_kni_mbuf.rs
index 556afcc2..f86fee57 100644
--- a/tests/expectations/tests/layout_kni_mbuf.rs
+++ b/tests/expectations/tests/layout_kni_mbuf.rs
@@ -12,18 +12,18 @@ pub struct rte_kni_mbuf {
pub buf_addr: *mut ::std::os::raw::c_void,
pub buf_physaddr: u64,
pub pad0: [::std::os::raw::c_char; 2usize],
- /**< Start address of data in segment buffer. */
+ /// < Start address of data in segment buffer.
pub data_off: u16,
pub pad1: [::std::os::raw::c_char; 2usize],
- /**< Number of segments. */
+ /// < Number of segments.
pub nb_segs: u8,
pub pad4: [::std::os::raw::c_char; 1usize],
- /**< Offload features. */
+ /// < Offload features.
pub ol_flags: u64,
pub pad2: [::std::os::raw::c_char; 4usize],
- /**< Total pkt len: sum of all segment data_len. */
+ /// < Total pkt len: sum of all segment data_len.
pub pkt_len: u32,
- /**< Amount of data in segment buffer. */
+ /// < Amount of data in segment buffer.
pub data_len: u16,
pub __bindgen_padding_0: [u8; 22usize],
pub pad3: [::std::os::raw::c_char; 8usize],
diff --git a/tests/expectations/tests/layout_large_align_field.rs b/tests/expectations/tests/layout_large_align_field.rs
index 09868689..40de09d3 100644
--- a/tests/expectations/tests/layout_large_align_field.rs
+++ b/tests/expectations/tests/layout_large_align_field.rs
@@ -51,15 +51,15 @@ pub enum _bindgen_ty_1 {
IP_MIN_FRAG_NUM = 2,
IP_MAX_FRAG_NUM = 4,
}
-/** @internal fragmented mbuf */
+/// @internal fragmented mbuf
#[repr(C)]
#[derive(Debug, Copy)]
pub struct ip_frag {
- /**< offset into the packet */
+ /// < offset into the packet
pub ofs: u16,
- /**< length of fragment */
+ /// < length of fragment
pub len: u16,
- /**< fragment mbuf */
+ /// < fragment mbuf
pub mb: *mut rte_mbuf,
}
#[test]
@@ -90,15 +90,15 @@ impl Clone for ip_frag {
impl Default for ip_frag {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
-/** @internal <src addr, dst_addr, id> to uniquely indetify fragmented datagram. */
+/// @internal <src addr, dst_addr, id> to uniquely indetify fragmented datagram.
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct ip_frag_key {
- /**< src address, first 8 bytes used for IPv4 */
+ /// < src address, first 8 bytes used for IPv4
pub src_dst: [u64; 4usize],
- /**< dst address */
+ /// < dst address
pub id: u32,
- /**< src/dst key length */
+ /// < src/dst key length
pub key_len: u32,
}
#[test]
@@ -126,26 +126,24 @@ fn bindgen_test_layout_ip_frag_key() {
impl Clone for ip_frag_key {
fn clone(&self) -> Self { *self }
}
-/**
- * @internal Fragmented packet to reassemble.
- * First two entries in the frags[] array are for the last and first fragments.
- */
+/// @internal Fragmented packet to reassemble.
+/// First two entries in the frags[] array are for the last and first fragments.
#[repr(C)]
#[derive(Debug, Copy)]
pub struct ip_frag_pkt {
- /**< LRU list */
+ /// < LRU list
pub lru: ip_frag_pkt__bindgen_ty_1,
- /**< fragmentation key */
+ /// < fragmentation key
pub key: ip_frag_key,
- /**< creation timestamp */
+ /// < creation timestamp
pub start: u64,
- /**< expected reassembled size */
+ /// < expected reassembled size
pub total_size: u32,
- /**< size of fragments received */
+ /// < size of fragments received
pub frag_size: u32,
- /**< index of next entry to fill */
+ /// < index of next entry to fill
pub last_idx: u32,
- /**< fragments */
+ /// < fragments
pub frags: [ip_frag; 4usize],
pub __bindgen_padding_0: [u64; 6usize],
}
@@ -258,21 +256,21 @@ impl Clone for ip_pkt_list {
impl Default for ip_pkt_list {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
-/** fragmentation table statistics */
+/// fragmentation table statistics
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct ip_frag_tbl_stat {
- /**< total # of find/insert attempts. */
+ /// < total # of find/insert attempts.
pub find_num: u64,
- /**< # of add ops. */
+ /// < # of add ops.
pub add_num: u64,
- /**< # of del ops. */
+ /// < # of del ops.
pub del_num: u64,
- /**< # of reuse (del/add) ops. */
+ /// < # of reuse (del/add) ops.
pub reuse_num: u64,
- /**< total # of add failures. */
+ /// < total # of add failures.
pub fail_total: u64,
- /**< # of 'no space' add failures. */
+ /// < # of 'no space' add failures.
pub fail_nospace: u64,
pub __bindgen_padding_0: [u64; 2usize],
}
@@ -314,32 +312,32 @@ fn bindgen_test_layout_ip_frag_tbl_stat() {
impl Clone for ip_frag_tbl_stat {
fn clone(&self) -> Self { *self }
}
-/** fragmentation table */
+/// fragmentation table
#[repr(C)]
#[derive(Debug, Copy)]
pub struct rte_ip_frag_tbl {
- /**< ttl for table entries. */
+ /// < ttl for table entries.
pub max_cycles: u64,
- /**< hash value mask. */
+ /// < hash value mask.
pub entry_mask: u32,
- /**< max entries allowed. */
+ /// < max entries allowed.
pub max_entries: u32,
- /**< entries in use. */
+ /// < entries in use.
pub use_entries: u32,
- /**< hash assocaitivity. */
+ /// < hash assocaitivity.
pub bucket_entries: u32,
- /**< total size of the table. */
+ /// < total size of the table.
pub nb_entries: u32,
- /**< num of associativity lines. */
+ /// < num of associativity lines.
pub nb_buckets: u32,
- /**< last used entry. */
+ /// < last used entry.
pub last: *mut ip_frag_pkt,
- /**< LRU list for table entries. */
+ /// < LRU list for table entries.
pub lru: ip_pkt_list,
pub __bindgen_padding_0: u64,
- /**< statistics counters. */
+ /// < statistics counters.
pub stat: ip_frag_tbl_stat,
- /**< hash table. */
+ /// < hash table.
pub pkt: __IncompleteArrayField<ip_frag_pkt>,
}
#[test]
@@ -408,7 +406,7 @@ impl Clone for rte_ip_frag_tbl {
impl Default for rte_ip_frag_tbl {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
-/**< fragment mbuf */
+/// < fragment mbuf
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct rte_mbuf {
diff --git a/tests/expectations/tests/layout_mbuf.rs b/tests/expectations/tests/layout_mbuf.rs
index d0598e62..e527ac92 100644
--- a/tests/expectations/tests/layout_mbuf.rs
+++ b/tests/expectations/tests/layout_mbuf.rs
@@ -34,13 +34,11 @@ 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.
- */
+/// The atomic counter structure.
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct rte_atomic16_t {
- /**< An internal counter value. */
+ /// < An internal counter value.
pub cnt: i16,
}
#[test]
@@ -58,70 +56,66 @@ fn bindgen_test_layout_rte_atomic16_t() {
impl Clone for rte_atomic16_t {
fn clone(&self) -> Self { *self }
}
-/**
- * The generic rte_mbuf, containing a packet mbuf.
- */
+/// The generic rte_mbuf, containing a packet mbuf.
#[repr(C)]
#[derive(Debug, Copy)]
pub struct rte_mbuf {
pub cacheline0: MARKER,
- /**< Virtual address of segment buffer. */
+ /// < Virtual address of segment buffer.
pub buf_addr: *mut ::std::os::raw::c_void,
- /**< Physical address of segment buffer. */
+ /// < Physical address of segment buffer.
pub buf_physaddr: phys_addr_t,
- /**< Length of segment buffer. */
+ /// < 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. */
+ /// < Number of segments.
pub nb_segs: u8,
- /**< Input port. */
+ /// < Input port.
pub port: u8,
- /**< Offload features. */
+ /// < 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. */
+ /// < Total pkt len: sum of all segments.
pub pkt_len: u32,
- /**< Amount of data in segment buffer. */
+ /// < Amount of data in segment buffer.
pub data_len: u16,
- /** VLAN TCI (CPU order), valid if PKT_RX_VLAN_STRIPPED is set. */
+ /// VLAN TCI (CPU order), valid if PKT_RX_VLAN_STRIPPED is set.
pub vlan_tci: u16,
- /**< hash information */
+ /// < hash information
pub hash: rte_mbuf__bindgen_ty_3,
- /**< Sequence number. See also rte_reorder_insert() */
+ /// < Sequence number. See also rte_reorder_insert()
pub seqn: u32,
- /** Outer VLAN TCI (CPU order), valid if PKT_RX_QINQ_STRIPPED is set. */
+ /// 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. */
+ /// < Pool from which mbuf was allocated.
pub pool: *mut rte_mempool,
- /**< Next segment of scattered packet. */
+ /// < 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. */
+ /// 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. */
+ /// 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.
- */
+/// 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 */
+ /// < Atomically accessed refcnt
pub refcnt_atomic: __BindgenUnionField<rte_atomic16_t>,
- /**< Non-atomically accessed refcnt */
+ /// < Non-atomically accessed refcnt
pub refcnt: __BindgenUnionField<u16>,
pub bindgen_union_field: u16,
}
@@ -150,7 +144,7 @@ impl Clone for rte_mbuf__bindgen_ty_1 {
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct rte_mbuf__bindgen_ty_2 {
- /**< L2/L3/L4 and tunnel information. */
+ /// < 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,
@@ -481,13 +475,13 @@ impl Clone for rte_mbuf__bindgen_ty_2 {
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct rte_mbuf__bindgen_ty_3 {
- /**< RSS hash result if RSS enabled */
+ /// < RSS hash result if RSS enabled
pub rss: __BindgenUnionField<u32>,
- /**< Filter identifier if FDIR enabled */
+ /// < Filter identifier if FDIR enabled
pub fdir: __BindgenUnionField<rte_mbuf__bindgen_ty_3__bindgen_ty_1>,
- /**< Hierarchical scheduler */
+ /// < Hierarchical scheduler
pub sched: __BindgenUnionField<rte_mbuf__bindgen_ty_3__bindgen_ty_2>,
- /**< User defined tags. See rte_distributor_process() */
+ /// < User defined tags. See rte_distributor_process()
pub usr: __BindgenUnionField<u32>,
pub bindgen_union_field: [u32; 2usize],
}
@@ -655,9 +649,9 @@ impl Clone for rte_mbuf__bindgen_ty_3 {
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct rte_mbuf__bindgen_ty_4 {
- /**< Can be used for external metadata */
+ /// < Can be used for external metadata
pub userdata: __BindgenUnionField<*mut ::std::os::raw::c_void>,
- /**< Allow 8-byte userdata on 32-bit */
+ /// < Allow 8-byte userdata on 32-bit
pub udata64: __BindgenUnionField<u64>,
pub bindgen_union_field: u64,
}
@@ -686,7 +680,7 @@ impl Clone for rte_mbuf__bindgen_ty_4 {
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct rte_mbuf__bindgen_ty_5 {
- /**< combined for easy fetch */
+ /// < 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,
@@ -1090,7 +1084,7 @@ impl Clone for rte_mbuf {
impl Default for rte_mbuf {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
-/**< Pool from which mbuf was allocated. */
+/// < Pool from which mbuf was allocated.
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct rte_mempool {
diff --git a/tests/expectations/tests/no-derive-debug.rs b/tests/expectations/tests/no-derive-debug.rs
index da320e7e..0de55fab 100644
--- a/tests/expectations/tests/no-derive-debug.rs
+++ b/tests/expectations/tests/no-derive-debug.rs
@@ -5,11 +5,9 @@
#[repr(C)] #[derive(Copy, Clone, Default)] pub struct foo { bar: ::std::os::raw::c_int, }
-/**
- * bar should compile. It will normally derive debug, but our blacklist of foo
- * and replacement for another type that doesn't implement it would prevent it
- * from building if --no-derive-debug didn't work.
- */
+/// bar should compile. It will normally derive debug, but our blacklist of foo
+/// and replacement for another type that doesn't implement it would prevent it
+/// from building if --no-derive-debug didn't work.
#[repr(C)]
#[derive(Default, Copy)]
pub struct bar {
diff --git a/tests/expectations/tests/no-derive-default.rs b/tests/expectations/tests/no-derive-default.rs
index 544c29e3..c212f4bd 100644
--- a/tests/expectations/tests/no-derive-default.rs
+++ b/tests/expectations/tests/no-derive-default.rs
@@ -5,11 +5,9 @@
#[repr(C)] #[derive(Copy, Clone, Debug)] pub struct foo { bar: ::std::os::raw::c_int, }
-/**
- * bar should compile. It will normally derive default, but our blacklist of foo
- * and replacement for another type that doesn't implement it would prevent it
- * from building if --no-derive-default didn't work.
- */
+/// bar should compile. It will normally derive default, but our blacklist of foo
+/// and replacement for another type that doesn't implement it would prevent it
+/// from building if --no-derive-default didn't work.
#[repr(C)]
#[derive(Debug, Copy)]
pub struct bar {
diff --git a/tests/expectations/tests/no_copy.rs b/tests/expectations/tests/no_copy.rs
index 0560c37e..ca28bdeb 100644
--- a/tests/expectations/tests/no_copy.rs
+++ b/tests/expectations/tests/no_copy.rs
@@ -4,7 +4,7 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-/** <div rustbindgen nocopy></div> */
+/// <div rustbindgen nocopy></div>
#[repr(C)]
#[derive(Debug, Default)]
pub struct CopiableButWait {
diff --git a/tests/expectations/tests/opaque_in_struct.rs b/tests/expectations/tests/opaque_in_struct.rs
index 9ca0b667..d41cbf10 100644
--- a/tests/expectations/tests/opaque_in_struct.rs
+++ b/tests/expectations/tests/opaque_in_struct.rs
@@ -4,7 +4,7 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-/** <div rustbindgen opaque> */
+/// <div rustbindgen opaque>
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct opaque {
diff --git a/tests/expectations/tests/opaque_pointer.rs b/tests/expectations/tests/opaque_pointer.rs
index 1222b374..68f8132d 100644
--- a/tests/expectations/tests/opaque_pointer.rs
+++ b/tests/expectations/tests/opaque_pointer.rs
@@ -4,9 +4,7 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-/**
- * <div rustbindgen opaque></div>
- */
+/// <div rustbindgen opaque></div>
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct OtherOpaque {
@@ -22,9 +20,7 @@ fn bindgen_test_layout_OtherOpaque() {
impl Clone for OtherOpaque {
fn clone(&self) -> Self { *self }
}
-/**
- * <div rustbindgen opaque></div>
- */
+/// <div rustbindgen opaque></div>
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Opaque {
diff --git a/tests/expectations/tests/opaque_typedef.rs b/tests/expectations/tests/opaque_typedef.rs
index 31742854..a19a71ac 100644
--- a/tests/expectations/tests/opaque_typedef.rs
+++ b/tests/expectations/tests/opaque_typedef.rs
@@ -9,6 +9,6 @@
pub struct RandomTemplate {
pub _address: u8,
}
-/** <div rustbindgen opaque></div> */
+/// <div rustbindgen opaque></div>
pub type ShouldBeOpaque = u8;
pub type ShouldNotBeOpaque = RandomTemplate;
diff --git a/tests/expectations/tests/private.rs b/tests/expectations/tests/private.rs
index 301ce230..e29ad1ba 100644
--- a/tests/expectations/tests/private.rs
+++ b/tests/expectations/tests/private.rs
@@ -8,7 +8,7 @@
#[derive(Debug, Default, Copy)]
pub struct HasPrivate {
pub mNotPrivate: ::std::os::raw::c_int,
- /** <div rustbindgen private></div> */
+ /// <div rustbindgen private></div>
mIsPrivate: ::std::os::raw::c_int,
}
#[test]
@@ -31,7 +31,7 @@ fn bindgen_test_layout_HasPrivate() {
impl Clone for HasPrivate {
fn clone(&self) -> Self { *self }
}
-/** <div rustbindgen private></div> */
+/// <div rustbindgen private></div>
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct VeryPrivate {
@@ -58,11 +58,11 @@ fn bindgen_test_layout_VeryPrivate() {
impl Clone for VeryPrivate {
fn clone(&self) -> Self { *self }
}
-/** <div rustbindgen private></div> */
+/// <div rustbindgen private></div>
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct ContradictPrivate {
- /** <div rustbindgen private="false"></div> */
+ /// <div rustbindgen private="false"></div>
pub mNotPrivate: ::std::os::raw::c_int,
mIsPrivate: ::std::os::raw::c_int,
}
diff --git a/tests/expectations/tests/replace_use.rs b/tests/expectations/tests/replace_use.rs
index 4d313530..cbbee381 100644
--- a/tests/expectations/tests/replace_use.rs
+++ b/tests/expectations/tests/replace_use.rs
@@ -4,9 +4,7 @@
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
-/**
- * <div rustbindgen replaces="nsTArray"></div>
- */
+/// <div rustbindgen replaces="nsTArray"></div>
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct nsTArray {
diff --git a/tests/expectations/tests/replaces_double.rs b/tests/expectations/tests/replaces_double.rs
index b2670893..7f8127fd 100644
--- a/tests/expectations/tests/replaces_double.rs
+++ b/tests/expectations/tests/replaces_double.rs
@@ -20,9 +20,7 @@ pub struct Rooted<T> {
pub ptr: Rooted_MaybeWrapped<T>,
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
}
-/**
- * <div rustbindgen replaces="Rooted_MaybeWrapped"></div>
- */
+/// <div rustbindgen replaces="Rooted_MaybeWrapped"></div>
pub type Rooted_MaybeWrapped<T> = T;
impl <T> Default for Rooted<T> {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
diff --git a/tests/expectations/tests/template.rs b/tests/expectations/tests/template.rs
index e666ee38..74dcd99c 100644
--- a/tests/expectations/tests/template.rs
+++ b/tests/expectations/tests/template.rs
@@ -102,7 +102,7 @@ fn bindgen_test_layout_PODButContainsDtor() {
impl Default for PODButContainsDtor {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
-/** <div rustbindgen opaque> */
+/// <div rustbindgen opaque>
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Opaque {
@@ -130,9 +130,7 @@ fn bindgen_test_layout_POD() {
impl Clone for POD {
fn clone(&self) -> Self { *self }
}
-/**
- * <div rustbindgen replaces="NestedReplaced"></div>
- */
+/// <div rustbindgen replaces="NestedReplaced"></div>
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NestedReplaced<T> {
@@ -191,12 +189,10 @@ impl Clone for Untemplated {
pub struct Templated {
pub m_untemplated: Untemplated,
}
-/**
- * If the replacement doesn't happen at the parse level the container would be
- * copy and the replacement wouldn't, so this wouldn't compile.
- *
- * <div rustbindgen replaces="ReplacedWithoutDestructor"></div>
- */
+/// If the replacement doesn't happen at the parse level the container would be
+/// copy and the replacement wouldn't, so this wouldn't compile.
+///
+/// <div rustbindgen replaces="ReplacedWithoutDestructor"></div>
#[repr(C)]
#[derive(Debug)]
pub struct ReplacedWithoutDestructor<T> {
@@ -224,12 +220,10 @@ pub struct ShouldNotBeCopiableAsWell<U> {
impl <U> Default for ShouldNotBeCopiableAsWell<U> {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
-/**
- * If the replacement doesn't happen at the parse level the container would be
- * copy and the replacement wouldn't, so this wouldn't compile.
- *
- * <div rustbindgen replaces="ReplacedWithoutDestructorFwd"></div>
- */
+/// If the replacement doesn't happen at the parse level the container would be
+/// copy and the replacement wouldn't, so this wouldn't compile.
+///
+/// <div rustbindgen replaces="ReplacedWithoutDestructorFwd"></div>
#[repr(C)]
#[derive(Debug)]
pub struct ReplacedWithoutDestructorFwd<T> {
diff --git a/tests/headers/convert-cpp-comment-to-rust.hpp b/tests/headers/convert-cpp-comment-to-rust.hpp
new file mode 100644
index 00000000..649c2365
--- /dev/null
+++ b/tests/headers/convert-cpp-comment-to-rust.hpp
@@ -0,0 +1,14 @@
+
+typedef unsigned mbedtls_mpi_uint;
+
+/**
+ * \brief MPI structure
+ */
+typedef struct
+{
+ int s; /*!< integer sign */
+ unsigned long n; /*!< total # of limbs */
+ mbedtls_mpi_uint *p; /*!< pointer to limbs */
+}
+mbedtls_mpi;
+