OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [ada/] [sem_ch6.ads] - Blame information for rev 801

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 706 jeremybenn
------------------------------------------------------------------------------
2
--                                                                          --
3
--                         GNAT COMPILER COMPONENTS                         --
4
--                                                                          --
5
--                              S E M _ C H 6                               --
6
--                                                                          --
7
--                                 S p e c                                  --
8
--                                                                          --
9
--          Copyright (C) 1992-2011, 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 3,  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 COPYING3.  If not, go to --
19
-- http://www.gnu.org/licenses for a complete copy of the license.          --
20
--                                                                          --
21
-- GNAT was originally developed  by the GNAT team at  New York University. --
22
-- Extensive contributions were provided by Ada Core Technologies Inc.      --
23
--                                                                          --
24
------------------------------------------------------------------------------
25
 
26
with Types; use Types;
27
package Sem_Ch6 is
28
 
29
   type Conformance_Type is
30
     (Type_Conformant, Mode_Conformant, Subtype_Conformant, Fully_Conformant);
31
   pragma Ordered (Conformance_Type);
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. This is an ordered type, since each conformance
35
   --  type is stronger than the ones preceding it.
36
 
37
   procedure Analyze_Abstract_Subprogram_Declaration (N : Node_Id);
38
   procedure Analyze_Expression_Function             (N : Node_Id);
39
   procedure Analyze_Extended_Return_Statement       (N : Node_Id);
40
   procedure Analyze_Function_Call                   (N : Node_Id);
41
   procedure Analyze_Operator_Symbol                 (N : Node_Id);
42
   procedure Analyze_Parameter_Association           (N : Node_Id);
43
   procedure Analyze_Procedure_Call                  (N : Node_Id);
44
   procedure Analyze_Simple_Return_Statement         (N : Node_Id);
45
   procedure Analyze_Subprogram_Declaration          (N : Node_Id);
46
   procedure Analyze_Subprogram_Body                 (N : Node_Id);
47
 
48
   function Analyze_Subprogram_Specification (N : Node_Id) return Entity_Id;
49
   --  Analyze subprogram specification in both subprogram declarations
50
   --  and body declarations. Returns the defining entity for the
51
   --  specification N.
52
 
53
   procedure Cannot_Inline (Msg : String; N : Node_Id; Subp : Entity_Id);
54
   --  This procedure is called if the node N, an instance of a call to
55
   --  subprogram Subp, cannot be inlined. Msg is the message to be issued,
56
   --  and has a ? as the last character. If Subp has a pragma Always_Inlined,
57
   --  then an error message is issued (by removing the last character of Msg).
58
   --  If Subp is not Always_Inlined, then a warning is issued if the flag
59
   --  Ineffective_Inline_Warnings is set, and if not, the call has no effect.
60
 
61
   procedure Check_Conventions (Typ : Entity_Id);
62
   --  Ada 2005 (AI-430): Check that the conventions of all inherited and
63
   --  overridden dispatching operations of type Typ are consistent with their
64
   --  respective counterparts.
65
 
66
   procedure Check_Delayed_Subprogram (Designator : Entity_Id);
67
   --  Designator can be a E_Subprogram_Type, E_Procedure or E_Function. If a
68
   --  type in its profile depends on a private type without a full
69
   --  declaration, indicate that the subprogram or type is delayed.
70
 
71
   procedure Check_Discriminant_Conformance
72
     (N        : Node_Id;
73
      Prev     : Entity_Id;
74
      Prev_Loc : Node_Id);
75
   --  Check that the discriminants of a full type N fully conform to the
76
   --  discriminants of the corresponding partial view Prev. Prev_Loc indicates
77
   --  the source location of the partial view, which may be different than
78
   --  Prev in the case of private types.
79
 
80
   procedure Check_Fully_Conformant
81
     (New_Id  : Entity_Id;
82
      Old_Id  : Entity_Id;
83
      Err_Loc : Node_Id := Empty);
84
   --  Check that two callable entities (subprograms, entries, literals)
85
   --  are fully conformant, post error message if not (RM 6.3.1(17)) with
86
   --  the flag being placed on the Err_Loc node if it is specified, and
87
   --  on the appropriate component of the New_Id construct if not. Note:
88
   --  when checking spec/body conformance, New_Id must be the body entity
