@@ -688,8 +688,8 @@ impl RiscvPacItem {
688688
689689 fn valid_signature ( & self ) -> & str {
690690 match self {
691- Self :: Exception => "`[unsafe] fn([&[mut] riscv_rt::TrapFrame]) [-> !]`" ,
692- _ => "`[unsafe] fn() [-> !]`" ,
691+ Self :: Exception => "`[unsafe] [extern \" C \" ] fn([&[mut] riscv_rt::TrapFrame]) [-> !]`" ,
692+ _ => "`[unsafe] [extern \" C \" ] fn() [-> !]`" ,
693693 }
694694 }
695695
@@ -719,7 +719,15 @@ impl RiscvPacItem {
719719 && f. sig . constness . is_none ( )
720720 && f. sig . asyncness . is_none ( )
721721 && f. vis == Visibility :: Inherited
722- && f. sig . abi . is_none ( )
722+ && match & f. sig . abi {
723+ None => true ,
724+ Some ( syn:: Abi {
725+ extern_token : _,
726+ name : Some ( name) ,
727+ } ) if name. value ( ) == "C" => true ,
728+ _ => false ,
729+ }
730+ && f. sig . unsafety . is_none ( )
723731 && f. sig . generics . params . is_empty ( )
724732 && f. sig . generics . where_clause . is_none ( )
725733 && f. sig . variadic . is_none ( )
@@ -741,7 +749,7 @@ impl RiscvPacItem {
741749#[ proc_macro_attribute]
742750/// Attribute to declare an exception handler.
743751///
744- /// The function must have the signature `[unsafe] fn([&[mut] riscv_rt::TrapFrame]) [-> !]`.
752+ /// The function must have the signature `[unsafe] [extern "C"] fn([&[mut] riscv_rt::TrapFrame]) [-> !]`.
745753///
746754/// The argument of the macro must be a path to a variant of an enum that implements the `riscv_rt::ExceptionNumber` trait.
747755///
@@ -760,7 +768,7 @@ pub fn exception(args: TokenStream, input: TokenStream) -> TokenStream {
760768#[ proc_macro_attribute]
761769/// Attribute to declare a core interrupt handler.
762770///
763- /// The function must have the signature `[unsafe] fn() [-> !]`.
771+ /// The function must have the signature `[unsafe] [extern "C"] fn() [-> !]`.
764772///
765773/// The argument of the macro must be a path to a variant of an enum that implements the `riscv_rt::CoreInterruptNumber` trait.
766774///
@@ -787,7 +795,7 @@ pub fn core_interrupt(args: TokenStream, input: TokenStream) -> TokenStream {
787795#[ proc_macro_attribute]
788796/// Attribute to declare an external interrupt handler.
789797///
790- /// The function must have the signature `[unsafe] fn() [-> !]`.
798+ /// The function must have the signature `[unsafe] [extern "C"] fn() [-> !]`.
791799///
792800/// The argument of the macro must be a path to a variant of an enum that implements the `riscv_rt::ExternalInterruptNumber` trait.
793801///
0 commit comments