annotate gcc/ada/lib-writ.ads @ 127:4c56639505ff

fix function.c and add CbC-example Makefile
author mir3636
date Wed, 11 Apr 2018 18:46:58 +0900
parents 04ced10e8804
children 84e7813d76e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ------------------------------------------------------------------------------
kono
parents:
diff changeset
2 -- --
kono
parents:
diff changeset
3 -- GNAT COMPILER COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- L I B . W R I T --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
kono
parents:
diff changeset
9 -- Copyright (C) 1992-2017, Free Software Foundation, Inc. --
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- GNAT is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
12 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
kono
parents:
diff changeset
17 -- for more details. You should have received a copy of the GNU General --
kono
parents:
diff changeset
18 -- Public License distributed with GNAT; see file COPYING3. If not, go to --
kono
parents:
diff changeset
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
kono
parents:
diff changeset
20 -- --
kono
parents:
diff changeset
21 -- GNAT was originally developed by the GNAT team at New York University. --
kono
parents:
diff changeset
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
kono
parents:
diff changeset
23 -- --
kono
parents:
diff changeset
24 ------------------------------------------------------------------------------
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26 -- This package contains the routines for writing the library information
kono
parents:
diff changeset
27
kono
parents:
diff changeset
28 package Lib.Writ is
kono
parents:
diff changeset
29
kono
parents:
diff changeset
30 -----------------------------------
kono
parents:
diff changeset
31 -- Format of Library Information --
kono
parents:
diff changeset
32 -----------------------------------
kono
parents:
diff changeset
33
kono
parents:
diff changeset
34 -- This section describes the format of the library information that is
kono
parents:
diff changeset
35 -- associated with object files. The exact method of this association is
kono
parents:
diff changeset
36 -- potentially implementation dependent and is described and implemented in
kono
parents:
diff changeset
37 -- package ali. From the point of view of the description here, all we need
kono
parents:
diff changeset
38 -- to know is that the information is represented as a string of characters
kono
parents:
diff changeset
39 -- that is somehow associated with an object file, and can be retrieved. If
kono
parents:
diff changeset
40 -- no library information exists for a given object file, then we take this
kono
parents:
diff changeset
41 -- as equivalent to the non-existence of the object file, as if source file
kono
parents:
diff changeset
42 -- has not been previously compiled.
kono
parents:
diff changeset
43
kono
parents:
diff changeset
44 -- The library information is written as a series of lines of the form:
kono
parents:
diff changeset
45
kono
parents:
diff changeset
46 -- Key_Character parameter parameter ...
kono
parents:
diff changeset
47
kono
parents:
diff changeset
48 -- The following sections describe the format of these lines in detail
kono
parents:
diff changeset
49
kono
parents:
diff changeset
50 --------------------------------------
kono
parents:
diff changeset
51 -- Making Changes to the ALI Format --
kono
parents:
diff changeset
52 --------------------------------------
kono
parents:
diff changeset
53
kono
parents:
diff changeset
54 -- A number of tools use ali.adb to parse ali files. This means that
kono
parents:
diff changeset
55 -- changes to this format can cause old versions of these tools to be
kono
parents:
diff changeset
56 -- incompatible with new versions of the compiler. Any changes to ali file
kono
parents:
diff changeset
57 -- formats must be carefully evaluated to understand any such possible
kono
parents:
diff changeset
58 -- conflicts, and in particular, it is very undesirable to create conflicts
kono
parents:
diff changeset
59 -- between older versions of GPS and newer versions of the compiler.
kono
parents:
diff changeset
60
kono
parents:
diff changeset
61 -- If the following guidelines are respected, downward compatibility
kono
parents:
diff changeset
62 -- problems (old tools reading new ali files) should be minimized:
kono
parents:
diff changeset
63
kono
parents:
diff changeset
64 -- The basic key character format must be kept
kono
parents:
diff changeset
65
kono
parents:
diff changeset
66 -- The V line must be the first line, this is checked by ali.adb even in
kono
parents:
diff changeset
67 -- Ignore_Errors mode, and is used to verify that the file at hand is
kono
parents:
diff changeset
68 -- indeed likely intended to be an ali file.
kono
parents:
diff changeset
69
kono
parents:
diff changeset
70 -- The P line must be present, though may be modified in contents
kono
parents:
diff changeset
71 -- according to remaining guidelines. Again, ali.adb assumes the P
kono
parents:
diff changeset
72 -- line is present even in Ignore_Errors mode.
kono
parents:
diff changeset
73
kono
parents:
diff changeset
74 -- New modifiers can generally be added (in particular adding new two
kono
parents:
diff changeset
75 -- letter modifiers to the P or U lines is always safe)
kono
parents:
diff changeset
76
kono
parents:
diff changeset
77 -- Adding entirely new lines (with a new key letter) to the ali file is
kono
parents:
diff changeset
78 -- always safe, at any point (other than before the V line), since such
kono
parents:
diff changeset
79 -- lines will be ignored.
kono
parents:
diff changeset
80
kono
parents:
diff changeset
81 -- Following the guidelines in this section should ensure that this problem
kono
parents:
diff changeset
82 -- is minimized and that old tools will be able to deal successfully with
kono
parents:
diff changeset
83 -- new ali formats. Note that this does not apply to the compiler itself,
kono
parents:
diff changeset
84 -- which always requires consistency between the ali files and the binder.
kono
parents:
diff changeset
85 -- That is because one of the main functions of the binder is to ensure
kono
parents:
diff changeset
86 -- consistency of the partition, and this can be compromised if the ali
kono
parents:
diff changeset
87 -- files are inconsistent.
kono
parents:
diff changeset
88
kono
parents:
diff changeset
89 ------------------
kono
parents:
diff changeset
90 -- Header Lines --
kono
parents:
diff changeset
91 ------------------
kono
parents:
diff changeset
92
kono
parents:
diff changeset
93 -- The initial header lines in the file give information about the
kono
parents:
diff changeset
94 -- compilation environment, and identify other special information such as
kono
parents:
diff changeset
95 -- main program parameters.
kono
parents:
diff changeset
96
kono
parents:
diff changeset
97 -- ----------------
kono
parents:
diff changeset
98 -- -- V Version --
kono
parents:
diff changeset
99 -- ----------------
kono
parents:
diff changeset
100
kono
parents:
diff changeset
101 -- V "xxxxxxxxxxxxxxxx"
kono
parents:
diff changeset
102 --
kono
parents:
diff changeset
103 -- This line indicates the library output version, as defined in
kono
parents:
diff changeset
104 -- Gnatvsn. It ensures that separate object modules of a program are
kono
parents:
diff changeset
105 -- consistent. It has to be changed if anything changes which would
kono
parents:
diff changeset
106 -- affect successful binding of separately compiled modules. Examples
kono
parents:
diff changeset
107 -- of such changes are modifications in the format of the library info
kono
parents:
diff changeset
108 -- described in this package, or modifications to calling sequences, or
kono
parents:
diff changeset
109 -- to the way that data is represented.
kono
parents:
diff changeset
110
kono
parents:
diff changeset
111 -- Note: the V line absolutely must be the first line, and no change
kono
parents:
diff changeset
112 -- to the ALI format should change this, since even in Ignore_Errors
kono
parents:
diff changeset
113 -- mode, Scan_ALI insists on finding a V line.
kono
parents:
diff changeset
114
kono
parents:
diff changeset
115 -- ---------------------
kono
parents:
diff changeset
116 -- -- M Main Program --
kono
parents:
diff changeset
117 -- ---------------------
kono
parents:
diff changeset
118
kono
parents:
diff changeset
119 -- M type [priority] [T=time-slice] [C=cpu] W=?
kono
parents:
diff changeset
120
kono
parents:
diff changeset
121 -- This line appears only if the main unit for this file is suitable
kono
parents:
diff changeset
122 -- for use as a main program. The parameters are:
kono
parents:
diff changeset
123
kono
parents:
diff changeset
124 -- type
kono
parents:
diff changeset
125
kono
parents:
diff changeset
126 -- P for a parameterless procedure
kono
parents:
diff changeset
127 -- F for a function returning a value of integral type
kono
parents:
diff changeset
128 -- (used for writing a main program returning an exit status)
kono
parents:
diff changeset
129
kono
parents:
diff changeset
130 -- priority
kono
parents:
diff changeset
131
kono
parents:
diff changeset
132 -- Present only if there was a valid pragma Priority in the
kono
parents:
diff changeset
133 -- corresponding unit to set the main task priority. It is an
kono
parents:
diff changeset
134 -- unsigned decimal integer.
kono
parents:
diff changeset
135
kono
parents:
diff changeset
136 -- T=time-slice
kono
parents:
diff changeset
137
kono
parents:
diff changeset
138 -- Present only if there was a valid pragma Time_Slice in the
kono
parents:
diff changeset
139 -- corresponding unit. It is an unsigned decimal integer in the
kono
parents:
diff changeset
140 -- range 0 .. 10**9 giving the time slice value in units of
kono
parents:
diff changeset
141 -- milliseconds. The actual significance of this parameter is
kono
parents:
diff changeset
142 -- target dependent.
kono
parents:
diff changeset
143
kono
parents:
diff changeset
144 -- C=cpu
kono
parents:
diff changeset
145
kono
parents:
diff changeset
146 -- Present only if there was a valid pragma CPU in the
kono
parents:
diff changeset
147 -- corresponding unit to set the main task affinity. It is an
kono
parents:
diff changeset
148 -- unsigned decimal integer.
kono
parents:
diff changeset
149
kono
parents:
diff changeset
150 -- W=?
kono
parents:
diff changeset
151
kono
parents:
diff changeset
152 -- This parameter indicates the wide character encoding method used
kono
parents:
diff changeset
153 -- when compiling the main program file. The ? character is the
kono
parents:
diff changeset
154 -- single character used in the -gnatW? switch. This is used to
kono
parents:
diff changeset
155 -- provide the default wide-character encoding for Wide_Text_IO
kono
parents:
diff changeset
156 -- files.
kono
parents:
diff changeset
157
kono
parents:
diff changeset
158 -- -----------------
kono
parents:
diff changeset
159 -- -- A Argument --
kono
parents:
diff changeset
160 -- -----------------
kono
parents:
diff changeset
161
kono
parents:
diff changeset
162 -- A argument
kono
parents:
diff changeset
163
kono
parents:
diff changeset
164 -- One of these lines appears for each of the arguments present in the
kono
parents:
diff changeset
165 -- call to the gnat1 program. This can be used if it is necessary to
kono
parents:
diff changeset
166 -- reconstruct this call (e.g. for fix and continue).
kono
parents:
diff changeset
167
kono
parents:
diff changeset
168 -- -------------------
kono
parents:
diff changeset
169 -- -- P Parameters --
kono
parents:
diff changeset
170 -- -------------------
kono
parents:
diff changeset
171
kono
parents:
diff changeset
172 -- P <<parameters>>
kono
parents:
diff changeset
173
kono
parents:
diff changeset
174 -- Indicates various information that applies to the compilation of the
kono
parents:
diff changeset
175 -- corresponding source file. Parameters is a sequence of zero or more
kono
parents:
diff changeset
176 -- two letter codes that indicate configuration pragmas and other
kono
parents:
diff changeset
177 -- parameters that apply:
kono
parents:
diff changeset
178
kono
parents:
diff changeset
179 -- The arguments are as follows:
kono
parents:
diff changeset
180
kono
parents:
diff changeset
181 -- CE Compilation errors. If this is present it means that the ali
kono
parents:
diff changeset
182 -- file resulted from a compilation with the -gnatQ switch set,
kono
parents:
diff changeset
183 -- and illegalities were detected. The ali file contents may
kono
parents:
diff changeset
184 -- not be completely reliable, but the format will be correct
kono
parents:
diff changeset
185 -- and complete. Note that NO is always present if CE is
kono
parents:
diff changeset
186 -- present.
kono
parents:
diff changeset
187
kono
parents:
diff changeset
188 -- DB Detect_Blocking pragma is in effect for all units in this
kono
parents:
diff changeset
189 -- file.
kono
parents:
diff changeset
190
kono
parents:
diff changeset
191 -- Ex A valid Partition_Elaboration_Policy pragma applies to all
kono
parents:
diff changeset
192 -- the units in this file, where x is the first character
kono
parents:
diff changeset
193 -- (upper case) of the policy name (e.g. 'C' for Concurrent).
kono
parents:
diff changeset
194
kono
parents:
diff changeset
195 -- FX Units in this file use front-end exceptions, with explicit
kono
parents:
diff changeset
196 -- handlers to trigger AT-END actions on exception paths.
kono
parents:
diff changeset
197
kono
parents:
diff changeset
198 -- GP Set if this compilation was done in GNATprove mode, either
kono
parents:
diff changeset
199 -- from direct use of GNATprove, or from use of -gnatdF.
kono
parents:
diff changeset
200
kono
parents:
diff changeset
201 -- Lx A valid Locking_Policy pragma applies to all the units in
kono
parents:
diff changeset
202 -- this file, where x is the first character (upper case) of
kono
parents:
diff changeset
203 -- the policy name (e.g. 'C' for Ceiling_Locking).
kono
parents:
diff changeset
204
kono
parents:
diff changeset
205 -- NO No object. This flag indicates that the units in this file
kono
parents:
diff changeset
206 -- were not compiled to produce an object. This can occur as a
kono
parents:
diff changeset
207 -- result of the use of -gnatc, or if no object can be produced
kono
parents:
diff changeset
208 -- (e.g. when a package spec is compiled instead of the body,
kono
parents:
diff changeset
209 -- or a subunit on its own). Note that in GNATprove mode, we
kono
parents:
diff changeset
210 -- do produce an object. The object is not suitable for binding
kono
parents:
diff changeset
211 -- and linking, but we do not set NO, instead we set GP.
kono
parents:
diff changeset
212
kono
parents:
diff changeset
213 -- NR No_Run_Time. Indicates that a pragma No_Run_Time applies
kono
parents:
diff changeset
214 -- to all units in the file.
kono
parents:
diff changeset
215
kono
parents:
diff changeset
216 -- NS Normalize_Scalars pragma in effect for all units in
kono
parents:
diff changeset
217 -- this file.
kono
parents:
diff changeset
218
kono
parents:
diff changeset
219 -- OH Pragma Default_Scalar_Storage_Order (High_Order_First) is
kono
parents:
diff changeset
220 -- present in a configuration pragma file that applies.
kono
parents:
diff changeset
221
kono
parents:
diff changeset
222 -- OL Pragma Default_Scalar_Storage_Order (Low_Order_First) is
kono
parents:
diff changeset
223 -- present in a configuration pragma file that applies.
kono
parents:
diff changeset
224
kono
parents:
diff changeset
225 -- Qx A valid Queueing_Policy pragma applies to all the units
kono
parents:
diff changeset
226 -- in this file, where x is the first character (upper case)
kono
parents:
diff changeset
227 -- of the policy name (e.g. 'P' for Priority_Queueing).
kono
parents:
diff changeset
228
kono
parents:
diff changeset
229 -- SL Indicates that the unit is an Interface to a Standalone
kono
parents:
diff changeset
230 -- Library. Note that this indication is never given by the
kono
parents:
diff changeset
231 -- compiler, but is added by the Project Manager in gnatmake
kono
parents:
diff changeset
232 -- when an Interface ALI file is copied to the library
kono
parents:
diff changeset
233 -- directory.
kono
parents:
diff changeset
234
kono
parents:
diff changeset
235 -- SS This unit references System.Secondary_Stack (that is,
kono
parents:
diff changeset
236 -- the unit makes use of the secondary stack facilities).
kono
parents:
diff changeset
237
kono
parents:
diff changeset
238 -- Tx A valid Task_Dispatching_Policy pragma applies to all
kono
parents:
diff changeset
239 -- the units in this file, where x is the first character
kono
parents:
diff changeset
240 -- (upper case) of the corresponding policy name (e.g. 'F'
kono
parents:
diff changeset
241 -- for FIFO_Within_Priorities).
kono
parents:
diff changeset
242
kono
parents:
diff changeset
243 -- UA Unreserve_All_Interrupts pragma was processed in one or
kono
parents:
diff changeset
244 -- more units in this file
kono
parents:
diff changeset
245
kono
parents:
diff changeset
246 -- ZX Units in this file use zero-cost exceptions and have
kono
parents:
diff changeset
247 -- generated exception tables. If ZX is not present, the
kono
parents:
diff changeset
248 -- longjmp/setjmp exception scheme is in use.
kono
parents:
diff changeset
249
kono
parents:
diff changeset
250 -- Note that language defined units never output policy (Lx, Tx, Qx)
kono
parents:
diff changeset
251 -- parameters. Language defined units must correctly handle all
kono
parents:
diff changeset
252 -- possible cases. These values are checked for consistency by the
kono
parents:
diff changeset
253 -- binder and then copied to the generated binder output file.
kono
parents:
diff changeset
254
kono
parents:
diff changeset
255 -- Note: The P line must be present. Even in Ignore_Errors mode, Scan_ALI
kono
parents:
diff changeset
256 -- insists on finding a P line. So if changes are made to the ALI format,
kono
parents:
diff changeset
257 -- they should not include removing the P line.
kono
parents:
diff changeset
258
kono
parents:
diff changeset
259 -- ---------------------
kono
parents:
diff changeset
260 -- -- R Restrictions --
kono
parents:
diff changeset
261 -- ---------------------
kono
parents:
diff changeset
262
kono
parents:
diff changeset
263 -- There are two forms for R lines, positional and named. The positional
kono
parents:
diff changeset
264 -- notation is now considered obsolescent, it is not generated by the most
kono
parents:
diff changeset
265 -- recent versions of the compiler except under control of the debug switch
kono
parents:
diff changeset
266 -- -gnatdR, but is still recognized by the binder.
kono
parents:
diff changeset
267
kono
parents:
diff changeset
268 -- The recognition by the binder is to ease the transition, and better deal
kono
parents:
diff changeset
269 -- with some cases of inconsistent builds using incompatible versions of
kono
parents:
diff changeset
270 -- the compiler and binder. The named notation is the current preferred
kono
parents:
diff changeset
271 -- approach.
kono
parents:
diff changeset
272
kono
parents:
diff changeset
273 -- Note that R lines are generated using the information in unit Rident,
kono
parents:
diff changeset
274 -- and intepreted by the binder using the information in System.Rident.
kono
parents:
diff changeset
275 -- Normally these two units should be effectively identical. However in
kono
parents:
diff changeset
276 -- some cases of inconsistent builds, they may be different. This may lead
kono
parents:
diff changeset
277 -- to binder diagnostics, which can be suppressed using the -C switch for
kono
parents:
diff changeset
278 -- the binder, which results in ignoring unrecognized restrictions in the
kono
parents:
diff changeset
279 -- ali files.
kono
parents:
diff changeset
280
kono
parents:
diff changeset
281 -- ---------------------------------------
kono
parents:
diff changeset
282 -- -- R Restrictions (Positional Form) --
kono
parents:
diff changeset
283 -- ---------------------------------------
kono
parents:
diff changeset
284
kono
parents:
diff changeset
285 -- The first R line records the status of restrictions generated by pragma
kono
parents:
diff changeset
286 -- Restrictions encountered, as well as information on what the compiler
kono
parents:
diff changeset
287 -- has been able to determine with respect to restrictions violations.
kono
parents:
diff changeset
288 -- The format is:
kono
parents:
diff changeset
289
kono
parents:
diff changeset
290 -- R <<restriction-characters>> <<restriction-param-id-entries>>
kono
parents:
diff changeset
291
kono
parents:
diff changeset
292 -- The first parameter is a string of characters that records
kono
parents:
diff changeset
293 -- information regarding restrictions that do not take parameter not
kono
parents:
diff changeset
294 -- take parameter values. It is a string of characters, one character
kono
parents:
diff changeset
295 -- for each value (in order) in All_Boolean_Restrictions. There are
kono
parents:
diff changeset
296 -- three possible settings for each restriction:
kono
parents:
diff changeset
297
kono
parents:
diff changeset
298 -- r Restricted. Unit was compiled under control of a pragma
kono
parents:
diff changeset
299 -- Restrictions for the corresponding restriction. In this case
kono
parents:
diff changeset
300 -- the unit certainly does not violate the Restriction, since
kono
parents:
diff changeset
301 -- this would have been detected by the compiler.
kono
parents:
diff changeset
302
kono
parents:
diff changeset
303 -- n Not used. The unit was not compiled under control of a pragma
kono
parents:
diff changeset
304 -- Restrictions for the corresponding restriction, and does not
kono
parents:
diff changeset
305 -- make any use of the referenced feature.
kono
parents:
diff changeset
306
kono
parents:
diff changeset
307 -- v Violated. The unit was not compiled under control of a pragma
kono
parents:
diff changeset
308 -- Restrictions for the corresponding restriction, and it does
kono
parents:
diff changeset
309 -- indeed use the referenced feature.
kono
parents:
diff changeset
310
kono
parents:
diff changeset
311 -- This information is used in the binder to check consistency, i.e. to
kono
parents:
diff changeset
312 -- detect cases where one unit has "r" and another unit has "v", which
kono
parents:
diff changeset
313 -- is not permitted, since these restrictions are partition-wide.
kono
parents:
diff changeset
314
kono
parents:
diff changeset
315 -- The second parameter, which immediately follows the first (with no
kono
parents:
diff changeset
316 -- separating space) gives restriction information for identifiers for
kono
parents:
diff changeset
317 -- which a parameter is given.
kono
parents:
diff changeset
318
kono
parents:
diff changeset
319 -- The parameter is a string of entries, one for each value in
kono
parents:
diff changeset
320 -- Restrict.All_Parameter_Restrictions. Each entry has two components
kono
parents:
diff changeset
321 -- in sequence, the first indicating whether or not there is a
kono
parents:
diff changeset
322 -- restriction, and the second indicating whether or not the compiler
kono
parents:
diff changeset
323 -- detected violations. In the boolean case it is not necessary to
kono
parents:
diff changeset
324 -- separate these, since if a restriction is set, and violated, that is
kono
parents:
diff changeset
325 -- an error. But in the parameter case, this is not true. For example,
kono
parents:
diff changeset
326 -- we can have a unit with a pragma Restrictions (Max_Tasks => 4),
kono
parents:
diff changeset
327 -- where the compiler can detect that there are exactly three tasks
kono
parents:
diff changeset
328 -- declared. Both of these pieces of information must be passed to the
kono
parents:
diff changeset
329 -- binder. The parameter of 4 is important in case the total number of
kono
parents:
diff changeset
330 -- tasks in the partition is greater than 4. The parameter of 3 is
kono
parents:
diff changeset
331 -- important in case some other unit has a restrictions pragma with
kono
parents:
diff changeset
332 -- Max_Tasks=>2.
kono
parents:
diff changeset
333
kono
parents:
diff changeset
334 -- The component for the presence of restriction has one of two
kono
parents:
diff changeset
335 -- possible forms:
kono
parents:
diff changeset
336
kono
parents:
diff changeset
337 -- n No pragma for this restriction is present in the set of units
kono
parents:
diff changeset
338 -- for this ali file.
kono
parents:
diff changeset
339
kono
parents:
diff changeset
340 -- rN At least one pragma for this restriction is present in the
kono
parents:
diff changeset
341 -- set of units for this ali file. The value N is the minimum
kono
parents:
diff changeset
342 -- parameter value encountered in any such pragma. N is in the
kono
parents:
diff changeset
343 -- range of Integer (a value larger than N'Last causes the
kono
parents:
diff changeset
344 -- pragma to be ignored).
kono
parents:
diff changeset
345
kono
parents:
diff changeset
346 -- The component for the violation detection has one of three
kono
parents:
diff changeset
347 -- possible forms:
kono
parents:
diff changeset
348
kono
parents:
diff changeset
349 -- n No violations were detected by the compiler
kono
parents:
diff changeset
350
kono
parents:
diff changeset
351 -- vN A violation was detected. N is either the maximum or total
kono
parents:
diff changeset
352 -- count of violations (depending on the checking type) in all
kono
parents:
diff changeset
353 -- the units represented by the ali file). Note that this
kono
parents:
diff changeset
354 -- setting is only allowed for restrictions that are in
kono
parents:
diff changeset
355 -- Checked_[Max|Sum]_Parameter_Restrictions. The value here is
kono
parents:
diff changeset
356 -- known to be exact by the compiler and is in the range of
kono
parents:
diff changeset
357 -- Natural.
kono
parents:
diff changeset
358
kono
parents:
diff changeset
359 -- vN+ A violation was detected. The compiler cannot determine
kono
parents:
diff changeset
360 -- the exact count of violations, but it is at least N.
kono
parents:
diff changeset
361
kono
parents:
diff changeset
362 -- There are no spaces within the parameter string, so the entry
kono
parents:
diff changeset
363 -- described above in the header of this section for Max_Tasks would
kono
parents:
diff changeset
364 -- appear as the string r4v3.
kono
parents:
diff changeset
365
kono
parents:
diff changeset
366 -- Note: The restrictions line is required to be present. Even in
kono
parents:
diff changeset
367 -- Ignore_Errors mode, Scan_ALI expects to find an R line and will
kono
parents:
diff changeset
368 -- signal a fatal error if it is missing. This means that future
kono
parents:
diff changeset
369 -- changes to the ALI file format must retain the R line.
kono
parents:
diff changeset
370
kono
parents:
diff changeset
371 -- ----------------------------------
kono
parents:
diff changeset
372 -- -- R Restrictions (Named Form) --
kono
parents:
diff changeset
373 -- ----------------------------------
kono
parents:
diff changeset
374
kono
parents:
diff changeset
375 -- The first R line for named form announces that named notation will be
kono
parents:
diff changeset
376 -- used, and also assures that there is at least one R line present, which
kono
parents:
diff changeset
377 -- makes parsing of ali files simpler. A blank line preceds the RN line.
kono
parents:
diff changeset
378
kono
parents:
diff changeset
379 -- RN
kono
parents:
diff changeset
380
kono
parents:
diff changeset
381 -- In named notation, the restrictions are given as a series of lines,
kono
parents:
diff changeset
382 -- one per restrictions that is specified or violated (no information is
kono
parents:
diff changeset
383 -- present for restrictions that are not specified or violated). In the
kono
parents:
diff changeset
384 -- following name is the name of the restriction in all upper case.
kono
parents:
diff changeset
385
kono
parents:
diff changeset
386 -- For boolean restrictions, we have only two possibilities. A restrictions
kono
parents:
diff changeset
387 -- pragma is present, or a violation is detected:
kono
parents:
diff changeset
388
kono
parents:
diff changeset
389 -- RR name
kono
parents:
diff changeset
390
kono
parents:
diff changeset
391 -- A restriction pragma is present for the named boolean restriction.
kono
parents:
diff changeset
392 -- No violations were detected by the compiler (or the unit in question
kono
parents:
diff changeset
393 -- would have been found to be illegal).
kono
parents:
diff changeset
394
kono
parents:
diff changeset
395 -- RV name
kono
parents:
diff changeset
396
kono
parents:
diff changeset
397 -- No restriction pragma is present for the named boolean restriction.
kono
parents:
diff changeset
398 -- However, the compiler did detect one or more violations of this
kono
parents:
diff changeset
399 -- restriction, which may require a binder consistency check. Note that
kono
parents:
diff changeset
400 -- one case of a violation is the use of a Restriction_Set attribute for
kono
parents:
diff changeset
401 -- the restriction that yielded False.
kono
parents:
diff changeset
402
kono
parents:
diff changeset
403 -- For the case of restrictions that take a parameter, we need both the
kono
parents:
diff changeset
404 -- information from pragma if present, and the actual information about
kono
parents:
diff changeset
405 -- what possible violations occur. For example, we can have a unit with
kono
parents:
diff changeset
406 -- a pragma Restrictions (Max_Tasks => 4), where the compiler can detect
kono
parents:
diff changeset
407 -- that there are exactly three tasks declared. Both of these pieces
kono
parents:
diff changeset
408 -- of information must be passed to the binder. The parameter of 4 is
kono
parents:
diff changeset
409 -- important in case the total number of tasks in the partition is greater
kono
parents:
diff changeset
410 -- than 4. The parameter of 3 is important in case some other unit has a
kono
parents:
diff changeset
411 -- restrictions pragma with Max_Tasks=>2.
kono
parents:
diff changeset
412
kono
parents:
diff changeset
413 -- RR name=N
kono
parents:
diff changeset
414
kono
parents:
diff changeset
415 -- A restriction pragma is present for the named restriction which is
kono
parents:
diff changeset
416 -- one of the restrictions taking a parameter. The value N (a decimal
kono
parents:
diff changeset
417 -- integer) is the value given in the restriction pragma.
kono
parents:
diff changeset
418
kono
parents:
diff changeset
419 -- RV name=N
kono
parents:
diff changeset
420
kono
parents:
diff changeset
421 -- A restriction pragma may or may not be present for the restriction
kono
parents:
diff changeset
422 -- given by name (one of the restrictions taking a parameter). But in
kono
parents:
diff changeset
423 -- either case, the compiler detected possible violations. N (a decimal
kono
parents:
diff changeset
424 -- integer) is the maximum or total count of violations (depending
kono
parents:
diff changeset
425 -- on the checking type) in all the units represented by the ali file).
kono
parents:
diff changeset
426 -- The value here is known to be exact by the compiler and is in the
kono
parents:
diff changeset
427 -- range of Natural. Note that if an RR line is present for the same
kono
parents:
diff changeset
428 -- restriction, then the value in the RV line cannot exceed the value
kono
parents:
diff changeset
429 -- in the RR line (since otherwise the compiler would have detected a
kono
parents:
diff changeset
430 -- violation of the restriction).
kono
parents:
diff changeset
431
kono
parents:
diff changeset
432 -- RV name=N+
kono
parents:
diff changeset
433
kono
parents:
diff changeset
434 -- Similar to the above, but the compiler cannot determine the exact
kono
parents:
diff changeset
435 -- count of violations, but it is at least N.
kono
parents:
diff changeset
436
kono
parents:
diff changeset
437 -- -------------------------------------------------
kono
parents:
diff changeset
438 -- -- R Restrictions (No_Dependence Information) --
kono
parents:
diff changeset
439 -- -------------------------------------------------
kono
parents:
diff changeset
440
kono
parents:
diff changeset
441 -- Subsequent R lines are present only if pragma Restriction No_Dependence
kono
parents:
diff changeset
442 -- is used. There is one such line for each such pragma appearing in the
kono
parents:
diff changeset
443 -- extended main unit. The format is:
kono
parents:
diff changeset
444
kono
parents:
diff changeset
445 -- R unit_name
kono
parents:
diff changeset
446
kono
parents:
diff changeset
447 -- Here the unit name is in all lower case. The components of the unit
kono
parents:
diff changeset
448 -- name are separated by periods. The names themselves are in encoded
kono
parents:
diff changeset
449 -- form, as documented in Namet.
kono
parents:
diff changeset
450
kono
parents:
diff changeset
451 -- -------------------------
kono
parents:
diff changeset
452 -- -- I Interrupt States --
kono
parents:
diff changeset
453 -- -------------------------
kono
parents:
diff changeset
454
kono
parents:
diff changeset
455 -- I interrupt-number interrupt-state line-number
kono
parents:
diff changeset
456
kono
parents:
diff changeset
457 -- This line records information from an Interrupt_State pragma. There
kono
parents:
diff changeset
458 -- is one line for each separate pragma, and if no such pragmas are
kono
parents:
diff changeset
459 -- used, then no I lines are present.
kono
parents:
diff changeset
460
kono
parents:
diff changeset
461 -- The interrupt-number is an unsigned positive integer giving the
kono
parents:
diff changeset
462 -- value of the interrupt as defined in Ada.Interrupts.Names.
kono
parents:
diff changeset
463
kono
parents:
diff changeset
464 -- The interrupt-state is one of r/s/u for Runtime/System/User
kono
parents:
diff changeset
465
kono
parents:
diff changeset
466 -- The line number is an unsigned decimal integer giving the line
kono
parents:
diff changeset
467 -- number of the corresponding Interrupt_State pragma. This is used
kono
parents:
diff changeset
468 -- in consistency messages.
kono
parents:
diff changeset
469
kono
parents:
diff changeset
470 -- --------------------------------------
kono
parents:
diff changeset
471 -- -- S Priority Specific Dispatching --
kono
parents:
diff changeset
472 -- --------------------------------------
kono
parents:
diff changeset
473
kono
parents:
diff changeset
474 -- S policy_identifier first_priority last_priority line-number
kono
parents:
diff changeset
475
kono
parents:
diff changeset
476 -- This line records information from a Priority_Specific_Dispatching
kono
parents:
diff changeset
477 -- pragma. There is one line for each separate pragma, and if no such
kono
parents:
diff changeset
478 -- pragmas are used, then no S lines are present.
kono
parents:
diff changeset
479
kono
parents:
diff changeset
480 -- The policy_identifier is the first character (upper case) of the
kono
parents:
diff changeset
481 -- corresponding policy name (e.g. 'F' for FIFO_Within_Priorities).
kono
parents:
diff changeset
482
kono
parents:
diff changeset
483 -- The first_priority and last_priority fields define the range of
kono
parents:
diff changeset
484 -- priorities to which the specified dispatching policy apply.
kono
parents:
diff changeset
485
kono
parents:
diff changeset
486 -- The line number is an unsigned decimal integer giving the line
kono
parents:
diff changeset
487 -- number of the corresponding Priority_Specific_Dispatching pragma.
kono
parents:
diff changeset
488 -- This is used in consistency messages.
kono
parents:
diff changeset
489
kono
parents:
diff changeset
490 ----------------------------
kono
parents:
diff changeset
491 -- Compilation Unit Lines --
kono
parents:
diff changeset
492 ----------------------------
kono
parents:
diff changeset
493
kono
parents:
diff changeset
494 -- Following these header lines, a set of information lines appears for
kono
parents:
diff changeset
495 -- each compilation unit that appears in the corresponding object file. In
kono
parents:
diff changeset
496 -- particular, when a package body or subprogram body is compiled, there
kono
parents:
diff changeset
497 -- will be two sets of information, one for the spec and one for the body,
kono
parents:
diff changeset
498 -- with the entry for the body appearing first. This is the only case in
kono
parents:
diff changeset
499 -- which a single ALI file contains more than one unit (in particular note
kono
parents:
diff changeset
500 -- that subunits do *not* count as compilation units for this purpose, and
kono
parents:
diff changeset
501 -- generate no library information, since they are inlined).
kono
parents:
diff changeset
502
kono
parents:
diff changeset
503 -- --------------------
kono
parents:
diff changeset
504 -- -- U Unit Header --
kono
parents:
diff changeset
505 -- --------------------
kono
parents:
diff changeset
506
kono
parents:
diff changeset
507 -- The lines for each compilation unit have the following form
kono
parents:
diff changeset
508
kono
parents:
diff changeset
509 -- U unit-name source-name version <<attributes>>
kono
parents:
diff changeset
510
kono
parents:
diff changeset
511 -- This line identifies the unit to which this section of the library
kono
parents:
diff changeset
512 -- information file applies. The first three parameters are the unit
kono
parents:
diff changeset
513 -- name in internal format, as described in package Uname, and the name
kono
parents:
diff changeset
514 -- of the source file containing the unit.
kono
parents:
diff changeset
515
kono
parents:
diff changeset
516 -- Version is the version given as eight hexadecimal characters with
kono
parents:
diff changeset
517 -- upper case letters. This value is the exclusive or of the source
kono
parents:
diff changeset
518 -- checksums of the unit and all its semantically dependent units.
kono
parents:
diff changeset
519
kono
parents:
diff changeset
520 -- The <<attributes>> are a series of two letter codes indicating
kono
parents:
diff changeset
521 -- information about the unit:
kono
parents:
diff changeset
522
kono
parents:
diff changeset
523 -- BD Unit does not have pragma Elaborate_Body, but the elaboration
kono
parents:
diff changeset
524 -- circuit has determined that it would be a good idea if this
kono
parents:
diff changeset
525 -- pragma were present, since the body of the package contains
kono
parents:
diff changeset
526 -- elaboration code that modifies one or more variables in the
kono
parents:
diff changeset
527 -- visible part of the package. The binder will try, but does
kono
parents:
diff changeset
528 -- not promise, to keep the elaboration of the body close to
kono
parents:
diff changeset
529 -- the elaboration of the spec.
kono
parents:
diff changeset
530
kono
parents:
diff changeset
531 -- DE Dynamic Elaboration. This unit was compiled with the dynamic
kono
parents:
diff changeset
532 -- elaboration model, as set by either the -gnatE switch or
kono
parents:
diff changeset
533 -- pragma Elaboration_Checks (Dynamic).
kono
parents:
diff changeset
534 --
kono
parents:
diff changeset
535 -- EB Unit has pragma Elaborate_Body, or is a generic instance that
kono
parents:
diff changeset
536 -- has a body. Set for instances because RM 12.3(20) requires
kono
parents:
diff changeset
537 -- that the body be immediately elaborated after the spec (we
kono
parents:
diff changeset
538 -- would normally do that anyway, because elaborate spec and
kono
parents:
diff changeset
539 -- body together whenever possible, and for an instance it is
kono
parents:
diff changeset
540 -- always possible; however setting EB ensures that this is done
kono
parents:
diff changeset
541 -- even when using the -p gnatbind switch).
kono
parents:
diff changeset
542
kono
parents:
diff changeset
543 -- EE Elaboration entity is present which must be set true when
kono
parents:
diff changeset
544 -- the unit is elaborated. The name of the elaboration entity is
kono
parents:
diff changeset
545 -- formed from the unit name in the usual way. If EE is present,
kono
parents:
diff changeset
546 -- then this boolean must be set True as part of the elaboration
kono
parents:
diff changeset
547 -- processing routine generated by the binder. Note that EE can
kono
parents:
diff changeset
548 -- be set even if NE is set. This happens when the boolean is
kono
parents:
diff changeset
549 -- needed solely for checking for the case of access before
kono
parents:
diff changeset
550 -- elaboration.
kono
parents:
diff changeset
551
kono
parents:
diff changeset
552 -- GE Unit is a generic declaration, or corresponding body
kono
parents:
diff changeset
553 --
kono
parents:
diff changeset
554 -- IL Unit source uses a style with identifiers in all lower-case
kono
parents:
diff changeset
555 -- IU (IL) or all upper case (IU). If the standard mixed-case usage
kono
parents:
diff changeset
556 -- is detected, or the compiler cannot determine the style, then
kono
parents:
diff changeset
557 -- no I parameter will appear.
kono
parents:
diff changeset
558
kono
parents:
diff changeset
559 -- IS Initialize_Scalars pragma applies to this unit, or else there
kono
parents:
diff changeset
560 -- is at least one use of the Invalid_Value attribute.
kono
parents:
diff changeset
561
kono
parents:
diff changeset
562 -- KM Unit source uses a style with keywords in mixed case (KM)
kono
parents:
diff changeset
563 -- KU or all upper case (KU). If the standard lower-case usage is
kono
parents:
diff changeset
564 -- is detected, or the compiler cannot determine the style, then
kono
parents:
diff changeset
565 -- no K parameter will appear.
kono
parents:
diff changeset
566
kono
parents:
diff changeset
567 -- NE Unit has no elaboration routine. All subprogram bodies and
kono
parents:
diff changeset
568 -- specs are in this category. Package bodies and specs may or
kono
parents:
diff changeset
569 -- may not have NE set, depending on whether or not elaboration
kono
parents:
diff changeset
570 -- code is required. Set if N_Compilation_Unit node has flag
kono
parents:
diff changeset
571 -- Has_No_Elaboration_Code set.
kono
parents:
diff changeset
572
kono
parents:
diff changeset
573 -- OL The units in this file are compiled with a local pragma
kono
parents:
diff changeset
574 -- Optimize_Alignment, so no consistency requirement applies
kono
parents:
diff changeset
575 -- to these units. All internal units have this status since
kono
parents:
diff changeset
576 -- they have an automatic default of Optimize_Alignment (Off).
kono
parents:
diff changeset
577 --
kono
parents:
diff changeset
578 -- OO Optimize_Alignment (Off) is the default setting for all
kono
parents:
diff changeset
579 -- units in this file. All files in the partition that specify
kono
parents:
diff changeset
580 -- a default must specify the same default.
kono
parents:
diff changeset
581
kono
parents:
diff changeset
582 -- OS Optimize_Alignment (Space) is the default setting for all
kono
parents:
diff changeset
583 -- units in this file. All files in the partition that specify
kono
parents:
diff changeset
584 -- a default must specify the same default.
kono
parents:
diff changeset
585
kono
parents:
diff changeset
586 -- OT Optimize_Alignment (Time) is the default setting for all
kono
parents:
diff changeset
587 -- units in this file. All files in the partition that specify
kono
parents:
diff changeset
588 -- a default must specify the same default.
kono
parents:
diff changeset
589
kono
parents:
diff changeset
590 -- PF The unit has a library-level (package) finalizer
kono
parents:
diff changeset
591
kono
parents:
diff changeset
592 -- PK Unit is package, rather than a subprogram
kono
parents:
diff changeset
593
kono
parents:
diff changeset
594 -- PU Unit has pragma Pure
kono
parents:
diff changeset
595
kono
parents:
diff changeset
596 -- PR Unit has pragma Preelaborate
kono
parents:
diff changeset
597
kono
parents:
diff changeset
598 -- RA Unit declares a Remote Access to Class-Wide (RACW) type
kono
parents:
diff changeset
599
kono
parents:
diff changeset
600 -- RC Unit has pragma Remote_Call_Interface
kono
parents:
diff changeset
601
kono
parents:
diff changeset
602 -- RT Unit has pragma Remote_Types
kono
parents:
diff changeset
603
kono
parents:
diff changeset
604 -- SE Compilation of unit encountered one or more serious errors.
kono
parents:
diff changeset
605 -- Normally the generation of an ALI file is suppressed if there
kono
parents:
diff changeset
606 -- is a serious error, but this can be overridden with -gnatQ.
kono
parents:
diff changeset
607
kono
parents:
diff changeset
608 -- SP Unit has pragma Shared_Passive
kono
parents:
diff changeset
609
kono
parents:
diff changeset
610 -- SU Unit is a subprogram, rather than a package
kono
parents:
diff changeset
611
kono
parents:
diff changeset
612 -- The attributes may appear in any order, separated by spaces
kono
parents:
diff changeset
613
kono
parents:
diff changeset
614 -- -----------------------------
kono
parents:
diff changeset
615 -- -- W, Y and Z Withed Units --
kono
parents:
diff changeset
616 -- -----------------------------
kono
parents:
diff changeset
617
kono
parents:
diff changeset
618 -- Following each U line, is a series of lines of the form
kono
parents:
diff changeset
619
kono
parents:
diff changeset
620 -- W unit-name [source-name lib-name] [E] [EA] [ED] [AD]
kono
parents:
diff changeset
621 -- or
kono
parents:
diff changeset
622 -- Y unit-name [source-name lib-name] [E] [EA] [ED] [AD]
kono
parents:
diff changeset
623 -- or
kono
parents:
diff changeset
624 -- Z unit-name [source-name lib-name] [E] [EA] [ED] [AD]
kono
parents:
diff changeset
625
kono
parents:
diff changeset
626 -- One W line is present for each unit that is mentioned in an explicit
kono
parents:
diff changeset
627 -- non-limited with clause by the current unit. One Y line is present
kono
parents:
diff changeset
628 -- for each unit that is mentioned in an explicit limited with clause
kono
parents:
diff changeset
629 -- by the current unit. One Z line is present for each unit that is
kono
parents:
diff changeset
630 -- only implicitly withed by the current unit. The first parameter is
kono
parents:
diff changeset
631 -- the unit name in internal format. The second parameter is the file
kono
parents:
diff changeset
632 -- name of the file that must be compiled to compile this unit. It is
kono
parents:
diff changeset
633 -- usually the file for the body, except for packages which have no
kono
parents:
diff changeset
634 -- body. For units that need a body, if the source file for the body
kono
parents:
diff changeset
635 -- cannot be found, the file name of the spec is used instead. The
kono
parents:
diff changeset
636 -- third parameter is the file name of the library information file
kono
parents:
diff changeset
637 -- that contains the results of compiling this unit. The optional
kono
parents:
diff changeset
638 -- modifiers are used as follows:
kono
parents:
diff changeset
639
kono
parents:
diff changeset
640 -- E pragma Elaborate applies to this unit
kono
parents:
diff changeset
641
kono
parents:
diff changeset
642 -- EA pragma Elaborate_All applies to this unit
kono
parents:
diff changeset
643
kono
parents:
diff changeset
644 -- ED Elaborate_Desirable set for this unit, which means that there
kono
parents:
diff changeset
645 -- is no Elaborate, but the analysis suggests that Program_Error
kono
parents:
diff changeset
646 -- may be raised if the Elaborate conditions cannot be satisfied.
kono
parents:
diff changeset
647 -- The binder will attempt to treat ED as E if it can.
kono
parents:
diff changeset
648
kono
parents:
diff changeset
649 -- AD Elaborate_All_Desirable set for this unit, which means that
kono
parents:
diff changeset
650 -- there is no Elaborate_All, but the analysis suggests that
kono
parents:
diff changeset
651 -- Program_Error may be raised if the Elaborate_All conditions
kono
parents:
diff changeset
652 -- cannot be satisfied. The binder will attempt to treat AD as
kono
parents:
diff changeset
653 -- EA if it can.
kono
parents:
diff changeset
654
kono
parents:
diff changeset
655 -- The parameter source-name and lib-name are omitted for the case of a
kono
parents:
diff changeset
656 -- generic unit compiled with earlier versions of GNAT which did not
kono
parents:
diff changeset
657 -- generate object or ali files for generics. For compatibility in the
kono
parents:
diff changeset
658 -- bootstrap path we continue to omit these entries for predefined
kono
parents:
diff changeset
659 -- generic units, even though we do now generate object and ali files.
kono
parents:
diff changeset
660
kono
parents:
diff changeset
661 -- However, in SPARK mode, we always generate source-name and lib-name
kono
parents:
diff changeset
662 -- parameters. Bootstrap issues do not apply there, and we need this
kono
parents:
diff changeset
663 -- information to properly compute frame conditions of subprograms.
kono
parents:
diff changeset
664
kono
parents:
diff changeset
665 -- The parameter source-name and lib-name are also omitted for the W
kono
parents:
diff changeset
666 -- lines that result from use of a Restriction_Set attribute which gets
kono
parents:
diff changeset
667 -- a result of False from a No_Dependence check, in the case where the
kono
parents:
diff changeset
668 -- unit is not in the semantic closure. In such a case, the bare W
kono
parents:
diff changeset
669 -- line is generated, but no D (dependency) line. This will make the
kono
parents:
diff changeset
670 -- binder do the consistency check, but not include the unit in the
kono
parents:
diff changeset
671 -- partition closure (unless it is properly With'ed somewhere).
kono
parents:
diff changeset
672
kono
parents:
diff changeset
673 -- --------------------
kono
parents:
diff changeset
674 -- -- T Task Stacks --
kono
parents:
diff changeset
675 -- --------------------
kono
parents:
diff changeset
676
kono
parents:
diff changeset
677 -- Following the W lines (if any, or the U line if not), is an optional
kono
parents:
diff changeset
678 -- line that identifies the number of default-sized primary and secondary
kono
parents:
diff changeset
679 -- stacks that the binder needs to create for the tasks declared within the
kono
parents:
diff changeset
680 -- unit. For each compilation unit, a line is present in the form:
kono
parents:
diff changeset
681
kono
parents:
diff changeset
682 -- T primary-stack-quantity secondary-stack-quantity
kono
parents:
diff changeset
683
kono
parents:
diff changeset
684 -- The first parameter of T defines the number of task objects declared
kono
parents:
diff changeset
685 -- in the unit that have no Storage_Size specified. The second parameter
kono
parents:
diff changeset
686 -- defines the number of task objects declared in the unit that have no
kono
parents:
diff changeset
687 -- Secondary_Stack_Size specified. These values are non-zero only if
kono
parents:
diff changeset
688 -- the restrictions No_Implicit_Heap_Allocations or
kono
parents:
diff changeset
689 -- No_Implicit_Task_Allocations are active.
kono
parents:
diff changeset
690
kono
parents:
diff changeset
691 -- -----------------------
kono
parents:
diff changeset
692 -- -- L Linker_Options --
kono
parents:
diff changeset
693 -- -----------------------
kono
parents:
diff changeset
694
kono
parents:
diff changeset
695 -- Following the T and W lines (if any, or the U line if not), are
kono
parents:
diff changeset
696 -- an optional series of lines that indicates the usage of the pragma
kono
parents:
diff changeset
697 -- Linker_Options in the associated unit. For each appearance of a pragma
kono
parents:
diff changeset
698 -- Linker_Options (or Link_With) in the unit, a line is present with the
kono
parents:
diff changeset
699 -- form:
kono
parents:
diff changeset
700
kono
parents:
diff changeset
701 -- L "string"
kono
parents:
diff changeset
702
kono
parents:
diff changeset
703 -- where string is the string from the unit line enclosed in quotes.
kono
parents:
diff changeset
704 -- Within the quotes the following can occur:
kono
parents:
diff changeset
705
kono
parents:
diff changeset
706 -- c graphic characters in range 20-7E other than " or {
kono
parents:
diff changeset
707 -- "" indicating a single " character
kono
parents:
diff changeset
708 -- {hh} indicating a character whose code is hex hh (0-9,A-F)
kono
parents:
diff changeset
709 -- {00} [ASCII.NUL] is used as a separator character
kono
parents:
diff changeset
710 -- to separate multiple arguments of a single
kono
parents:
diff changeset
711 -- Linker_Options pragma.
kono
parents:
diff changeset
712
kono
parents:
diff changeset
713 -- For further details, see Stringt.Write_String_Table_Entry. Note that
kono
parents:
diff changeset
714 -- wide characters in the form {hhhh} cannot be produced, since pragma
kono
parents:
diff changeset
715 -- Linker_Option accepts only String, not Wide_String.
kono
parents:
diff changeset
716
kono
parents:
diff changeset
717 -- The L lines are required to appear in the same order as the
kono
parents:
diff changeset
718 -- corresponding Linker_Options (or Link_With) pragmas appear in the
kono
parents:
diff changeset
719 -- source file, so that this order is preserved by the binder in
kono
parents:
diff changeset
720 -- constructing the set of linker arguments.
kono
parents:
diff changeset
721
kono
parents:
diff changeset
722 -- Note: Linker_Options lines never appear in the ALI file generated for
kono
parents:
diff changeset
723 -- a predefined generic unit, and there is cicuitry in Sem_Prag to enforce
kono
parents:
diff changeset
724 -- this restriction, which is needed because of not generating source name
kono
parents:
diff changeset
725 -- and lib name parameters on the with lines for such files, as explained
kono
parents:
diff changeset
726 -- above in the section on with lines.
kono
parents:
diff changeset
727
kono
parents:
diff changeset
728 -- --------------
kono
parents:
diff changeset
729 -- -- N Notes --
kono
parents:
diff changeset
730 -- --------------
kono
parents:
diff changeset
731
kono
parents:
diff changeset
732 -- The final section of unit-specific lines contains notes which record
kono
parents:
diff changeset
733 -- annotations inserted in source code for processing by external tools
kono
parents:
diff changeset
734 -- using pragmas. For each occurrence of any of these pragmas, a line is
kono
parents:
diff changeset
735 -- generated with the following syntax:
kono
parents:
diff changeset
736
kono
parents:
diff changeset
737 -- N x<sloc> [<arg_id>:]<arg> ...
kono
parents:
diff changeset
738
kono
parents:
diff changeset
739 -- x is one of:
kono
parents:
diff changeset
740 -- A pragma Annotate
kono
parents:
diff changeset
741 -- C pragma Comment
kono
parents:
diff changeset
742 -- I pragma Ident
kono
parents:
diff changeset
743 -- T pragma Title
kono
parents:
diff changeset
744 -- S pragma Subtitle
kono
parents:
diff changeset
745
kono
parents:
diff changeset
746 -- <sloc> is the source location of the pragma in line:col[:filename]
kono
parents:
diff changeset
747 -- format. The file name is omitted if it is the same as the current
kono
parents:
diff changeset
748 -- unit (it therefore appears explicitly in the case of pragmas
kono
parents:
diff changeset
749 -- occurring in subunits, which do not have U sections of their own).
kono
parents:
diff changeset
750
kono
parents:
diff changeset
751 -- Successive entries record the pragma_argument_associations.
kono
parents:
diff changeset
752
kono
parents:
diff changeset
753 -- If a pragma argument identifier is present, the entry is prefixed
kono
parents:
diff changeset
754 -- with the pragma argument identifier <arg_id> followed by a colon.
kono
parents:
diff changeset
755
kono
parents:
diff changeset
756 -- <arg> represents the pragma argument, and has the following
kono
parents:
diff changeset
757 -- conventions:
kono
parents:
diff changeset
758
kono
parents:
diff changeset
759 -- - identifiers are output verbatim
kono
parents:
diff changeset
760 -- - static string expressions are output as literals encoded as
kono
parents:
diff changeset
761 -- for L lines
kono
parents:
diff changeset
762 -- - static integer expressions are output as decimal literals
kono
parents:
diff changeset
763 -- - any other expression is replaced by the placeholder "<expr>"
kono
parents:
diff changeset
764
kono
parents:
diff changeset
765 ---------------------
kono
parents:
diff changeset
766 -- Reference Lines --
kono
parents:
diff changeset
767 ---------------------
kono
parents:
diff changeset
768
kono
parents:
diff changeset
769 -- The reference lines contain information about references from any of the
kono
parents:
diff changeset
770 -- units in the compilation (including body version and version attributes,
kono
parents:
diff changeset
771 -- linker options pragmas and source dependencies).
kono
parents:
diff changeset
772
kono
parents:
diff changeset
773 -- ------------------------------------
kono
parents:
diff changeset
774 -- -- E External Version References --
kono
parents:
diff changeset
775 -- ------------------------------------
kono
parents:
diff changeset
776
kono
parents:
diff changeset
777 -- One of these lines is present for each use of 'Body_Version or 'Version
kono
parents:
diff changeset
778 -- in any of the units of the compilation. These are used by the linker to
kono
parents:
diff changeset
779 -- determine which version symbols must be output. The format is simply:
kono
parents:
diff changeset
780
kono
parents:
diff changeset
781 -- E name
kono
parents:
diff changeset
782
kono
parents:
diff changeset
783 -- where name is the external name, i.e. the unit name with either a S or a
kono
parents:
diff changeset
784 -- B for spec or body version referenced (Body_Version always references
kono
parents:
diff changeset
785 -- the body, Version references the Spec, except in the case of a reference
kono
parents:
diff changeset
786 -- to a subprogram with no separate spec). Upper half and wide character
kono
parents:
diff changeset
787 -- codes are encoded using the same method as in Namet (Uhh for upper half,
kono
parents:
diff changeset
788 -- Whhhh for wide character, where hh are hex digits).
kono
parents:
diff changeset
789
kono
parents:
diff changeset
790 -- ---------------------
kono
parents:
diff changeset
791 -- -- D Dependencies --
kono
parents:
diff changeset
792 -- ---------------------
kono
parents:
diff changeset
793
kono
parents:
diff changeset
794 -- The dependency lines indicate the source files on which the compiled
kono
parents:
diff changeset
795 -- units depend. This is used by the binder for consistency checking.
kono
parents:
diff changeset
796 -- These lines are also referenced by the cross-reference information.
kono
parents:
diff changeset
797
kono
parents:
diff changeset
798 -- D source-name time-stamp checksum (sub)unit-name line:file-name
kono
parents:
diff changeset
799
kono
parents:
diff changeset
800 -- source-name also includes preprocessing data file and preprocessing
kono
parents:
diff changeset
801 -- definition file. These preprocessing files may be given as full
kono
parents:
diff changeset
802 -- path names instead of simple file names. If a full path name
kono
parents:
diff changeset
803 -- includes a directory with spaces, the path name is quoted (quote
kono
parents:
diff changeset
804 -- characters (") added at start and end, and any internal quotes are
kono
parents:
diff changeset
805 -- doubled).
kono
parents:
diff changeset
806
kono
parents:
diff changeset
807 -- The time-stamp field contains the time stamp of the corresponding
kono
parents:
diff changeset
808 -- source file. See types.ads for details on time stamp representation.
kono
parents:
diff changeset
809
kono
parents:
diff changeset
810 -- The checksum is an 8-hex digit representation of the source file
kono
parents:
diff changeset
811 -- checksum, with letters given in lower case.
kono
parents:
diff changeset
812
kono
parents:
diff changeset
813 -- If the unit is not a subunit, the (sub)unit name is the unit name in
kono
parents:
diff changeset
814 -- internal format, as described in package Uname. If the unit is a
kono
parents:
diff changeset
815 -- subunit, the (sub)unit name is the fully qualified name of the
kono
parents:
diff changeset
816 -- subunit in all lower case letters.
kono
parents:
diff changeset
817
kono
parents:
diff changeset
818 -- The line:file-name entry is present only if a Source_Reference
kono
parents:
diff changeset
819 -- pragma appeared in the source file identified by source-name. In
kono
parents:
diff changeset
820 -- this case, it gives the information from this pragma. Note that this
kono
parents:
diff changeset
821 -- allows cross-reference information to be related back to the
kono
parents:
diff changeset
822 -- original file. Note: the reason the line number comes first is that
kono
parents:
diff changeset
823 -- a leading digit immediately identifies this as a Source_Reference
kono
parents:
diff changeset
824 -- entry, rather than a subunit-name.
kono
parents:
diff changeset
825
kono
parents:
diff changeset
826 -- A line number of zero for line: in this entry indicates that there
kono
parents:
diff changeset
827 -- is more than one source reference pragma. In this case, the line
kono
parents:
diff changeset
828 -- numbers in the cross-reference are correct, and refer to the
kono
parents:
diff changeset
829 -- original line number, but there is no information that allows a
kono
parents:
diff changeset
830 -- reader of the ALI file to determine the exact mapping of physical
kono
parents:
diff changeset
831 -- line numbers back to the original source.
kono
parents:
diff changeset
832
kono
parents:
diff changeset
833 -- Files with a zero checksum and a non-zero time stamp are in general
kono
parents:
diff changeset
834 -- files on which the compilation depends but which are not Ada files
kono
parents:
diff changeset
835 -- with further dependencies. This includes preprocessor data files
kono
parents:
diff changeset
836 -- and preprocessor definition files.
kono
parents:
diff changeset
837
kono
parents:
diff changeset
838 -- Note: blank lines are ignored when the library information is read,
kono
parents:
diff changeset
839 -- and separate sections of the file are separated by blank lines to
kono
parents:
diff changeset
840 -- ease readability. Blanks between fields are also ignored.
kono
parents:
diff changeset
841
kono
parents:
diff changeset
842 -- For entries corresponding to files that were not present (and thus
kono
parents:
diff changeset
843 -- resulted in error messages), or for files that are not part of the
kono
parents:
diff changeset
844 -- dependency set, both the time stamp and checksum are set to all zero
kono
parents:
diff changeset
845 -- characters. These dummy entries are ignored by the binder in
kono
parents:
diff changeset
846 -- dependency checking, but must be present for proper interpretation
kono
parents:
diff changeset
847 -- of the cross-reference data.
kono
parents:
diff changeset
848
kono
parents:
diff changeset
849 --------------------------
kono
parents:
diff changeset
850 -- Cross-Reference Data --
kono
parents:
diff changeset
851 --------------------------
kono
parents:
diff changeset
852
kono
parents:
diff changeset
853 -- The cross-reference data follows the dependency lines. See the spec of
kono
parents:
diff changeset
854 -- Lib.Xref in file lib-xref.ads for details on the format of this data.
kono
parents:
diff changeset
855
kono
parents:
diff changeset
856 ---------------------------------
kono
parents:
diff changeset
857 -- Source Coverage Obligations --
kono
parents:
diff changeset
858 ---------------------------------
kono
parents:
diff changeset
859
kono
parents:
diff changeset
860 -- The Source Coverage Obligation (SCO) information follows the cross-
kono
parents:
diff changeset
861 -- reference data. See the spec of Par_SCO in file par_sco.ads for full
kono
parents:
diff changeset
862 -- details of the format.
kono
parents:
diff changeset
863
kono
parents:
diff changeset
864 ---------------------------------------
kono
parents:
diff changeset
865 -- SPARK Cross-Reference Information --
kono
parents:
diff changeset
866 ---------------------------------------
kono
parents:
diff changeset
867
kono
parents:
diff changeset
868 -- The SPARK cross-reference information follows the SCO information. See
kono
parents:
diff changeset
869 -- the spec of SPARK_Xrefs in file spark_xrefs.ads for full details of the
kono
parents:
diff changeset
870 -- format.
kono
parents:
diff changeset
871
kono
parents:
diff changeset
872 -------------------------------
kono
parents:
diff changeset
873 -- ALI File Generation for C --
kono
parents:
diff changeset
874 -------------------------------
kono
parents:
diff changeset
875
kono
parents:
diff changeset
876 -- The C compiler can also generate ALI files for use by the IDE's in
kono
parents:
diff changeset
877 -- providing navigation services in C. These ALI files are a subset of
kono
parents:
diff changeset
878 -- the specification above, lacking all Ada-specific output. Primarily
kono
parents:
diff changeset
879 -- the IDE uses the cross-reference sections of such files.
kono
parents:
diff changeset
880
kono
parents:
diff changeset
881 ----------------------
kono
parents:
diff changeset
882 -- Global Variables --
kono
parents:
diff changeset
883 ----------------------
kono
parents:
diff changeset
884
kono
parents:
diff changeset
885 -- The table defined here stores one entry for each Interrupt_State pragma
kono
parents:
diff changeset
886 -- encountered either in the main source or in an ancillary with'ed source.
kono
parents:
diff changeset
887 -- Since interrupt state values have to be consistent across all units in a
kono
parents:
diff changeset
888 -- partition, we detect inconsistencies at compile time when we can.
kono
parents:
diff changeset
889
kono
parents:
diff changeset
890 type Interrupt_State_Entry is record
kono
parents:
diff changeset
891 Interrupt_Number : Pos;
kono
parents:
diff changeset
892 -- Interrupt number value
kono
parents:
diff changeset
893
kono
parents:
diff changeset
894 Interrupt_State : Character;
kono
parents:
diff changeset
895 -- Set to r/s/u for Runtime/System/User
kono
parents:
diff changeset
896
kono
parents:
diff changeset
897 Pragma_Loc : Source_Ptr;
kono
parents:
diff changeset
898 -- Location of pragma setting this value in place
kono
parents:
diff changeset
899 end record;
kono
parents:
diff changeset
900
kono
parents:
diff changeset
901 package Interrupt_States is new Table.Table (
kono
parents:
diff changeset
902 Table_Component_Type => Interrupt_State_Entry,
kono
parents:
diff changeset
903 Table_Index_Type => Nat,
kono
parents:
diff changeset
904 Table_Low_Bound => 1,
kono
parents:
diff changeset
905 Table_Initial => 30,
kono
parents:
diff changeset
906 Table_Increment => 200,
kono
parents:
diff changeset
907 Table_Name => "Name_Interrupt_States");
kono
parents:
diff changeset
908
kono
parents:
diff changeset
909 -- The table structure defined here stores one entry for each
kono
parents:
diff changeset
910 -- Priority_Specific_Dispatching pragma encountered either in the main
kono
parents:
diff changeset
911 -- source or in an ancillary with'ed source. Since have to be consistent
kono
parents:
diff changeset
912 -- across all units in a partition, we may as well detect inconsistencies
kono
parents:
diff changeset
913 -- at compile time when we can.
kono
parents:
diff changeset
914
kono
parents:
diff changeset
915 type Specific_Dispatching_Entry is record
kono
parents:
diff changeset
916 Dispatching_Policy : Character;
kono
parents:
diff changeset
917 -- First character (upper case) of the corresponding policy name
kono
parents:
diff changeset
918
kono
parents:
diff changeset
919 First_Priority : Nat;
kono
parents:
diff changeset
920 -- Lower bound of the priority range to which the specified dispatching
kono
parents:
diff changeset
921 -- policy applies.
kono
parents:
diff changeset
922
kono
parents:
diff changeset
923 Last_Priority : Nat;
kono
parents:
diff changeset
924 -- Upper bound of the priority range to which the specified dispatching
kono
parents:
diff changeset
925 -- policy applies.
kono
parents:
diff changeset
926
kono
parents:
diff changeset
927 Pragma_Loc : Source_Ptr;
kono
parents:
diff changeset
928 -- Location of pragma setting this value in place
kono
parents:
diff changeset
929 end record;
kono
parents:
diff changeset
930
kono
parents:
diff changeset
931 package Specific_Dispatching is new Table.Table (
kono
parents:
diff changeset
932 Table_Component_Type => Specific_Dispatching_Entry,
kono
parents:
diff changeset
933 Table_Index_Type => Nat,
kono
parents:
diff changeset
934 Table_Low_Bound => 1,
kono
parents:
diff changeset
935 Table_Initial => 10,
kono
parents:
diff changeset
936 Table_Increment => 100,
kono
parents:
diff changeset
937 Table_Name => "Name_Priority_Specific_Dispatching");
kono
parents:
diff changeset
938
kono
parents:
diff changeset
939 -----------------
kono
parents:
diff changeset
940 -- Subprograms --
kono
parents:
diff changeset
941 -----------------
kono
parents:
diff changeset
942
kono
parents:
diff changeset
943 procedure Ensure_System_Dependency;
kono
parents:
diff changeset
944 -- This procedure ensures that a dependency is created on system.ads. Even
kono
parents:
diff changeset
945 -- if there is no semantic dependency, Targparm has read the file to
kono
parents:
diff changeset
946 -- acquire target parameters, so we need a source dependency.
kono
parents:
diff changeset
947
kono
parents:
diff changeset
948 procedure Write_ALI (Object : Boolean);
kono
parents:
diff changeset
949 -- This procedure writes the library information for the current main unit
kono
parents:
diff changeset
950 -- The Object parameter is true if an object file is created, and false
kono
parents:
diff changeset
951 -- otherwise. Note that the pseudo-object file generated in GNATProve mode
kono
parents:
diff changeset
952 -- does count as an object file from this point of view.
kono
parents:
diff changeset
953 --
kono
parents:
diff changeset
954 -- Note: in the case where we are not generating code (-gnatc mode), this
kono
parents:
diff changeset
955 -- routine only writes an ALI file if it cannot find an existing up to
kono
parents:
diff changeset
956 -- date ALI file. If it *can* find an existing up to date ALI file, then
kono
parents:
diff changeset
957 -- it reads this file and sets the Lib.Compilation_Arguments table from
kono
parents:
diff changeset
958 -- the A lines in this file.
kono
parents:
diff changeset
959
kono
parents:
diff changeset
960 procedure Add_Preprocessing_Dependency (S : Source_File_Index);
kono
parents:
diff changeset
961 -- Indicate that there is a dependency to be added on a preprocessing data
kono
parents:
diff changeset
962 -- file or on a preprocessing definition file.
kono
parents:
diff changeset
963
kono
parents:
diff changeset
964 end Lib.Writ;