89
   --  and Old_Id is the spec entity (the code in the implementation relies
90
   --  on this ordering, and in any case, this makes sense, since if flags
91
   --  are to be placed on the construct, they clearly belong on the body.
92
 
93
   procedure Check_Mode_Conformant
94
     (New_Id   : Entity_Id;
95
      Old_Id   : Entity_Id;
96
      Err_Loc  : Node_Id := Empty;
97
      Get_Inst : Boolean := False);
98
   --  Check that two callable entities (subprograms, entries, literals)
99
   --  are mode conformant, post error message if not (RM 6.3.1(15)) with
100
   --  the flag being placed on the Err_Loc node if it is specified, and
101
   --  on the appropriate component of the New_Id construct if not. The
102
   --  argument Get_Inst is set to True when this is a check against a
103
   --  formal access-to-subprogram type, indicating that mapping of types
104
   --  is needed.
105
 
106
   procedure Check_Overriding_Indicator
107
     (Subp            : Entity_Id;
108
      Overridden_Subp : Entity_Id;
109
      Is_Primitive    : Boolean);
110
   --  Verify the consistency of an overriding_indicator given for subprogram
111
   --  declaration, body, renaming, or instantiation.  Overridden_Subp is set
112
   --  if the scope where we are introducing the subprogram contains a
113
   --  type-conformant subprogram that becomes hidden by the new subprogram.
114
   --  Is_Primitive indicates whether the subprogram is primitive.
115
 
116
   procedure Check_Subprogram_Contract (Spec_Id : Entity_Id);
117
   --  Spec_Id is the spec entity for a subprogram. This routine issues
118
   --  warnings on suspicious contracts if Warn_On_Suspicious_Contract is set.
119
 
120
   procedure Check_Subtype_Conformant
121
     (New_Id                   : Entity_Id;
122
      Old_Id                   : Entity_Id;
123
      Err_Loc                  : Node_Id := Empty;
124
      Skip_Controlling_Formals : Boolean := False);
125
   --  Check that two callable entities (subprograms, entries, literals)
126
   --  are subtype conformant, post error message if not (RM 6.3.1(16)),
127
   --  the flag being placed on the Err_Loc node if it is specified, and
128
   --  on the appropriate component of the New_Id construct if not.
129
   --  Skip_Controlling_Formals is True when checking the conformance of
130
   --  a subprogram that implements an interface operation. In that case,
131
   --  only the non-controlling formals can (and must) be examined.
132
 
133
   procedure Check_Type_Conformant
134
     (New_Id  : Entity_Id;
135
      Old_Id  : Entity_Id;
136
      Err_Loc : Node_Id := Empty);
137
   --  Check that two callable entities (subprograms, entries, literals)
138
   --  are type conformant, post error message if not (RM 6.3.1(14)) with
139
   --  the flag being placed on the Err_Loc node if it is specified, and
140
   --  on the appropriate component of the New_Id construct if not.
141
 
142
   function Conforming_Types
143
     (T1       : Entity_Id;
144
      T2       : Entity_Id;
145
      Ctype    : Conformance_Type;
146
      Get_Inst : Boolean := False) return Boolean;
147
   --  Check that the types of two formal parameters are conforming. In most
148
   --  cases this is just a name comparison, but within an instance it involves
149
   --  generic actual types, and in the presence of anonymous access types it
150
   --  must examine the designated types.
151
 
152
   procedure Create_Extra_Formals (E : Entity_Id);
153
   --  For each parameter of a subprogram or entry that requires an additional
154
   --  formal (such as for access parameters and indefinite discriminated
155
   --  parameters), creates the appropriate formal and attach it to its
156
   --  associated parameter. Each extra formal will also be appended to
157
   --  the end of Subp's parameter list (with each subsequent extra formal
158
   --  being attached to the preceding extra formal).
159
 
160
   function Find_Corresponding_Spec
161
     (N          : Node_Id;
162
      Post_Error : Boolean := True) return Entity_Id;
163
   --  Use the subprogram specification in the body to retrieve the previous
164
   --  subprogram declaration, if any.
165
 
166
   function Fully_Conformant (New_Id, Old_Id : Entity_Id) return Boolean;
167
   --  Determine whether two callable entities (subprograms, entries,
168
   --  literals) are fully conformant (RM 6.3.1(17))
169
 
170
   function Fully_Conformant_Expressions
171
     (Given_E1 : Node_Id;
172
      Given_E2 : Node_Id) return Boolean;
173
   --  Determines if two (non-empty) expressions are fully conformant
174
   --  as defined by (RM 6.3.1(18-21))
175
 
176
   function Fully_Conformant_Discrete_Subtypes
177
      (Given_S1 : Node_Id;
178
       Given_S2 : Node_Id) return Boolean;
179
   --  Determines if two subtype definitions are fully conformant. Used
180
   --  for entry family conformance checks (RM 6.3.1 (24)).
181
 
182
   procedure Install_Entity (E : Entity_Id);
