From 8c9ac5a703486ab35e0f119af4dd5e2dc8cc00f5 Mon Sep 17 00:00:00 2001 From: Andy Russell Date: Tue, 2 Apr 2019 15:03:35 -0400 Subject: export helper macros via `local_inner_macros` This will allow users of the 2018 edition to import the macros without needing to also import their helpers. --- src/sys/ioctl/bsd.rs | 10 +++++----- src/sys/ioctl/mod.rs | 28 ++++++++++++++-------------- 2 files changed, 19 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/sys/ioctl/bsd.rs b/src/sys/ioctl/bsd.rs index 4c39fa6a..9b8b0ff1 100644 --- a/src/sys/ioctl/bsd.rs +++ b/src/sys/ioctl/bsd.rs @@ -44,7 +44,7 @@ macro_rules! ioc { /// ioctl_write_int_bad!(kvm_create_vm, request_code_none!(KVMIO, 0x03)); /// # fn main() {} /// ``` -#[macro_export] +#[macro_export(local_inner_macros)] macro_rules! request_code_none { ($g:expr, $n:expr) => (ioc!($crate::sys::ioctl::VOID, $g, $n, 0)) } @@ -55,7 +55,7 @@ macro_rules! request_code_none { /// /// You should only use this macro directly if the `ioctl` you're working /// with is "bad" and you cannot use `ioctl_write_int!()` directly. -#[macro_export] +#[macro_export(local_inner_macros)] macro_rules! request_code_write_int { ($g:expr, $n:expr) => (ioc!($crate::sys::ioctl::VOID, $g, $n, ::std::mem::size_of::<$crate::libc::c_int>())) } @@ -70,7 +70,7 @@ macro_rules! request_code_write_int { /// The read/write direction is relative to userland, so this /// command would be userland is reading and the kernel is /// writing. -#[macro_export] +#[macro_export(local_inner_macros)] macro_rules! request_code_read { ($g:expr, $n:expr, $len:expr) => (ioc!($crate::sys::ioctl::OUT, $g, $n, $len)) } @@ -85,7 +85,7 @@ macro_rules! request_code_read { /// The read/write direction is relative to userland, so this /// command would be userland is writing and the kernel is /// reading. -#[macro_export] +#[macro_export(local_inner_macros)] macro_rules! request_code_write { ($g:expr, $n:expr, $len:expr) => (ioc!($crate::sys::ioctl::IN, $g, $n, $len)) } @@ -96,7 +96,7 @@ macro_rules! request_code_write { /// /// You should only use this macro directly if the `ioctl` you're working /// with is "bad" and you cannot use `ioctl_readwrite!()` directly. -#[macro_export] +#[macro_export(local_inner_macros)] macro_rules! request_code_readwrite { ($g:expr, $n:expr, $len:expr) => (ioc!($crate::sys::ioctl::INOUT, $g, $n, $len)) } diff --git a/src/sys/ioctl/mod.rs b/src/sys/ioctl/mod.rs index 35d508b1..4513bf87 100644 --- a/src/sys/ioctl/mod.rs +++ b/src/sys/ioctl/mod.rs @@ -287,7 +287,7 @@ macro_rules! convert_ioctl_res { /// ioctl_none!(log_status, b'V', 70); /// fn main() {} /// ``` -#[macro_export] +#[macro_export(local_inner_macros)] macro_rules! ioctl_none { ($(#[$attr:meta])* $name:ident, $ioty:expr, $nr:expr) => ( $(#[$attr])* @@ -328,7 +328,7 @@ macro_rules! ioctl_none { /// } /// ``` // TODO: add an example using request_code_*!() -#[macro_export] +#[macro_export(local_inner_macros)] macro_rules! ioctl_none_bad { ($(#[$attr:meta])* $name:ident, $nr:expr) => ( $(#[$attr])* @@ -365,7 +365,7 @@ macro_rules! ioctl_none_bad { /// ioctl_read!(spi_read_mode, SPI_IOC_MAGIC, SPI_IOC_TYPE_MODE, u8); /// # fn main() {} /// ``` -#[macro_export] +#[macro_export(local_inner_macros)] macro_rules! ioctl_read { ($(#[$attr:meta])* $name:ident, $ioty:expr, $nr:expr, $ty:ty) => ( $(#[$attr])* @@ -402,7 +402,7 @@ macro_rules! ioctl_read { /// ioctl_read_bad!(tcgets, libc::TCGETS, libc::termios); /// # fn main() {} /// ``` -#[macro_export] +#[macro_export(local_inner_macros)] macro_rules! ioctl_read_bad { ($(#[$attr:meta])* $name:ident, $nr:expr, $ty:ty) => ( $(#[$attr])* @@ -439,7 +439,7 @@ macro_rules! ioctl_read_bad { /// ioctl_write_ptr!(s_audio, b'V', 34, v4l2_audio); /// # fn main() {} /// ``` -#[macro_export] +#[macro_export(local_inner_macros)] macro_rules! ioctl_write_ptr { ($(#[$attr:meta])* $name:ident, $ioty:expr, $nr:expr, $ty:ty) => ( $(#[$attr])* @@ -476,7 +476,7 @@ macro_rules! ioctl_write_ptr { /// ioctl_write_ptr_bad!(tcsets, libc::TCSETS, libc::termios); /// # fn main() {} /// ``` -#[macro_export] +#[macro_export(local_inner_macros)] macro_rules! ioctl_write_ptr_bad { ($(#[$attr:meta])* $name:ident, $nr:expr, $ty:ty) => ( $(#[$attr])* @@ -517,7 +517,7 @@ cfg_if!{ /// ioctl_write_int!(vt_activate, b'v', 4); /// # fn main() {} /// ``` - #[macro_export] + #[macro_export(local_inner_macros)] macro_rules! ioctl_write_int { ($(#[$attr:meta])* $name:ident, $ioty:expr, $nr:expr) => ( $(#[$attr])* @@ -558,7 +558,7 @@ cfg_if!{ /// ioctl_write_int!(hci_dev_up, HCI_IOC_MAGIC, HCI_IOC_HCIDEVUP); /// # fn main() {} /// ``` - #[macro_export] + #[macro_export(local_inner_macros)] macro_rules! ioctl_write_int { ($(#[$attr:meta])* $name:ident, $ioty:expr, $nr:expr) => ( $(#[$attr])* @@ -603,7 +603,7 @@ cfg_if!{ /// ioctl_write_int_bad!(kvm_create_vm, request_code_none!(KVMIO, 0x03)); /// # fn main() {} /// ``` -#[macro_export] +#[macro_export(local_inner_macros)] macro_rules! ioctl_write_int_bad { ($(#[$attr:meta])* $name:ident, $nr:expr) => ( $(#[$attr])* @@ -640,7 +640,7 @@ macro_rules! ioctl_write_int_bad { /// ioctl_readwrite!(enum_audio, b'V', 65, v4l2_audio); /// # fn main() {} /// ``` -#[macro_export] +#[macro_export(local_inner_macros)] macro_rules! ioctl_readwrite { ($(#[$attr:meta])* $name:ident, $ioty:expr, $nr:expr, $ty:ty) => ( $(#[$attr])* @@ -668,7 +668,7 @@ macro_rules! ioctl_readwrite { /// /// For a more in-depth explanation of ioctls, see [`::sys::ioctl`](sys/ioctl/index.html). // TODO: Find an example for ioctl_readwrite_bad -#[macro_export] +#[macro_export(local_inner_macros)] macro_rules! ioctl_readwrite_bad { ($(#[$attr:meta])* $name:ident, $nr:expr, $ty:ty) => ( $(#[$attr])* @@ -697,7 +697,7 @@ macro_rules! ioctl_readwrite_bad { /// /// For a more in-depth explanation of ioctls, see [`::sys::ioctl`](sys/ioctl/index.html). // TODO: Find an example for ioctl_read_buf -#[macro_export] +#[macro_export(local_inner_macros)] macro_rules! ioctl_read_buf { ($(#[$attr:meta])* $name:ident, $ioty:expr, $nr:expr, $ty:ty) => ( $(#[$attr])* @@ -736,7 +736,7 @@ macro_rules! ioctl_read_buf { /// ioctl_write_buf!(spi_transfer, SPI_IOC_MAGIC, SPI_IOC_TYPE_MESSAGE, spi_ioc_transfer); /// # fn main() {} /// ``` -#[macro_export] +#[macro_export(local_inner_macros)] macro_rules! ioctl_write_buf { ($(#[$attr:meta])* $name:ident, $ioty:expr, $nr:expr, $ty:ty) => ( $(#[$attr])* @@ -765,7 +765,7 @@ macro_rules! ioctl_write_buf { /// /// For a more in-depth explanation of ioctls, see [`::sys::ioctl`](sys/ioctl/index.html). // TODO: Find an example for readwrite_buf -#[macro_export] +#[macro_export(local_inner_macros)] macro_rules! ioctl_readwrite_buf { ($(#[$attr:meta])* $name:ident, $ioty:expr, $nr:expr, $ty:ty) => ( $(#[$attr])* -- cgit v1.2.3