OSDN Git Service

* double-int.c (mpz_set_double_int): Moved from
[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 --          Copyright (C) 1992-2006, Free Software Foundation, Inc.         --
10 --                                                                          --
11 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
12 -- terms of the  GNU General Public License as published  by the Free Soft- --
13 -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
14 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
17 -- for  more details.  You should have  received  a copy of the GNU General --
18 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
19 -- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
20 -- Boston, MA 02110-1301, USA.                                              --
21 --                                                                          --
22 -- GNAT was originally developed  by the GNAT team at  New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
24 --                                                                          --
25 ------------------------------------------------------------------------------
26
27 with Types; use Types;
28 package Sem_Ch6 is
29
30    type Conformance_Type is
31      (Type_Conformant, Mode_Conformant, Subtype_Conformant, Fully_Conformant);
32    --  Conformance type used in conformance checks between specs and bodies,
33    --  and for overriding. The literals match the RM definitions of the
34    --  corresponding terms.
35
36    procedure Analyze_Abstract_Subprogram_Declaration (N : Node_Id);
37    procedure Analyze_Extended_Return_Statement       (N : Node_Id);
38    procedure Analyze_Function_Call                   (N : Node_Id);
39    procedure Analyze_Operator_Symbol                 (N : Node_Id);
40    procedure Analyze_Parameter_Association           (N : Node_Id);
41    procedure Analyze_Procedure_Call                  (N : Node_Id);
42    procedure Analyze_Return_Statement                (N : Node_Id);
43    procedure Analyze_Subprogram_Declaration          (N : Node_Id);
44    procedure Analyze_Subprogram_Body                 (N : Node_Id);
45
46    function Analyze_Subprogram_Specification (N : Node_Id) return Entity_Id;
47    --  Analyze subprogram specification in both subprogram declarations
48    --  and body declarations. Returns the defining entity for the
49    --  specification N.
50
51    procedure Cannot_Inline (Msg : String; N : Node_Id; Subp : Entity_Id);
52    --  This procedure is called if the node N, an instance of a call to
53    --  subprogram Subp, cannot be inlined. Msg is the message to be issued,
54    --  and has a ? as the last character. If Subp has a pragma Always_Inlined,
55    --  then an error message is issued (by removing the last character of Msg).
56    --  If Subp is not Always_Inlined, then a warning is issued if the flag
57    --  Ineffective_Inline_Warnings is set, and if not, the call has no effect.
58
59    procedure Check_Conventions (Typ : Entity_Id);
60    --  Ada 2005 (AI-430): Check that the conventions of all inherited and
61    --  overridden dispatching operations of type Typ are consistent with
62    --  their respective counterparts.
63
64    procedure Check_Delayed_Subprogram (Designator : Entity_Id);
65    --  Designator can be a E_Subprogram_Type, E_Procedure or E_Function. If a
66    --  type in its profile depends on a private type without a full
67    --  declaration, indicate that the subprogram or type is delayed.
68
69    procedure Check_Discriminant_Conformance
70      (N        : Node_Id;
71       Prev     : Entity_Id;
72       Prev_Loc : Node_Id);
73    --  Check that the discriminants of a full type N fully conform to
74    --  the discriminants of the corresponding partial view Prev.
75    --  Prev_Loc indicates the source location of the partial view,
76    --  which may be different than Prev in the case of private types.
77
78    procedure Check_Fully_Conformant
79      (New_Id  : Entity_Id;
80       Old_Id  : Entity_Id;
81       Err_Loc : Node_Id := Empty);
82    --  Check that two callable entitites (subprograms, entries, literals)
83    --  are fully conformant, post error message if not (RM 6.3.1(17)) with
84    --  the flag being placed on the Err_Loc node if it is specified, and
85    --  on the appropriate component of the New_Id construct if not. Note:
86    --  when checking spec/body conformance, New_Id must be the body entity
87    --  and Old_Id is the spec entity (the code in the implementation relies
88    --  on this ordering, and in any case, this makes sense, since if flags
89    --  are to be placed on the construct, they clearly belong on the body.
90
91    procedure Check_Mode_Conformant
92      (New_Id   : Entity_Id;
93       Old_Id   : Entity_Id;
94       Err_Loc  : Node_Id := Empty;
95       Get_Inst : Boolean := False);
96    --  Check that two callable entitites (subprograms, entries, literals)
97    --  are mode conformant, post error message if not (RM 6.3.1(15)) with
98    --  the flag being placed on the Err_Loc node if it is specified, and
99    --  on the appropriate component of the New_Id construct if not. The
100    --  argument Get_Inst is set to True when this is a check against a
101    --  formal access-to-subprogram type, indicating that mapping of types
102    --  is needed.
103
104    procedure Check_Subtype_Conformant
105      (New_Id  : Entity_Id;
106       Old_Id  : Entity_Id;
107       Err_Loc : Node_Id := Empty);
108    --  Check that two callable entitites (subprograms, entries, literals)
109    --  are subtype conformant, post error message if not (RM 6.3.1(16))
110    --  the flag being placed on the Err_Loc node if it is specified, and
111    --  on the appropriate component of the New_Id construct if not.
112
113    procedure Check_Type_Conformant
114      (New_Id  : Entity_Id;
115       Old_Id  : Entity_Id;
116       Err_Loc : Node_Id := Empty);
117    --  Check that two callable entitites (subprograms, entries, literals)
118    --  are type conformant, post error message if not (RM 6.3.1(14)) with
119    --  the flag being placed on the Err_Loc node if it is specified, and
120    --  on the appropriate component of the New_Id construct if not.
121
122    function Conforming_Types
123      (T1       : Entity_Id;
124       T2       : Entity_Id;
125       Ctype    : Conformance_Type;
126       Get_Inst : Boolean := False) return Boolean;
127    --  Check that the types of two formal parameters are conforming. In most
128    --  cases this is just a name comparison, but within an instance it involves
129    --  generic actual types, and in the presence of anonymous access types
130    --  it must examine the designated types.
131
132    procedure Create_Extra_Formals (E : Entity_Id);
133    --  For each parameter of a subprogram or entry that requires an additional
134    --  formal (such as for access parameters and indefinite discriminated
135    --  parameters), creates the appropriate formal and attach it to its
136    --  associated parameter. Each extra formal will also be appended to
137    --  the end of Subp's parameter list (with each subsequent extra formal
138    --  being attached to the preceding extra formal).
139
140    function Find_Corresponding_Spec (N : Node_Id) return Entity_Id;
141    --  Use the subprogram specification in the body to retrieve the previous
142    --  subprogram declaration, if any.
143
144    function Fully_Conformant (New_Id, Old_Id : Entity_Id) return Boolean;
145    --  Determine whether two callable entities (subprograms, entries,
146    --  literals) are fully conformant (RM 6.3.1(17))
147
148    function Fully_Conformant_Expressions
149      (Given_E1 : Node_Id;
150       Given_E2 : Node_Id)
151       return     Boolean;
152    --  Determines if two (non-empty) expressions are fully conformant
153    --  as defined by (RM 6.3.1(18-21))
154
155    function Fully_Conformant_Discrete_Subtypes
156       (Given_S1 : Node_Id;
157        Given_S2 : Node_Id)
158        return Boolean;
159    --  Determines if two subtype definitions are fully conformant. Used
160    --  for entry family conformance checks (RM 6.3.1 (24)).
161
162    function Mode_Conformant (New_Id, Old_Id : Entity_Id) return Boolean;
163    --  Determine whether two callable entities (subprograms, entries,
164    --  literals) are mode conformant (RM 6.3.1(15))
165
166    procedure New_Overloaded_Entity
167      (S            : Entity_Id;
168       Derived_Type : Entity_Id := Empty);
169    --  Process new overloaded entity. Overloaded entities are created by
170    --  enumeration type declarations, subprogram specifications, entry
171    --  declarations, and (implicitly) by type derivations. Derived_Type non-
172    --  Empty indicates that this is subprogram derived for that type.
173
174    procedure Process_Formals (T : List_Id; Related_Nod : Node_Id);
175    --  Enter the formals in the scope of the subprogram or entry, and
176    --  analyze default expressions if any. The implicit types created for
177    --  access parameter are attached to the Related_Nod which comes from the
178    --  context.
179
180    procedure Set_Actual_Subtypes (N : Node_Id; Subp : Entity_Id);
181    --  If the formals of a subprogram are unconstrained, build a subtype
182    --  declaration that uses the bounds or discriminants of the actual to
183    --  construct an actual subtype for them. This is an optimization that
184    --  is done only in some cases where the actual subtype cannot change
185    --  during execution of the subprogram. By setting the actual subtype
186    --  once, we avoid recomputing it unnecessarily.
187
188    procedure Set_Formal_Mode (Formal_Id : Entity_Id);
189    --  Set proper Ekind to reflect formal mode (in, out, in out)
190
191    function Subtype_Conformant (New_Id, Old_Id : Entity_Id) return Boolean;
192    --  Determine whether two callable entities (subprograms, entries,
193    --  literals) are subtype conformant (RM6.3.1(16)).
194
195    function Type_Conformant
196      (New_Id                   : Entity_Id;
197       Old_Id                   : Entity_Id;
198       Skip_Controlling_Formals : Boolean := False) return Boolean;
199    --  Determine whether two callable entities (subprograms, entries,
200    --  literals) are type conformant (RM6.3.1(14)).
201
202    procedure Valid_Operator_Definition (Designator : Entity_Id);
203    --  Verify that an operator definition has the proper number of formals
204
205 end Sem_Ch6;