183
   --  Place a single entity on the visibility chain
184
 
185
   procedure Install_Formals (Id : Entity_Id);
186
   --  On entry to a subprogram body, make the formals visible. Note that
187
   --  simply placing the subprogram on the scope stack is not sufficient:
188
   --  the formals must become the current entities for their names. This
189
   --  procedure is also used to get visibility to the formals when analyzing
190
   --  preconditions and postconditions appearing in the spec.
191
 
192
   function Is_Interface_Conformant
193
     (Tagged_Type : Entity_Id;
194
      Iface_Prim  : Entity_Id;
195
      Prim        : Entity_Id) return Boolean;
196
   --  Returns true if both primitives have a matching name (including support
197
   --  for names of inherited private primitives --which have suffix 'P'), they
198
   --  are type conformant, and Prim is defined in the scope of Tagged_Type.
199
   --  Special management is done for functions returning interfaces.
200
 
201
   procedure List_Inherited_Pre_Post_Aspects (E : Entity_Id);
202
   --  E is the entity for a subprogram or generic subprogram spec. This call
203
   --  lists all inherited Pre/Post aspects if List_Inherited_Pre_Post is True.
204
 
205
   function Mode_Conformant (New_Id, Old_Id : Entity_Id) return Boolean;
206
   --  Determine whether two callable entities (subprograms, entries,
207
   --  literals) are mode conformant (RM 6.3.1(15))
208
 
209
   procedure New_Overloaded_Entity
210
     (S            : Entity_Id;
211
      Derived_Type : Entity_Id := Empty);
212
   --  Process new overloaded entity. Overloaded entities are created by
213
   --  enumeration type declarations, subprogram specifications, entry
214
   --  declarations, and (implicitly) by type derivations. If Derived_Type
215
   --  is non-empty then this is a subprogram derived for that type.
216
 
217
   procedure Process_Formals (T : List_Id; Related_Nod : Node_Id);
218
   --  Enter the formals in the scope of the subprogram or entry, and
219
   --  analyze default expressions if any. The implicit types created for
220
   --  access parameter are attached to the Related_Nod which comes from the
221
   --  context.
222
 
223
   procedure Reference_Body_Formals (Spec : Entity_Id; Bod : Entity_Id);
224
   --  If there is a separate spec for a subprogram or generic subprogram, the
225
   --  formals of the body are treated as references to the corresponding
226
   --  formals of the spec. This reference does not count as an actual use of
227
   --  the formal, in order to diagnose formals that are unused in the body.
228
   --  This procedure is also used in renaming_as_body declarations, where
229
   --  the formals of the specification must be treated as body formals that
230
   --  correspond to the previous subprogram declaration, and not as new
231
   --  entities with their defining entry in the cross-reference information.
232
 
233
   procedure Set_Actual_Subtypes (N : Node_Id; Subp : Entity_Id);
234
   --  If the formals of a subprogram are unconstrained, build a subtype
235
   --  declaration that uses the bounds or discriminants of the actual to
236
   --  construct an actual subtype for them. This is an optimization that
237
   --  is done only in some cases where the actual subtype cannot change
238
   --  during execution of the subprogram. By setting the actual subtype
239
   --  once, we avoid recomputing it unnecessarily.
240
 
241
   procedure Set_Formal_Mode (Formal_Id : Entity_Id);
242
   --  Set proper Ekind to reflect formal mode (in, out, in out)
243
 
244
   function Subtype_Conformant
245
     (New_Id                   : Entity_Id;
246
      Old_Id                   : Entity_Id;
247
      Skip_Controlling_Formals : Boolean := False) return Boolean;
248
   --  Determine whether two callable entities (subprograms, entries, literals)
249
   --  are subtype conformant (RM 6.3.1(16)). Skip_Controlling_Formals is True
250
   --  when checking the conformance of a subprogram that implements an
251
   --  interface operation. In that case, only the non-controlling formals
252
   --  can (and must) be examined.
253
 
254
   function Type_Conformant
255
     (New_Id                   : Entity_Id;
256
      Old_Id                   : Entity_Id;
257
      Skip_Controlling_Formals : Boolean := False) return Boolean;
258
   --  Determine whether two callable entities (subprograms, entries, literals)
259
   --  are type conformant (RM 6.3.1(14)). Skip_Controlling_Formals is True
260
   --  when checking the conformance of a subprogram that implements an
261
   --  interface operation. In that case, only the non-controlling formals
262
   --  can (and must) be examined.
263
 
264
   procedure Valid_Operator_Definition (Designator : Entity_Id);
265
   --  Verify that an operator definition has the proper number of formals
266
 
267
end Sem_Ch6;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.