@@ -4,10 +4,10 @@ use quote::quote;
44use std:: collections:: HashMap ;
55use std:: str:: FromStr ;
66use syn:: {
7+ Data , DeriveInput , Ident , Token ,
78 parse:: { Parse , ParseStream } ,
89 parse_macro_input,
910 spanned:: Spanned ,
10- Data , DeriveInput , Ident , Token ,
1111} ;
1212
1313/// Struct to represent a function parameter.
@@ -275,7 +275,7 @@ impl PacEnumItem {
275275 _ => {
276276 return quote ! ( compile_error!(
277277 "RISCV_MTVEC_ALIGN is not a power of 2 (minimum 4)"
278- ) )
278+ ) ) ;
279279 }
280280 } ;
281281 let mut asm = format ! (
@@ -373,28 +373,28 @@ core::arch::global_asm!("
373373 // Push the interrupt handler functions and the interrupt array
374374 res. push ( quote ! {
375375 #cfg_v_trap
376- extern "C" {
376+ unsafe extern "C" {
377377 #( #handlers; ) *
378378 }
379379
380380 #cfg_v_trap
381381 #[ doc( hidden) ]
382- #[ no_mangle]
382+ #[ unsafe ( no_mangle) ]
383383 pub static #vector_table: [ Option <unsafe extern "C" fn ( #( #array_signature) , * ) >; #max_discriminant + 1 ] = [
384384 #( #interrupt_array) , *
385385 ] ;
386386
387387 #cfg_v_trap
388388 #[ inline]
389- #[ no_mangle]
389+ #[ unsafe ( no_mangle) ]
390390 unsafe extern "C" fn #dispatch_fn_name( #( #dispatch_fn_args) , * ) {
391- extern "C" {
391+ unsafe extern "C" {
392392 fn #default_handler( #( #extern_signature) , * ) ;
393393 }
394394
395395 match #vector_table. get( code) {
396- Some ( Some ( handler) ) => handler( #( #handler_input) , * ) ,
397- _ => #default_handler( #( #handler_input) , * ) ,
396+ Some ( Some ( handler) ) => unsafe { handler( #( #handler_input) , * ) } ,
397+ _ => unsafe { #default_handler( #( #handler_input) , * ) } ,
398398 }
399399 }
400400 } ) ;
0 commit comments