OSDN Git Service

* approved by rth
[pf3gnuchains/gcc-fork.git] / gcc / ada / sem_ch6.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                              S E M _ C H 6                               --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --                                                                          --
10 --          Copyright (C) 1992-2001 Free Software Foundation, Inc.          --
11 --                                                                          --
12 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
13 -- terms of the  GNU General Public License as published  by the Free Soft- --
14 -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
15 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
18 -- for  more details.  You should have  received  a copy of the GNU General --
19 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
20 -- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
21 -- MA 02111-1307, USA.                                                      --
22 --                                                                          --
23 -- GNAT was originally developed  by the GNAT team at  New York University. --
24 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
25 --                                                                          --
26 ------------------------------------------------------------------------------
27
28 with Types; use Types;
29 package Sem_Ch6 is
30
31    procedure Analyze_Abstract_Subprogram_Declaration    (N : Node_Id);
32    procedure Analyze_Function_Call                      (N : Node_Id);
33    procedure Analyze_Operator_Symbol                    (N : Node_Id);
34    procedure Analyze_Parameter_Association              (N : Node_Id);
35    procedure Analyze_Procedure_Call                     (N : Node_Id);
36    procedure Analyze_Return_Statement                   (N : Node_Id);
37    procedure Analyze_Subprogram_Declaration             (N : Node_Id);
38    procedure Analyze_Subprogram_Body                    (N : Node_Id);
39
40    function Analyze_Spec (N : Node_Id) return Entity_Id;
41    --  Analyze subprogram specification in both subprogram declarations
42    --  and body declarations.
43
44    procedure Check_Delayed_Subprogram (Designator : Entity_Id);
45    --  Designator can be a E_Subrpgram_Type, E_Procedure or E_Function. If a
46    --  type in its profile depends on a private type without a full
47    --  declaration, indicate that the subprogram is delayed.
48
49    procedure Check_Discriminant_Conformance
50      (N        : Node_Id;
51       Prev     : Entity_Id;
52       Prev_Loc : Node_Id);
53    --  Check that the discriminants of a full type N fully conform to
54    --  the discriminants of the corresponding partial view Prev.
55    --  Prev_Loc indicates the source location of the partial view,
56    --  which may be different than Prev in the case of private types.
57
58    procedure Check_Fully_Conformant
59      (New_Id  : Entity_Id;
60       Old_Id  : Entity_Id;
61       Err_Loc : Node_Id := Empty);
62    --  Check that two callable entitites (subprograms, entries, literals)
63    --  are fully conformant, post error message if not (RM 6.3.1(17)) with
64    --  the flag being placed on the Err_Loc node if it is specified, and
65    --  on the appropriate component of the New_Id construct if not. Note:
66    --  when checking spec/body conformance, New_Id must be the body entity
67    --  and Old_Id is the spec entity (the code in the implementation relies
68    --  on this ordering, and in any case, this makes sense, since if flags
69    --  are to be placed on the construct, they clearly belong on the body.
70
71    procedure Check_Mode_Conformant
72      (New_Id   : Entity_Id;
73       Old_Id   : Entity_Id;
74       Err_Loc  : Node_Id := Empty;
75       Get_Inst : Boolean := False);
76    --  Check that two callable entitites (subprograms, entries, literals)
77    --  are mode conformant, post error message if not (RM 6.3.1(15)) with
78    --  the flag being placed on the Err_Loc node if it is specified, and
79    --  on the appropriate component of the New_Id construct if not. The
80    --  argument Get_Inst is set to True when this is a check against a
81    --  formal access-to-subprogram type, indicating that mapping of types
82    --  is needed.
83
84    procedure Check_Subtype_Conformant
85      (New_Id  : Entity_Id;
86       Old_Id  : Entity_Id;
87       Err_Loc : Node_Id := Empty);
88    --  Check that two callable entitites (subprograms, entries, literals)
89    --  are subtype conformant, post error message if not (RM 6.3.1(16))
90    --  the flag being placed on the Err_Loc node if it is specified, and
91    --  on the appropriate component of the New_Id construct if not.
92
93    procedure Check_Type_Conformant
94      (New_Id  : Entity_Id;
95       Old_Id  : Entity_Id;
96       Err_Loc : Node_Id := Empty);
97    --  Check that two callable entitites (subprograms, entries, literals)
98    --  are type conformant, post error message if not (RM 6.3.1(14)) with
99    --  the flag being placed on the Err_Loc node if it is specified, and
100    --  on the appropriate component of the New_Id construct if not.
101
102    procedure Create_Extra_Formals (E : Entity_Id);
103    --  For each parameter of a subprogram or entry that requires an additional
104    --  formal (such as for access parameters and indefinite discriminated
105    --  parameters), creates the appropriate formal and attach it to its
106    --  associated parameter. Each extra formal will also be appended to
107    --  the end of Subp's parameter list (with each subsequent extra formal
108    --  being attached to the preceding extra formal).
109
110    function Find_Corresponding_Spec (N : Node_Id) return Entity_Id;
111    --  Use the subprogram specification in the body to retrieve the previous
112    --  subprogram declaration, if any.
113
114    function Fully_Conformant (New_Id, Old_Id : Entity_Id) return Boolean;
115    --  Determine whether two callable entities (subprograms, entries,
116    --  literals) are fully conformant (RM 6.3.1(17))
117
118    function Fully_Conformant_Expressions
119      (Given_E1 : Node_Id;
120       Given_E2 : Node_Id)
121       return  Boolean;
122    --  Determines if two (non-empty) expressions are fully conformant
123    --  as defined by (RM 6.3.1(18-21))
124
125    function Mode_Conformant (New_Id, Old_Id : Entity_Id) return Boolean;
126    --  Determine whether two callable entities (subprograms, entries,
127    --  literals) are mode conformant (RM 6.3.1(15))
128
129    procedure New_Overloaded_Entity
130      (S            : Entity_Id;
131       Derived_Type : Entity_Id := Empty);
132    --  Process new overloaded entity. Overloaded entities are created
133    --  by enumeration type declarations, subprogram specifications,
134    --  entry declarations, and (implicitly) by type derivations.
135    --  If Derived_Type is not Empty, then it indicates that this
136    --  is subprogram derived for that type.
137
138    procedure Process_Formals (T : List_Id; Related_Nod : Node_Id);
139    --  Enter the formals in the scope of the subprogram or entry, and
140    --  analyze default expressions if any. The implicit types created for
141    --  access parameter are attached to the Related_Nod which comes from the
142    --  context.
143
144    procedure Set_Actual_Subtypes (N : Node_Id; Subp : Entity_Id);
145    --  If the formals of a subprogram are unconstrained, build a subtype
146    --  declaration that uses the bounds or discriminants of the actual to
147    --  construct an actual subtype for them. This is an optimization that
148    --  is done only in some cases where the actual subtype cannot change
149    --  during execution of the subprogram. By setting the actual subtype
150    --  once, we avoid recomputing it unnecessarily.
151
152    procedure Set_Formal_Mode (Formal_Id : Entity_Id);
153    --  Set proper Ekind to reflect formal mode (in, out, in out)
154
155    function Subtype_Conformant (New_Id, Old_Id : Entity_Id) return Boolean;
156    --  Determine whether two callable entities (subprograms, entries,
157    --  literals) are subtype conformant (RM6.3.1(16))
158
159    function Type_Conformant (New_Id, Old_Id : Entity_Id) return Boolean;
160    --  Determine whether two callable entities (subprograms, entries,
161    --  literals) are type conformant (RM6.3.1(14))
162
163    procedure Valid_Operator_Definition (Designator : Entity_Id);
164    --  Verify that an operator definition has the proper number of formals
165
166 end Sem_Ch6;