i386-protos.h (x86_emit_floatuns): Declare.
[official-gcc.git] / gcc / ada / lib-load.ads
blobe676ed1d6a5778a92f826a985f2745ba1e5e23db
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- L I B . L O A D --
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 -- Extensive contributions were provided by Ada Core Technologies Inc. --
25 -- --
26 ------------------------------------------------------------------------------
28 -- This child package contains the function used to load a separately
29 -- compiled unit, as well as the routine used to initialize the unit
30 -- table and load the main source file.
32 package Lib.Load is
34 -------------------------------
35 -- Handling of Renamed Units --
36 -------------------------------
38 -- A compilation unit can be a renaming of another compilation unit.
39 -- Such renamed units are not allowed as parent units, that is you
40 -- cannot declare a unit:
42 -- with x;
43 -- package x.y is end;
45 -- where x is a renaming of some other package. However you can refer
46 -- to a renamed unit in a with clause:
48 -- package p is end;
50 -- package p.q is end;
52 -- with p;
53 -- package pr renames p;
55 -- with pr.q ....
57 -- This means that in the context of a with clause, the normal fixed
58 -- correspondence between unit and file names is broken. In the above
59 -- example, there is no file named pr-q.ads, since the actual child
60 -- unit is p.q, and it will be found in file p-q.ads.
62 -- In order to deal with this case, we have to first load pr.ads, and
63 -- then discover that it is a renaming of p, so that we know that pr.q
64 -- really refers to p.q. Furthermore this can happen at any level:
66 -- with p.q;
67 -- package p.r renames p.q;
69 -- with p.q;
70 -- package p.q.s is end;
72 -- with p.r.s ...
74 -- Now we have a case where the parent p.r is a child unit and is
75 -- a renaming. This shows that renaming can occur at any level.
77 -- Finally, consider:
79 -- with pr.q.s ...
81 -- Here the parent pr.q is not itself a renaming, but it really refers
82 -- to the unit p.q, and again we cannot know this without loading the
83 -- parent. The bottom line here is that while the file name of a unit
84 -- always corresponds to the unit name, the unit name as given to the
85 -- Load_Unit function may not be the real unit.
87 -----------------
88 -- Subprograms --
89 -----------------
91 procedure Initialize;
92 -- Called at the start of compiling a new main source unit to initialize
93 -- the library processing for the new main source. Establishes and
94 -- initializes the units table entry for the new main unit (leaving
95 -- the Unit_File_Name entry of Main_Unit set to No_File if there are no
96 -- more files. Otherwise the main source file has been opened and read
97 -- and then closed on return.
99 procedure Initialize_Version (U : Unit_Number_Type);
100 -- This is called once the source file corresponding to unit U has been
101 -- fully scanned. At that point the checksum is computed, and can be used
102 -- to initialize the version number.
104 function Load_Unit
105 (Load_Name : Unit_Name_Type;
106 Required : Boolean;
107 Error_Node : Node_Id;
108 Subunit : Boolean;
109 Corr_Body : Unit_Number_Type := No_Unit;
110 Renamings : Boolean := False)
111 return Unit_Number_Type;
112 -- This function loads and parses the unit specified by Load_Name (or
113 -- returns the unit number for the previously constructed units table
114 -- entry if this is not the first call for this unit). Required indicates
115 -- the behavior on a file not found condition, as further described below,
116 -- and Error_Node is the node in the calling program to which error
117 -- messages are to be attached.
119 -- If the corresponding file is found, the value returned by Load is the
120 -- unit number that indexes the corresponding entry in the units table. If
121 -- a serious enough parser error occurs to prevent subsequent semantic
122 -- analysis, then the Fatal_Error flag of the returned entry is set and
123 -- in addition, the fatal error flag of the calling unit is also set.
125 -- If the corresponding file is not found, then the behavior depends on
126 -- the setting of Required. If Required is False, then No_Unit is returned
127 -- and no error messages are issued. If Required is True, then an error
128 -- message is posted, and No_Unit is returned.
130 -- A special case arises in the call from Rtsfind, where Error_Node is set
131 -- to Empty. In this case Required is False, and the caller in any case
132 -- treats any error as fatal.
134 -- The Subunit parameter is True to load a subunit, and False to load
135 -- any other kind of unit (including all specs, package bodies, and
136 -- subprogram bodies).
138 -- The Corr_Body argument is normally defaulted. It is set only in the
139 -- case of loading the corresponding spec when the main unit is a body.
140 -- In this case, Corr_Body is the unit number of this corresponding
141 -- body. This is used to set the Serial_Ref_Unit field of the unit
142 -- table entry. It is also used to deal with the special processing
143 -- required by RM 10.1.4(4). See description in lib.ads.
145 -- Renamings activates the handling of renamed units as separately
146 -- described in the documentation of this unit. If this parameter is
147 -- set to True, then Load_Name may not be the real unit name and it
148 -- is necessary to load parents to find the real name.
150 function Create_Dummy_Package_Unit
151 (With_Node : Node_Id;
152 Spec_Name : Unit_Name_Type)
153 return Unit_Number_Type;
154 -- With_Node is the Node_Id of a with statement for which the file could
155 -- not be found, and Spec_Name is the corresponding unit name. This call
156 -- creates a dummy package unit so that compilation can continue without
157 -- blowing up when the missing unit is referenced.
159 procedure Make_Instance_Unit (N : Node_Id);
160 -- When a compilation unit is an instantiation, it contains both the
161 -- declaration and the body of the instance, each of which can have its
162 -- own elaboration routine. The file itself corresponds to the declaration.
163 -- We create an additional entry for the body, so that the binder can
164 -- generate the proper elaboration calls to both. The argument N is the
165 -- compilation unit node created for the body.
167 procedure Version_Update (U : Node_Id; From : Node_Id);
168 -- This routine is called when unit U is found to be semantically
169 -- dependent on unit From. It updates the version of U to register
170 -- dependence on the version of From. The arguments are compilation
171 -- unit nodes for the relevant library nodes.
173 end Lib.Load;