@@ -4,10 +4,10 @@ use quote::quote;
4
4
use std:: collections:: HashMap ;
5
5
use std:: str:: FromStr ;
6
6
use syn:: {
7
+ Data , DeriveInput , Ident , Token ,
7
8
parse:: { Parse , ParseStream } ,
8
9
parse_macro_input,
9
10
spanned:: Spanned ,
10
- Data , DeriveInput , Ident , Token ,
11
11
} ;
12
12
13
13
/// Struct to represent a function parameter.
@@ -275,7 +275,7 @@ impl PacEnumItem {
275
275
_ => {
276
276
return quote ! ( compile_error!(
277
277
"RISCV_MTVEC_ALIGN is not a power of 2 (minimum 4)"
278
- ) )
278
+ ) ) ;
279
279
}
280
280
} ;
281
281
let mut asm = format ! (
@@ -373,28 +373,28 @@ core::arch::global_asm!("
373
373
// Push the interrupt handler functions and the interrupt array
374
374
res. push ( quote ! {
375
375
#cfg_v_trap
376
- extern "C" {
376
+ unsafe extern "C" {
377
377
#( #handlers; ) *
378
378
}
379
379
380
380
#cfg_v_trap
381
381
#[ doc( hidden) ]
382
- #[ no_mangle]
382
+ #[ unsafe ( no_mangle) ]
383
383
pub static #vector_table: [ Option <unsafe extern "C" fn ( #( #array_signature) , * ) >; #max_discriminant + 1 ] = [
384
384
#( #interrupt_array) , *
385
385
] ;
386
386
387
387
#cfg_v_trap
388
388
#[ inline]
389
- #[ no_mangle]
389
+ #[ unsafe ( no_mangle) ]
390
390
unsafe extern "C" fn #dispatch_fn_name( #( #dispatch_fn_args) , * ) {
391
- extern "C" {
391
+ unsafe extern "C" {
392
392
fn #default_handler( #( #extern_signature) , * ) ;
393
393
}
394
394
395
395
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) , * ) } ,
398
398
}
399
399
}
400
400
} ) ;
0 commit comments