88
99use std:: arch:: { asm, naked_asm} ;
1010
11- #[ naked]
11+ #[ unsafe ( naked) ]
1212pub unsafe extern "C" fn inline_asm_macro ( ) {
1313 asm ! ( "" , options( raw) ) ;
1414 //~^ERROR the `asm!` macro is not allowed in naked functions
@@ -20,7 +20,7 @@ pub struct P {
2020 y : u16 ,
2121}
2222
23- #[ naked]
23+ #[ unsafe ( naked) ]
2424pub unsafe extern "C" fn patterns (
2525 mut a : u32 ,
2626 //~^ ERROR patterns not allowed in naked function parameters
@@ -34,27 +34,27 @@ pub unsafe extern "C" fn patterns(
3434 naked_asm ! ( "" )
3535}
3636
37- #[ naked]
37+ #[ unsafe ( naked) ]
3838pub unsafe extern "C" fn inc ( a : u32 ) -> u32 {
3939 //~^ ERROR naked functions must contain a single `naked_asm!` invocation
4040 a + 1
4141 //~^ ERROR referencing function parameters is not allowed in naked functions
4242}
4343
44- #[ naked]
44+ #[ unsafe ( naked) ]
4545#[ allow( asm_sub_register) ]
4646pub unsafe extern "C" fn inc_asm ( a : u32 ) -> u32 {
4747 naked_asm ! ( "/* {0} */" , in( reg) a)
4848 //~^ ERROR the `in` operand cannot be used with `naked_asm!`
4949}
5050
51- #[ naked]
51+ #[ unsafe ( naked) ]
5252pub unsafe extern "C" fn inc_closure ( a : u32 ) -> u32 {
5353 //~^ ERROR naked functions must contain a single `naked_asm!` invocation
5454 ( || a + 1 ) ( )
5555}
5656
57- #[ naked]
57+ #[ unsafe ( naked) ]
5858pub unsafe extern "C" fn unsupported_operands ( ) {
5959 //~^ ERROR naked functions must contain a single `naked_asm!` invocation
6060 let mut a = 0usize ;
@@ -76,12 +76,12 @@ pub unsafe extern "C" fn unsupported_operands() {
7676 ) ;
7777}
7878
79- #[ naked]
79+ #[ unsafe ( naked) ]
8080pub extern "C" fn missing_assembly ( ) {
8181 //~^ ERROR naked functions must contain a single `naked_asm!` invocation
8282}
8383
84- #[ naked]
84+ #[ unsafe ( naked) ]
8585pub extern "C" fn too_many_asm_blocks ( ) {
8686 //~^ ERROR naked functions must contain a single `naked_asm!` invocation
8787 unsafe {
@@ -92,7 +92,7 @@ pub extern "C" fn too_many_asm_blocks() {
9292}
9393
9494pub fn outer ( x : u32 ) -> extern "C" fn ( usize ) -> usize {
95- #[ naked]
95+ #[ unsafe ( naked) ]
9696 pub extern "C" fn inner ( y : usize ) -> usize {
9797 //~^ ERROR naked functions must contain a single `naked_asm!` invocation
9898 * & y
@@ -101,35 +101,35 @@ pub fn outer(x: u32) -> extern "C" fn(usize) -> usize {
101101 inner
102102}
103103
104- #[ naked]
104+ #[ unsafe ( naked) ]
105105unsafe extern "C" fn invalid_options ( ) {
106106 naked_asm ! ( "" , options( nomem, preserves_flags) ) ;
107107 //~^ ERROR the `nomem` option cannot be used with `naked_asm!`
108108 //~| ERROR the `preserves_flags` option cannot be used with `naked_asm!`
109109}
110110
111- #[ naked]
111+ #[ unsafe ( naked) ]
112112unsafe extern "C" fn invalid_options_continued ( ) {
113113 naked_asm ! ( "" , options( readonly, nostack) , options( pure) ) ;
114114 //~^ ERROR the `readonly` option cannot be used with `naked_asm!`
115115 //~| ERROR the `nostack` option cannot be used with `naked_asm!`
116116 //~| ERROR the `pure` option cannot be used with `naked_asm!`
117117}
118118
119- #[ naked]
119+ #[ unsafe ( naked) ]
120120unsafe extern "C" fn invalid_may_unwind ( ) {
121121 naked_asm ! ( "" , options( may_unwind) ) ;
122122 //~^ ERROR the `may_unwind` option cannot be used with `naked_asm!`
123123}
124124
125- #[ naked]
125+ #[ unsafe ( naked) ]
126126pub extern "C" fn valid_a < T > ( ) -> T {
127127 unsafe {
128128 naked_asm ! ( "" ) ;
129129 }
130130}
131131
132- #[ naked]
132+ #[ unsafe ( naked) ]
133133pub extern "C" fn valid_b ( ) {
134134 unsafe {
135135 {
@@ -140,40 +140,40 @@ pub extern "C" fn valid_b() {
140140 }
141141}
142142
143- #[ naked]
143+ #[ unsafe ( naked) ]
144144pub unsafe extern "C" fn valid_c ( ) {
145145 naked_asm ! ( "" ) ;
146146}
147147
148148#[ cfg( target_arch = "x86_64" ) ]
149- #[ naked]
149+ #[ unsafe ( naked) ]
150150pub unsafe extern "C" fn valid_att_syntax ( ) {
151151 naked_asm ! ( "" , options( att_syntax) ) ;
152152}
153153
154- #[ naked]
155- #[ naked]
154+ #[ unsafe ( naked) ]
155+ #[ unsafe ( naked) ]
156156pub unsafe extern "C" fn allow_compile_error ( a : u32 ) -> u32 {
157157 compile_error ! ( "this is a user specified error" )
158158 //~^ ERROR this is a user specified error
159159}
160160
161- #[ naked]
161+ #[ unsafe ( naked) ]
162162pub unsafe extern "C" fn allow_compile_error_and_asm ( a : u32 ) -> u32 {
163163 compile_error ! ( "this is a user specified error" ) ;
164164 //~^ ERROR this is a user specified error
165165 naked_asm ! ( "" )
166166}
167167
168- #[ naked]
168+ #[ unsafe ( naked) ]
169169pub unsafe extern "C" fn invalid_asm_syntax ( a : u32 ) -> u32 {
170170 naked_asm ! ( invalid_syntax)
171171 //~^ ERROR asm template must be a string literal
172172}
173173
174174#[ cfg( target_arch = "x86_64" ) ]
175175#[ cfg_attr( target_pointer_width = "64" , no_mangle) ]
176- #[ naked]
176+ #[ unsafe ( naked) ]
177177pub unsafe extern "C" fn compatible_cfg_attributes ( ) {
178178 naked_asm ! ( "" , options( att_syntax) ) ;
179179}
@@ -182,20 +182,20 @@ pub unsafe extern "C" fn compatible_cfg_attributes() {
182182#[ warn( dead_code) ]
183183#[ deny( dead_code) ]
184184#[ forbid( dead_code) ]
185- #[ naked]
185+ #[ unsafe ( naked) ]
186186pub unsafe extern "C" fn compatible_diagnostic_attributes ( ) {
187187 naked_asm ! ( "" , options( raw) ) ;
188188}
189189
190190#[ deprecated = "test" ]
191- #[ naked]
191+ #[ unsafe ( naked) ]
192192pub unsafe extern "C" fn compatible_deprecated_attributes ( ) {
193193 naked_asm ! ( "" , options( raw) ) ;
194194}
195195
196196#[ cfg( target_arch = "x86_64" ) ]
197197#[ must_use]
198- #[ naked]
198+ #[ unsafe ( naked) ]
199199pub unsafe extern "C" fn compatible_must_use_attributes ( ) -> u64 {
200200 naked_asm ! (
201201 "
@@ -207,13 +207,13 @@ pub unsafe extern "C" fn compatible_must_use_attributes() -> u64 {
207207
208208#[ export_name = "exported_function_name" ]
209209#[ link_section = ".custom_section" ]
210- #[ naked]
210+ #[ unsafe ( naked) ]
211211pub unsafe extern "C" fn compatible_ffi_attributes_1 ( ) {
212212 naked_asm ! ( "" , options( raw) ) ;
213213}
214214
215215#[ cold]
216- #[ naked]
216+ #[ unsafe ( naked) ]
217217pub unsafe extern "C" fn compatible_codegen_attributes ( ) {
218218 naked_asm ! ( "" , options( raw) ) ;
219219}
@@ -222,13 +222,13 @@ pub unsafe extern "C" fn compatible_codegen_attributes() {
222222/// a doc comment
223223// a normal comment
224224#[ doc( alias = "ADocAlias" ) ]
225- #[ naked]
225+ #[ unsafe ( naked) ]
226226pub unsafe extern "C" fn compatible_doc_attributes ( ) {
227227 naked_asm ! ( "" , options( raw) ) ;
228228}
229229
230230#[ linkage = "external" ]
231- #[ naked]
231+ #[ unsafe ( naked) ]
232232pub unsafe extern "C" fn compatible_linkage ( ) {
233233 naked_asm ! ( "" , options( raw) ) ;
234234}
0 commit comments