J.15.7 Pragmas Interrupt_Handler and Attach_Handler
Syntax
1/3
2/3
pragma
Interrupt_Handler (handler_name);
3/3
4/3
Name Resolution Rules
5/3
{
AI05-0229-1}
For the Interrupt_Handler and Attach_Handler pragmas,
the handler_name
shall resolve to denote a protected procedure with a parameterless profile.
6/3
{
AI05-0229-1}
For the Attach_Handler pragma, the expected type
for the expression is Interrupts.Interrupt_Id (see C.3.2).
Legality Rules
7/3
{
AI05-0033-1}
{
AI05-0229-1}
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.
7.a/3
7.b/3
{
AI05-0033-1}
We cannot allow these pragmas in a generic body,
because legality rules are not checked for instance bodies, and these
should not be allowed if the instance is not at the library level. The
protected types can be declared in the private part if this is desired.
Note that while the 'Access to use the handler would provide the check
in the case of Interrupt_Handler, there is no other check for Attach_Handler.
Since these pragmas are so similar, we want the rules to be the same.
Static Semantics
8/3
{
AI05-0229-1}
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].
Incompatibilities With Ada 2005
8.a/3
{
AI05-0033-1}
Correction: Added missing
generic contract wording for the pragma Attach_Handler and Interrupt_Handler.
This means that nested instances with these pragmas in the private part
are now illegal. This is not likely to occur in practice.
Wording Changes from Ada 2005
8.b/3
{
AI05-0229-1}
This clause is new. Pragmas Interrupt_Handler and
Attach_Handler were moved here from C.3.1;
aspects Interrupt_Handler and Attach_Handler live there now.
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe