Skip to content

Commit 5b16250

Browse files
folkertdevtgross35
authored andcommitted
turn #[naked] into an unsafe attribute
1 parent 9978a8b commit 5b16250

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

Diff for: compiler-builtins/src/aarch64.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use core::intrinsics;
44

55
intrinsics! {
6-
#[naked]
6+
#[unsafe(naked)]
77
#[cfg(all(target_os = "uefi", not(feature = "no-asm")))]
88
pub unsafe extern "C" fn __chkstk() {
99
core::arch::naked_asm!(

Diff for: compiler-builtins/src/aarch64_linux.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ macro_rules! compare_and_swap {
131131
($ordering:ident, $bytes:tt, $name:ident) => {
132132
intrinsics! {
133133
#[maybe_use_optimized_c_shim]
134-
#[naked]
134+
#[unsafe(naked)]
135135
pub unsafe extern "C" fn $name (
136136
expected: int_ty!($bytes), desired: int_ty!($bytes), ptr: *mut int_ty!($bytes)
137137
) -> int_ty!($bytes) {
@@ -161,7 +161,7 @@ macro_rules! compare_and_swap_i128 {
161161
($ordering:ident, $name:ident) => {
162162
intrinsics! {
163163
#[maybe_use_optimized_c_shim]
164-
#[naked]
164+
#[unsafe(naked)]
165165
pub unsafe extern "C" fn $name (
166166
expected: i128, desired: i128, ptr: *mut i128
167167
) -> i128 {
@@ -190,7 +190,7 @@ macro_rules! swap {
190190
($ordering:ident, $bytes:tt, $name:ident) => {
191191
intrinsics! {
192192
#[maybe_use_optimized_c_shim]
193-
#[naked]
193+
#[unsafe(naked)]
194194
pub unsafe extern "C" fn $name (
195195
left: int_ty!($bytes), right_ptr: *mut int_ty!($bytes)
196196
) -> int_ty!($bytes) {
@@ -215,7 +215,7 @@ macro_rules! fetch_op {
215215
($ordering:ident, $bytes:tt, $name:ident, $op:literal) => {
216216
intrinsics! {
217217
#[maybe_use_optimized_c_shim]
218-
#[naked]
218+
#[unsafe(naked)]
219219
pub unsafe extern "C" fn $name (
220220
val: int_ty!($bytes), ptr: *mut int_ty!($bytes)
221221
) -> int_ty!($bytes) {

Diff for: compiler-builtins/src/arm.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ macro_rules! bl {
2020
intrinsics! {
2121
// NOTE This function and the ones below are implemented using assembly because they are using a
2222
// custom calling convention which can't be implemented using a normal Rust function.
23-
#[naked]
23+
#[unsafe(naked)]
2424
#[cfg(not(target_env = "msvc"))]
2525
pub unsafe extern "C" fn __aeabi_uidivmod() {
2626
core::arch::naked_asm!(
@@ -34,7 +34,7 @@ intrinsics! {
3434
);
3535
}
3636

37-
#[naked]
37+
#[unsafe(naked)]
3838
pub unsafe extern "C" fn __aeabi_uldivmod() {
3939
core::arch::naked_asm!(
4040
"push {{r4, lr}}",
@@ -49,7 +49,7 @@ intrinsics! {
4949
);
5050
}
5151

52-
#[naked]
52+
#[unsafe(naked)]
5353
pub unsafe extern "C" fn __aeabi_idivmod() {
5454
core::arch::naked_asm!(
5555
"push {{r0, r1, r4, lr}}",
@@ -61,7 +61,7 @@ intrinsics! {
6161
);
6262
}
6363

64-
#[naked]
64+
#[unsafe(naked)]
6565
pub unsafe extern "C" fn __aeabi_ldivmod() {
6666
core::arch::naked_asm!(
6767
"push {{r4, lr}}",

Diff for: compiler-builtins/src/macros.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ macro_rules! intrinsics {
423423
// Naked functions are special: we can't generate wrappers for them since
424424
// they use a custom calling convention.
425425
(
426-
#[naked]
426+
#[unsafe(naked)]
427427
$(#[$($attr:tt)*])*
428428
pub unsafe extern $abi:tt fn $name:ident( $($argname:ident: $ty:ty),* ) $(-> $ret:ty)? {
429429
$($body:tt)*
@@ -433,7 +433,7 @@ macro_rules! intrinsics {
433433
) => (
434434
// `#[naked]` definitions are referenced by other places, so we can't use `cfg` like the others
435435
pub mod $name {
436-
#[naked]
436+
#[unsafe(naked)]
437437
$(#[$($attr)*])*
438438
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
439439
#[cfg_attr(not(any(all(windows, target_env = "gnu"), target_os = "cygwin")), linkage = "weak")]

Diff for: compiler-builtins/src/x86.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use core::intrinsics;
88
// NOTE These functions are never mangled as they are not tested against compiler-rt
99

1010
intrinsics! {
11-
#[naked]
11+
#[unsafe(naked)]
1212
#[cfg(all(
1313
any(all(windows, target_env = "gnu"), target_os = "uefi"),
1414
not(feature = "no-asm")
@@ -20,7 +20,7 @@ intrinsics! {
2020
);
2121
}
2222

23-
#[naked]
23+
#[unsafe(naked)]
2424
#[cfg(all(
2525
any(all(windows, target_env = "gnu"), target_os = "uefi"),
2626
not(feature = "no-asm")

Diff for: compiler-builtins/src/x86_64.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use core::intrinsics;
88
// NOTE These functions are never mangled as they are not tested against compiler-rt
99

1010
intrinsics! {
11-
#[naked]
11+
#[unsafe(naked)]
1212
#[cfg(all(
1313
any(
1414
all(windows, target_env = "gnu"),

0 commit comments

Comments
 (0)