Ada 2012 Reference Manual
J.15.7 Pragmas Interrupt_Handler and Attach_Handler
Syntax
The form of a pragma Interrupt_Handler is as follows:
pragma Interrupt_Handler (handler_name);
The form of a pragma Attach_Handler is as follows:
pragma Attach_Handler (handler_name, expression);
Name Resolution Rules
For the Interrupt_Handler and Attach_Handler pragmas, the handler_name shall resolve to denote a protected procedure with a parameterless profile.
For the Attach_Handler pragma, the expected type for the expression is Interrupts.Interrupt_Id (see C.3.2).
Legality Rules
The Attach_Handler and Interrupt_Handler pragmas are only allowed immediately within the protected_definition where the corresponding subprogram is declared. The corresponding protected_type_declaration or single_protected_declaration shall be a library-level declaration, and shall not be declared within a generic body. In addition to the places where Legality Rules normally apply (see 12.3), these rules also apply in the private part of an instance of a generic unit.
Static Semantics
For an implementation that supports Annex C, a pragma Interrupt_Handler specifies the Interrupt_Handler aspect (see C.3.1) for the protected procedure handler_name to have the value True. For an implementation that supports Annex C, a pragma Attach_Handler specifies the Attach_Handler aspect (see C.3.1) for the protected procedure handler_name to have the value of the given expression as evaluated at object creation time.