OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [ada/] [sem_ch6.ads] - Blame information for rev 300

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

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

powered by: WebSVN 2.1.0

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