aboutsummaryrefslogtreecommitdiff
path: root/libc/src/macros.rs
diff options
context:
space:
mode:
Diffstat (limited to 'libc/src/macros.rs')
-rw-r--r--libc/src/macros.rs30
1 files changed, 25 insertions, 5 deletions
diff --git a/libc/src/macros.rs b/libc/src/macros.rs
index 8429442..7720578 100644
--- a/libc/src/macros.rs
+++ b/libc/src/macros.rs
@@ -35,11 +35,11 @@ macro_rules! __cfg_if_apply {
}
macro_rules! s {
- ($($(#[$attr:meta])* pub struct $i:ident { $($field:tt)* })*) => ($(
+ ($($(#[$attr:meta])* pub $t:ident $i:ident { $($field:tt)* })*) => ($(
__item! {
#[repr(C)]
$(#[$attr])*
- pub struct $i { $($field)* }
+ pub $t $i { $($field)* }
}
impl ::dox::Copy for $i {}
impl ::dox::Clone for $i {
@@ -48,17 +48,18 @@ macro_rules! s {
)*)
}
+#[allow(unused_macros)]
macro_rules! f {
($(pub fn $i:ident($($arg:ident: $argty:ty),*) -> $ret:ty {
$($body:stmt);*
})*) => ($(
#[inline]
- #[cfg(not(dox))]
+ #[cfg(not(cross_platform_docs))]
pub unsafe extern fn $i($($arg: $argty),*) -> $ret {
$($body);*
}
- #[cfg(dox)]
+ #[cfg(cross_platform_docs)]
#[allow(dead_code)]
pub unsafe extern fn $i($($arg: $argty),*) -> $ret {
loop {}
@@ -67,5 +68,24 @@ macro_rules! f {
}
macro_rules! __item {
- ($i:item) => ($i)
+ ($i:item) => {
+ $i
+ };
+}
+
+#[allow(unused_macros)]
+macro_rules! align_const {
+ ($($(#[$attr:meta])* pub const $name:ident : $t1:ty = $t2:ident { $($field:tt)* };)*) => ($(
+ #[cfg(feature = "align")]
+ $(#[$attr])*
+ pub const $name : $t1 = $t2 {
+ $($field)*
+ };
+ #[cfg(not(feature = "align"))]
+ $(#[$attr])*
+ pub const $name : $t1 = $t2 {
+ $($field)*
+ __align: [],
+ };
+ )*)
}