Skip to content

Commit d2d7b33

Browse files
committed
Revert "Cleanup manged-names macro"
This reverts commit 8a7ba9a.
1 parent e73bc98 commit d2d7b33

File tree

1 file changed

+22
-25
lines changed

1 file changed

+22
-25
lines changed

src/macros.rs

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,11 @@ macro_rules! intrinsics {
253253
$($body)*
254254
}
255255

256-
#[cfg(all(any(windows, target_os = "uefi"), target_arch = "x86_64", not(feature = "mangled-names")))]
257-
mod $name {
258-
#[no_mangle]
256+
#[cfg(all(any(windows, target_os = "uefi"), target_arch = "x86_64"))]
257+
pub mod $name {
258+
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
259259
#[cfg_attr(all(not(windows), not(target_vendor = "apple")), linkage = "weak")]
260-
extern $abi fn $name( $($argname: $ty),* )
260+
pub extern $abi fn $name( $($argname: $ty),* )
261261
-> $crate::macros::win64_128bit_abi_hack::U64x2
262262
{
263263
let e: $($ret)? = super::$name($($argname),*);
@@ -294,20 +294,20 @@ macro_rules! intrinsics {
294294
$($body)*
295295
}
296296

297-
#[cfg(all(target_arch = "arm", not(feature = "mangled-names")))]
298-
mod $name {
299-
#[no_mangle]
297+
#[cfg(target_arch = "arm")]
298+
pub mod $name {
299+
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
300300
#[cfg_attr(all(not(windows), not(target_vendor = "apple")), linkage = "weak")]
301-
extern $abi fn $name( $($argname: $ty),* ) $(-> $ret)? {
301+
pub extern $abi fn $name( $($argname: $ty),* ) $(-> $ret)? {
302302
super::$name($($argname),*)
303303
}
304304
}
305305

306-
#[cfg(all(target_arch = "arm", not(feature = "mangled-names")))]
307-
mod $alias {
308-
#[no_mangle]
306+
#[cfg(target_arch = "arm")]
307+
pub mod $alias {
308+
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
309309
#[cfg_attr(all(not(windows), not(target_vendor="apple")), linkage = "weak")]
310-
extern "aapcs" fn $alias( $($argname: $ty),* ) $(-> $ret)? {
310+
pub extern "aapcs" fn $alias( $($argname: $ty),* ) $(-> $ret)? {
311311
super::$name($($argname),*)
312312
}
313313
}
@@ -368,12 +368,12 @@ macro_rules! intrinsics {
368368
$($body)*
369369
}
370370

371-
#[cfg(all(feature = "mem", not(feature = "mangled-names")))]
372-
mod $name {
371+
#[cfg(feature = "mem")]
372+
pub mod $name {
373373
$(#[$($attr)*])*
374-
#[no_mangle]
374+
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
375375
#[cfg_attr(all(not(windows), not(target_vendor = "apple")), linkage = "weak")]
376-
unsafe extern $abi fn $name( $($argname: $ty),* ) $(-> $ret)? {
376+
pub unsafe extern $abi fn $name( $($argname: $ty),* ) $(-> $ret)? {
377377
super::$name($($argname),*)
378378
}
379379
}
@@ -392,7 +392,6 @@ macro_rules! intrinsics {
392392

393393
$($rest:tt)*
394394
) => (
395-
// `#[naked]` definitions are referenced by other places, so we can't use `cfg` like the others
396395
pub mod $name {
397396
#[naked]
398397
$(#[$($attr)*])*
@@ -460,12 +459,11 @@ macro_rules! intrinsics {
460459
$($body)*
461460
}
462461

463-
#[cfg(not(feature = "mangled-names"))]
464-
mod $name {
462+
pub mod $name {
465463
$(#[$($attr)*])*
466-
#[no_mangle]
464+
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
467465
#[cfg_attr(all(not(windows), not(target_vendor = "apple")), linkage = "weak")]
468-
extern $abi fn $name( $($argname: $ty),* ) $(-> $ret)? {
466+
pub extern $abi fn $name( $($argname: $ty),* ) $(-> $ret)? {
469467
super::$name($($argname),*)
470468
}
471469
}
@@ -487,12 +485,11 @@ macro_rules! intrinsics {
487485
$($body)*
488486
}
489487

490-
#[cfg(not(feature = "mangled-names"))]
491-
mod $name {
488+
pub mod $name {
492489
$(#[$($attr)*])*
493-
#[no_mangle]
490+
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
494491
#[cfg_attr(all(not(windows), not(target_vendor = "apple")), linkage = "weak")]
495-
unsafe fn $name( $($argname: $ty),* ) $(-> $ret)? {
492+
pub unsafe extern $abi fn $name( $($argname: $ty),* ) $(-> $ret)? {
496493
super::$name($($argname),*)
497494
}
498495
}

0 commit comments

Comments
 (0)