               Moving the GNAT ASIS implementation to Ada 2005
               ==============================================

AdaCore has finished the process of revising the ASIS definition according
to the revision of the Ada Standard. The final goal is to get the ASIS
implementation that would be able to process Ada 2005 code.

We are going to coordinate the ASIS revision at AdaCore with AGR and ACM
ASIS Working Group activities aimed at developing the new version of
the ASIS Standard, and finally the AdaCore ASIS implementation should be
conforming with the new version of the ASIS Standard.

The primary goal of our ASIS revision is upward compatibility. That is,
ASIS-95-based applications should remain compilable when built with ASIS 2005,
and they should process Ada 95 code exactly in the same way as when built with
ASIS 95. Full upward compatibility cannot be achieved, so we have tried to
minimize problems of moving existing ASIS applications on new ASIS Standard.

Any problem detecting when compiling and running ASIS 95 based application
with the draft AdaCore ASIS 2005 implementation should be reported as a
potential bug.

This file describes the proposed changes in the ASIS interface added in the
ASIS implementation for GNAT  and the possible problems for existing ASIS 95
based applications when they are compiled with the draft ASIS 2005
implementation.

For the current state of the proposed ASIS 2005 features see file
features-asis2005 located in the same directory

Starting from December 2006, the ASIS implementation for GNAT contains the
full implementation of all the proposed extensions for Ada 2005. Any hole in
the implementation should be reported as an ordinary ASIS implementation bug.

I. Summary of the proposed changes
   -------------------------------

1.1 Adding new entities to the ASIS interface and possible impact onto
    ------------------------------------------------------------------
    existing ASIS applications
    --------------------------

To represent new Ada constructs, ASIS has to extend the Element classification
hierarchy by adding new values to the enumeration types declared in the Asis
package to classify new Ada 2005 constructs, and to add new queries to some
ASIS packages to process these new constructs. This may result in some
problems for existing ASIS 95 applications.

Most of the real problems should be expected for case statements, iteration
schemes and ranges based on the types making up the ASIS Element
classification hierarchy. Actually, it seems very unlikely that any
application uses ranges like Statement_Kinds'First .. Statement_Kinds'Last or
iterates through some range from the Element classification hierarchy, so case
statements seem to be the only real problem. For the Ada 95 code, it is
impossible to get any value added to the Element classification to represent
Ada 2005 features (if it happens, this is a bug to be reported), so 'WHEN
OTHERS' choices in case statements are safe, but some case statements without
'WHEN OTHERS' choice may become incompatible with draft ASIS 2005. All that
have to be done here is adding a 'WHEN OTHERS' choice with a null statement.

The ASIS interface extended for Ada 2005 defines more names then the ASIS
interface defined by ISO 15291, for some ASIS 95 applications it may result
in a name conflict when an application is compiled against the draft ASIS 2005
specification. All these name conflicts should lead to compilation errors, the
obvious work around is to use fully qualified names.

During the transition period all the new queries will blow up unless a
special '-asis05' option is used for Asis.Implementation.Initialize.

As a part of the ASIS revision, the lists of appropriate, expected and
returned kinds of some existing ASIS queries are extended, but this would
hardly result in any problems for existing ASIS applications.

All the changes made in the ASIS interface packages are marked by special
comments:

--  --|A2005 start
   ...
--  --|A2005 end

Comment lines of the form:

--  --|D2005 start
   ...
--  --|D2005 end

are used to mark ASIS 2005 discussion items.

Below is the full list of new entities added to the ASIS interface to support
Ada 2005 features. See also file features-asis2015 for the entities added
to support new language features proposed for the next language revision
(Ada 2015)

1.2 Extending ASIS Element classification.
    -------------------------------------

type Pragma_Kinds - add values:

    An_Assert_Pragma,
    An_Assertion_Policy_Pragma,
    A_Detect_Blocking_Pragma,
    A_No_Return_Pragma,
    A_Partition_Elaboration_Policy_Pragma,
    A_Preelaborable_Initialization_Pragma,
    A_Priority_Specific_Dispatching_Pragma,
    A_Profile_Pragma,
    A_Relative_Deadline_Pragma,
    An_Unchecked_Union_Pragma,
    An_Unsuppress_Pragma,

