OSDN Git Service

2009-08-17 Thomas Quinot <quinot@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / sem_ch6.ads
index a195945..5752c21 100644 (file)
@@ -57,8 +57,8 @@ package Sem_Ch6 is
 
    procedure Check_Conventions (Typ : Entity_Id);
    --  Ada 2005 (AI-430): Check that the conventions of all inherited and
-   --  overridden dispatching operations of type Typ are consistent with
-   --  their respective counterparts.
+   --  overridden dispatching operations of type Typ are consistent with their
+   --  respective counterparts.
 
    procedure Check_Delayed_Subprogram (Designator : Entity_Id);
    --  Designator can be a E_Subprogram_Type, E_Procedure or E_Function. If a
@@ -69,16 +69,16 @@ package Sem_Ch6 is
      (N        : Node_Id;
       Prev     : Entity_Id;
       Prev_Loc : Node_Id);
-   --  Check that the discriminants of a full type N fully conform to
-   --  the discriminants of the corresponding partial view Prev.
-   --  Prev_Loc indicates the source location of the partial view,
-   --  which may be different than Prev in the case of private types.
+   --  Check that the discriminants of a full type N fully conform to the
+   --  discriminants of the corresponding partial view Prev. Prev_Loc indicates
+   --  the source location of the partial view, which may be different than
+   --  Prev in the case of private types.
 
    procedure Check_Fully_Conformant
      (New_Id  : Entity_Id;
       Old_Id  : Entity_Id;
       Err_Loc : Node_Id := Empty);
-   --  Check that two callable entitites (subprograms, entries, literals)
+   --  Check that two callable entities (subprograms, entries, literals)
    --  are fully conformant, post error message if not (RM 6.3.1(17)) with
    --  the flag being placed on the Err_Loc node if it is specified, and
    --  on the appropriate component of the New_Id construct if not. Note:
@@ -92,7 +92,7 @@ package Sem_Ch6 is
       Old_Id   : Entity_Id;
       Err_Loc  : Node_Id := Empty;
       Get_Inst : Boolean := False);
-   --  Check that two callable entitites (subprograms, entries, literals)
+   --  Check that two callable entities (subprograms, entries, literals)
    --  are mode conformant, post error message if not (RM 6.3.1(15)) with
    --  the flag being placed on the Err_Loc node if it is specified, and
    --  on the appropriate component of the New_Id construct if not. The
@@ -111,19 +111,23 @@ package Sem_Ch6 is
    --  Is_Primitive indicates whether the subprogram is primitive.
 
    procedure Check_Subtype_Conformant
-     (New_Id  : Entity_Id;
-      Old_Id  : Entity_Id;
-      Err_Loc : Node_Id := Empty);
-   --  Check that two callable entitites (subprograms, entries, literals)
-   --  are subtype conformant, post error message if not (RM 6.3.1(16))
+     (New_Id                   : Entity_Id;
+      Old_Id                   : Entity_Id;
+      Err_Loc                  : Node_Id := Empty;
+      Skip_Controlling_Formals : Boolean := False);
+   --  Check that two callable entities (subprograms, entries, literals)
+   --  are subtype conformant, post error message if not (RM 6.3.1(16)),
    --  the flag being placed on the Err_Loc node if it is specified, and
    --  on the appropriate component of the New_Id construct if not.
+   --  Skip_Controlling_Formals is True when checking the conformance of
+   --  a subprogram that implements an interface operation. In that case,
+   --  only the non-controlling formals can (and must) be examined.
 
    procedure Check_Type_Conformant
      (New_Id  : Entity_Id;
       Old_Id  : Entity_Id;
       Err_Loc : Node_Id := Empty);
-   --  Check that two callable entitites (subprograms, entries, literals)
+   --  Check that two callable entities (subprograms, entries, literals)
    --  are type conformant, post error message if not (RM 6.3.1(14)) with
    --  the flag being placed on the Err_Loc node if it is specified, and
    --  on the appropriate component of the New_Id construct if not.
@@ -135,8 +139,8 @@ package Sem_Ch6 is
       Get_Inst : Boolean := False) return Boolean;
    --  Check that the types of two formal parameters are conforming. In most
    --  cases this is just a name comparison, but within an instance it involves
-   --  generic actual types, and in the presence of anonymous access types
-   --  it must examine the designated types.
+   --  generic actual types, and in the presence of anonymous access types it
+   --  must examine the designated types.
 
    procedure Create_Extra_Formals (E : Entity_Id);
    --  For each parameter of a subprogram or entry that requires an additional
@@ -146,7 +150,9 @@ package Sem_Ch6 is
    --  the end of Subp's parameter list (with each subsequent extra formal
    --  being attached to the preceding extra formal).
 
-   function Find_Corresponding_Spec (N : Node_Id) return Entity_Id;
+   function Find_Corresponding_Spec
+     (N          : Node_Id;
+      Post_Error : Boolean := True) return Entity_Id;
    --  Use the subprogram specification in the body to retrieve the previous
    --  subprogram declaration, if any.
 
@@ -173,6 +179,14 @@ package Sem_Ch6 is
    --  procedure is also used to get visibility to the formals when analyzing
    --  preconditions and postconditions appearing in the spec.
 
+   function Is_Interface_Conformant
+     (Tagged_Type : Entity_Id;
+      Iface_Prim  : Entity_Id;
+      Prim        : Entity_Id) return Boolean;
+   --  Returns true if both primitives have a matching name and they are also
+   --  type conformant. Special management is done for functions returning
+   --  interfaces.
+
    function Mode_Conformant (New_Id, Old_Id : Entity_Id) return Boolean;
    --  Determine whether two callable entities (subprograms, entries,
    --  literals) are mode conformant (RM 6.3.1(15))
@@ -212,16 +226,25 @@ package Sem_Ch6 is
    procedure Set_Formal_Mode (Formal_Id : Entity_Id);
    --  Set proper Ekind to reflect formal mode (in, out, in out)
 
-   function Subtype_Conformant (New_Id, Old_Id : Entity_Id) return Boolean;
-   --  Determine whether two callable entities (subprograms, entries,
-   --  literals) are subtype conformant (RM6.3.1(16)).
+   function Subtype_Conformant
+     (New_Id                   : Entity_Id;
+      Old_Id                   : Entity_Id;
+      Skip_Controlling_Formals : Boolean := False) return Boolean;
+   --  Determine whether two callable entities (subprograms, entries, literals)
+   --  are subtype conformant (RM6.3.1(16)).  Skip_Controlling_Formals is True
+   --  when checking the conformance of a subprogram that implements an
+   --  interface operation. In that case, only the non-controlling formals
+   --  can (and must) be examined.
 
    function Type_Conformant
      (New_Id                   : Entity_Id;
       Old_Id                   : Entity_Id;
       Skip_Controlling_Formals : Boolean := False) return Boolean;
-   --  Determine whether two callable entities (subprograms, entries,
-   --  literals) are type conformant (RM6.3.1(14)).
+   --  Determine whether two callable entities (subprograms, entries, literals)
+   --  are type conformant (RM6.3.1(14)). Skip_Controlling_Formals is True when
+   --  checking the conformance of a subprogram that implements an interface
+   --  operation. In that case, only the non-controlling formals can (and must)
+   --  be examined.
 
    procedure Valid_Operator_Definition (Designator : Entity_Id);
    --  Verify that an operator definition has the proper number of formals