Skip to content

Commit f62b452

Browse files
committed
macros
1 parent 6a7644d commit f62b452

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/macros.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ macro_rules! e {
199199
// cfg completely.
200200
// FIXME(ctest): ctest can't handle `$(,)?` so we use `$(,)*` which isn't quite correct.
201201
cfg_if! {
202-
if #[cfg(feature = "const-extern-fn")] {
203-
/// Define an `unsafe` function that is const as long as `const-extern-fn` is enabled.
202+
if #[cfg(not(libc_ctest))] {
203+
/// Define an `unsafe` function that is not const for `ctest`
204204
macro_rules! f {
205205
($(
206206
$(#[$attr:meta])*
@@ -209,12 +209,12 @@ cfg_if! {
209209
)*) => ($(
210210
#[inline]
211211
$(#[$attr])*
212-
pub $($constness)* unsafe extern fn $i($($arg: $argty),*) -> $ret
212+
pub unsafe extern fn $i($($arg: $argty),*) -> $ret
213213
$body
214214
)*)
215215
}
216216

217-
/// Define a safe function that is const as long as `const-extern-fn` is enabled.
217+
/// Define a safe function that is not const for `ctest`
218218
macro_rules! safe_f {
219219
($(
220220
$(#[$attr:meta])*
@@ -223,12 +223,12 @@ cfg_if! {
223223
)*) => ($(
224224
#[inline]
225225
$(#[$attr])*
226-
pub $($constness)* extern fn $i($($arg: $argty),*) -> $ret
226+
pub extern fn $i($($arg: $argty),*) -> $ret
227227
$body
228228
)*)
229229
}
230230

231-
/// A nonpublic function that is const as long as `const-extern-fn` is enabled.
231+
/// A nonpublic function that is not const for `ctest`
232232
macro_rules! const_fn {
233233
($(
234234
$(#[$attr:meta])*
@@ -237,12 +237,12 @@ cfg_if! {
237237
)*) => ($(
238238
#[inline]
239239
$(#[$attr])*
240-
$($constness)* fn $i($($arg: $argty),*) -> $ret
240+
fn $i($($arg: $argty),*) -> $ret
241241
$body
242242
)*)
243243
}
244244
} else {
245-
/// Define an `unsafe` function that is const as long as `const-extern-fn` is enabled.
245+
/// Define an `unsafe` function that is const as long as we are not running `ctest`
246246
macro_rules! f {
247247
($(
248248
$(#[$attr:meta])*
@@ -251,12 +251,12 @@ cfg_if! {
251251
)*) => ($(
252252
#[inline]
253253
$(#[$attr])*
254-
pub unsafe extern fn $i($($arg: $argty),*) -> $ret
254+
pub $($constness)* unsafe extern fn $i($($arg: $argty),*) -> $ret
255255
$body
256256
)*)
257257
}
258258

259-
/// Define a safe function that is const as long as `const-extern-fn` is enabled.
259+
/// Define a safe function that is const as long as we are not running `ctest`
260260
macro_rules! safe_f {
261261
($(
262262
$(#[$attr:meta])*
@@ -265,12 +265,12 @@ cfg_if! {
265265
)*) => ($(
266266
#[inline]
267267
$(#[$attr])*
268-
pub extern fn $i($($arg: $argty),*) -> $ret
268+
pub $($constness)* extern fn $i($($arg: $argty),*) -> $ret
269269
$body
270270
)*)
271271
}
272272

273-
/// A nonpublic function that is const as long as `const-extern-fn` is enabled.
273+
/// A nonpublic function that is const as long as we are not running `ctest`
274274
macro_rules! const_fn {
275275
($(
276276
$(#[$attr:meta])*
@@ -279,7 +279,7 @@ cfg_if! {
279279
)*) => ($(
280280
#[inline]
281281
$(#[$attr])*
282-
fn $i($($arg: $argty),*) -> $ret
282+
$($constness)* fn $i($($arg: $argty),*) -> $ret
283283
$body
284284
)*)
285285
}

0 commit comments

Comments
 (0)