type Declaration_Kinds - add values:

    A_Tagged_Incomplete_Type_Declaration,     --  3.10.1(2)
    A_Return_Object_Declaration,              -- 6.5
    A_Null_Procedure_Declaration,             -- 6.7

type Trait_Kinds - add value:
    A_Null_Exclusion_Trait,

type Definition_Kinds - add value:
    An_Access_Definition,             -- 3.10(6/2)   -> Access_Definition_Kinds

type Type_Kinds - add value:
    An_Interface_Type_Definition,          -- 3.9.4      -> Interface_Kinds

type Formal_Type_Kinds - add value:
    A_Formal_Interface_Type_Definition,       -- 12.5.5(2) -> Interface_Kinds

Add new classification type:

   type Interface_Kinds is (  -- 3.9.4

      Not_An_Interface,                  -- An unexpected element
      An_Ordinary_Interface,             -- interface ...
      An_Limited_Interface,              -- limited interface ...
      An_Task_Interface,                 -- task interface ...
      An_Protected_Interface,            -- protected interface ...
      An_Synchronized_Interface);        -- synchronized interface ...

Add new classification type:

   type Access_Definition_Kinds is ( -- 3.10

    Not_An_Access_Definition,       -- An unexpected element

    An_Anonymous_Access_To_Variable,  -- [...] access subtype_mark
    An_Anonymous_Access_To_Constant,  -- [...] access constant subtype_mark
    An_Anonymous_Access_To_Procedure,           -- access procedure
    An_Anonymous_Access_To_Protected_Procedure, -- access protected procedure
    An_Anonymous_Access_To_Function,            -- access function
    An_Anonymous_Access_To_Protected_Function); -- access protected function

type Attribute_Kinds - add values:
    A_Machine_Rounding_Attribute,
    A_Mod_Attribute,
    A_Priority_Attribute,
    A_Stream_Size_Attribute,
    A_Wide_Wide_Image_Attribute,
    A_Wide_Wide_Value_Attribute,
    A_Wide_Wide_Width_Attribute,

type Statement_Kinds - add value:
    An_Extended_Return_Statement,        -- 6.5

1.3 New ASIS queries.
    ----------------

package Asis.Declarations:

   function Declaration_Interface_List
     (Declaration : in Asis.Definition)
      return           Asis.Expression_List;

   function Is_Overriding_Declaration
     (Declaration : Asis.Declaration)
      return        Boolean;

   function Is_Not_Overriding_Declaration
     (Declaration : Asis.Declaration)
      return        Boolean;

package Asis.Definitions:

   function Anonymous_Access_To_Object_Subtype_Mark
     (Definition : in Asis.Definition)
      return          Asis.Expression;

   function Component_Definition_View
     (Component_Definition : in Asis.Component_Definition)
      return Asis.Definition;

   function Definition_Interface_List
      (Type_Definition : in Asis.Definition)
       return               Asis.Expression_List;

package Asis.Elements:

   function Access_Definition_Kind
     (Definition : Asis.Definition)
      return       Asis.Access_Definition_Kinds;

   function Is_Prefix_Notation (Call : in Asis.Element) return Boolean;

   function Interface_Kind
     (Definition : in Asis.Definition)
      return          Asis.Interface_Kinds;

   function Is_Not_Null_Return
     (Element : Asis.Element)
      return    Boolean;

package Asis.Expressions:

   function Corresponding_Expression_Type_Definition
     (Expression : in Asis.Expression)
      return Asis.Element;

package Asis.Statements:

   function Return_Object_Declaration
     (Statement : in Asis.Statement)
      return         Asis.Declaration;

   function Extended_Return_Statements
     (Statement       : in Asis.Statement;
      Include_Pragmas : in Boolean := False)
      return               Asis.Statement_List;

   function Extended_Return_Exception_Handlers
     (Statement       : in Asis.Statement;
      Include_Pragmas : in Boolean := False)
      return               Asis.Exception_Handler_List;

   function Associated_Message
      (Statement : in Asis.Statement)
       return         Asis.Expression;

package Asis.Expressions:

   function Corresponding_Expression_Type_Definition
     (Expression : Asis.Expression)
      return       Asis.Element;


II. ASIS 2005 mode
    --------------

During the transition period, by default ASIS rejects any attempt to process
new Ada 2005 feature. To activate the ASIS 2005 features implemented at the
moment, an '-asis05' option should be used as a parameter of
Asis.Implementation.Initialize query.
