IBM Support

Pragma profile causes an error

Troubleshooting


Problem

The pragma Profile allows the user to invoke the "Ravenscar" restrictions for safety critical applications. Pragma Profile causes an error when compiled. You can work around the problem by defining the underlying configuration pragmas as defined by AI95-00249. IBM no longer owns this product but is providing its technical support documents "AS-IS" for Atego customer benefit until 1 May 2013. For information about technical assistance, visit http://www.atego.com/support/

Cause

The release notes for IBM® Rational Apex® 4.4.0 state:

    Ravenscar Restrictions and Profile

    The restrictions No_Calendar, No_Dynamic_Attachment, No_Local_Protected_Objects, No_Protected_Type_Allocators, No_Relative_Delay, No_Requeue_Statements,
    No_Select_Statements, No_Task_Attributes_Package, and Simple_Barriers are fully supported, with the semantics specified in AI95-00305 (see
    http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AIs/AI-00305.TXT?rev=1.6).

    The restrictions No_Task_Termination and Max_Entry_Queue_Length (defined in the same AI) are accepted by the compiler, but do not have any runtime effect. In particular, no
    check is done regarding the violation of entry queue lengths. Similarly, the pragma Detect_Blocking is accepted by the compiler, but no check is done at runtime regarding the
    execution of potentially blocking operations.

    The pragma Profile, defined by AI95-00249 (see http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AIs/AI-00249.TXT?rev=1.12), is supported with the caveat that
    No_Task_Termination, Max_Entry_Queue_Length and Detect_Blocking do not have any runtime effect, as explained above.

In practice, pragma Profile is accepted and parsed by the 4.4.0 compiler, but any syntax causes an error. Putting 'pragma Profile (Ravenscar);' in pragma.1.ada produces the error:
    Ravenscar is disallowed by restriction NO_IMPLEMENTATION_PRAGMAS

But the error occurs in a view with no pragma Restrictions defined. Putting just 'pragma Profile;' yields the error:

    Profile requires exactly one argument

While 'pragma Profile (anything_else);' yields the error:
    Profile argument must be one of: RAVENSCAR [RM_95 2.8(25)]

The RM_95 reference when using an argument other than Ravenscar is erroneous - it indicates a paragraph about pragma List.

Resolving The Problem

This behavior is due to a defect which is under consideration for a fix in a future version of Apex. The Ravenscar related additions to pragma Restrictions and the new pragma Detect_Blocking do compile okay, although as noted above, the restrictions are not fully implemented in Apex 4.4.0. You can work around the problem with pragma Profile by defining the underlying configuration pragmas as defined by AI95-00249:

    pragma Task_Dispatching_Policy (Fifo_Within_Priorities);

    pragma Locking_Policy (Ceiling_Locking);

    pragma Detect_Blocking;

    pragma Restrictions (Max_Entry_Queue_Length => 1,
      Max_Protected_Entries => 1,
      Max_Task_Entries => 0,
      No_Abort_Statements,
      No_Asynchronous_Control,
      No_Calendar,
      No_Dynamic_Attachment,
      No_Dynamic_Priorities,
      No_Implicit_Heap_Allocations,
      No_Local_Protected_Objects,
      No_Protected_Type_Allocators,
      No_Relative_Delay,
      No_Requeue_Statements,
      No_Select_Statements,
      No_Task_Allocators,
      No_Task_Attributes_Package,
      No_Task_Hierarchy,
      No_Task_Termination,
      Simple_Barriers);

[{"Product":{"code":"SSMMQY","label":"Rational Ada Developer"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Build issues: Ada","Platform":[{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"}],"Version":"4.4.0","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
16 June 2018

UID

swg21195879