Skip to content

Commit

Permalink
Try just putting things back
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross35 committed Nov 23, 2024
1 parent 9ce4750 commit 0831187
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ cargo-args = ["-Zbuild-std=core"]
rustc-std-workspace-core = { version = "1.0.0", optional = true }

[features]
default = ["std"]
default = ["const-extern-fn", "std"]
std = []
rustc-dep-of-std = ["rustc-std-workspace-core"]
extra_traits = []
Expand Down
26 changes: 13 additions & 13 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ macro_rules! e {
// cfg completely.
// FIXME(ctest): ctest can't handle `$(,)?` so we use `$(,)*` which isn't quite correct.
cfg_if! {
if #[cfg(libc_ctest)] {
/// Define an `unsafe` function that is not const for `ctest`
if #[cfg(feature = "const-extern-fn")] {
/// Define an `unsafe` function that is const as long as `const-extern-fn` is enabled.
macro_rules! f {
($(
$(#[$attr:meta])*
Expand All @@ -209,12 +209,12 @@ cfg_if! {
)*) => ($(
#[inline]
$(#[$attr])*
pub unsafe extern fn $i($($arg: $argty),*) -> $ret
pub $($constness)* unsafe extern fn $i($($arg: $argty),*) -> $ret
$body
)*)
}

/// Define a safe function that is not const for `ctest`
/// Define a safe function that is const as long as `const-extern-fn` is enabled.
macro_rules! safe_f {
($(
$(#[$attr:meta])*
Expand All @@ -223,12 +223,12 @@ cfg_if! {
)*) => ($(
#[inline]
$(#[$attr])*
pub extern fn $i($($arg: $argty),*) -> $ret
pub $($constness)* extern fn $i($($arg: $argty),*) -> $ret
$body
)*)
}

/// A nonpublic function that is not const for `ctest`
/// A nonpublic function that is const as long as `const-extern-fn` is enabled.
macro_rules! const_fn {
($(
$(#[$attr:meta])*
Expand All @@ -237,12 +237,12 @@ cfg_if! {
)*) => ($(
#[inline]
$(#[$attr])*
fn $i($($arg: $argty),*) -> $ret
$($constness)* fn $i($($arg: $argty),*) -> $ret
$body
)*)
}
} else {
/// Define an `unsafe` function that is const as long as we are not running `ctest`
/// Define an `unsafe` function that is const as long as `const-extern-fn` is enabled.
macro_rules! f {
($(
$(#[$attr:meta])*
Expand All @@ -251,12 +251,12 @@ cfg_if! {
)*) => ($(
#[inline]
$(#[$attr])*
pub $($constness)* unsafe extern fn $i($($arg: $argty),*) -> $ret
pub unsafe extern fn $i($($arg: $argty),*) -> $ret
$body
)*)
}

/// Define a safe function that is const as long as we are not running `ctest`
/// Define a safe function that is const as long as `const-extern-fn` is enabled.
macro_rules! safe_f {
($(
$(#[$attr:meta])*
Expand All @@ -265,12 +265,12 @@ cfg_if! {
)*) => ($(
#[inline]
$(#[$attr])*
pub $($constness)* extern fn $i($($arg: $argty),*) -> $ret
pub extern fn $i($($arg: $argty),*) -> $ret
$body
)*)
}

/// A nonpublic function that is const as long as we are not running `ctest`
/// A nonpublic function that is const as long as `const-extern-fn` is enabled.
macro_rules! const_fn {
($(
$(#[$attr:meta])*
Expand All @@ -279,7 +279,7 @@ cfg_if! {
)*) => ($(
#[inline]
$(#[$attr])*
$($constness)* fn $i($($arg: $argty),*) -> $ret
fn $i($($arg: $argty),*) -> $ret
$body
)*)
}
Expand Down

0 comments on commit 0831187

Please sign in to comment.