ali.adb: Set Allocator_In_Body if AB parameter present on M line
[gcc.git] / gcc / ada / lib-writ.ads
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- L I B . W R I T --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2010, 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 -- This package contains the routines for writing the library information
27
28 package Lib.Writ is
29
30 -----------------------------------
31 -- Format of Library Information --
32 -----------------------------------
33
34 -- This section describes the format of the library information that is
35 -- associated with object files. The exact method of this association is
36 -- potentially implementation dependent and is described and implemented in
37 -- package ali. From the point of view of the description here, all we need
38 -- to know is that the information is represented as a string of characters
39 -- that is somehow associated with an object file, and can be retrieved. If
40 -- no library information exists for a given object file, then we take this
41 -- as equivalent to the non-existence of the object file, as if source file
42 -- has not been previously compiled.
43
44 -- The library information is written as a series of lines of the form:
45
46 -- Key_Character parameter parameter ...
47
48 -- The following sections describe the format of these lines in detail
49
50 --------------------------------------
51 -- Making Changes to the ALI Format --
52 --------------------------------------
53
54 -- A number of tools use ali.adb to parse ali files. This means that
55 -- changes to this format can cause old versions of these tools to be
56 -- incompatible with new versions of the compiler. Any changes to ali file
57 -- formats must be carefully evaluated to understand any such possible
58 -- conflicts, and in particular, it is very undesirable to create conflicts
59 -- between older versions of GPS and newer versions of the compiler.
60
61 -- If the following guidelines are respected, downward compatibility
62 -- problems (old tools reading new ali files) should be minimized:
63
64 -- The basic key character format must be kept
65
66 -- The V line must be the first line, this is checked by ali.adb even in
67 -- Ignore_Errors mode, and is used to verify that the file at hand is
68 -- indeed likely intended to be an ali file.
69
70 -- The P line must be present, though may be modified in contents
71 -- according to remaining guidelines. Again, ali.adb assumes the P
72 -- line is present even in Ignore_Errors mode.
73
74 -- New modifiers can generally be added (in particular adding new two
75 -- letter modifiers to the P or U lines is always safe)
76
77 -- Adding entirely new lines (with a new key letter) to the ali file is
78 -- always safe, at any point (other than before the V line), since such
79 -- lines will be ignored.
80
81 -- Following the guidelines in this section should ensure that this problem
82 -- is minimized and that old tools will be able to deal successfully with
83 -- new ali formats. Note that this does not apply to the compiler itself,
84 -- which always requires consistency between the ali files and the binder.
85 -- That is because one of the main functions of the binder is to ensure
86 -- consistency of the partition, and this can be compromised if the ali
87 -- files are inconsistent.
88
89 ------------------
90 -- Header Lines --
91 ------------------
92
93 -- The initial header lines in the file give information about the
94 -- compilation environment, and identify other special information such as
95 -- main program parameters.
96
97 -- ----------------
98 -- -- V Version --
99 -- ----------------
100
101 -- V "xxxxxxxxxxxxxxxx"
102 --
103 -- This line indicates the library output version, as defined in
104 -- Gnatvsn. It ensures that separate object modules of a program are
105 -- consistent. It has to be changed if anything changes which would
106 -- affect successful binding of separately compiled modules. Examples
107 -- of such changes are modifications in the format of the library info
108 -- described in this package, or modifications to calling sequences, or
109 -- to the way that data is represented.
110
111 -- Note: the V line absolutely must be the first line, and no change
112 -- to the ALI format should change this, since even in Ignore_Errors
113 -- mode, Scan_ALI insists on finding a V line.
114
115 -- ---------------------
116 -- -- M Main Program --
117 -- ---------------------
118
119 -- M type [priority] [T=time-slice] [AB] W=?
120
121 -- This line appears only if the main unit for this file is suitable
122 -- for use as a main program. The parameters are:
123
124 -- type
125
126 -- P for a parameterless procedure
127 -- F for a function returning a value of integral type
128 -- (used for writing a main program returning an exit status)
129
130 -- priority
131
132 -- Present only if there was a valid pragma Priority in the
133 -- corresponding unit to set the main task priority. It is an
134 -- unsigned decimal integer.
135
136 -- T=time-slice
137
138 -- Present only if there was a valid pragma Time_Slice in the
139 -- corresponding unit. It is an unsigned decimal integer in the
140 -- range 0 .. 10**9 giving the time slice value in units of
141 -- milliseconds. The actual significance of this parameter is
142 -- target dependent.
143
144 -- AB
145
146 -- Present if there is an allocator in the body of the procedure
147 -- after the BEGIN. This will be a violation of the restriction
148 -- No_Allocators_After_Elaboration if it is present, and this
149 -- unit is used as a main program (only the binder can find the
150 -- violation, since only the binder knows the main program).
151 --
152
153 -- W=?
154
155 -- This parameter indicates the wide character encoding method used
156 -- when compiling the main program file. The ? character is the
157 -- single character used in the -gnatW? switch. This is used to
158 -- provide the default wide-character encoding for Wide_Text_IO
159 -- files.
160
161 -- -----------------
162 -- -- A Argument --
163 -- -----------------
164
165 -- A argument
166
167 -- One of these lines appears for each of the arguments present in the
168 -- call to the gnat1 program. This can be used if it is necessary to
169 -- reconstruct this call (e.g. for fix and continue).
170
171 -- -------------------
172 -- -- P Parameters --
173 -- -------------------
174
175 -- P <<parameters>>
176
177 -- Indicates various information that applies to the compilation of the
178 -- corresponding source file. Parameters is a sequence of zero or more
179 -- two letter codes that indicate configuration pragmas and other
180 -- parameters that apply:
181 --
182 -- The arguments are as follows:
183 --
184 -- CE Compilation errors. If this is present it means that the ali
185 -- file resulted from a compilation with the -gnatQ switch set,
186 -- and illegalities were detected. The ali file contents may
187 -- not be completely reliable, but the format will be correct
188 -- and complete. Note that NO is always present if CE is
189 -- present.
190 --
191 -- DB Detect_Blocking pragma is in effect for all units in this
192 -- file.
193 --
194 -- FD Configuration pragmas apply to all the units in this file
195 -- specifying a possibly non-standard floating point format
196 -- (VAX float with Long_Float using D_Float).
197 --
198 -- FG Configuration pragmas apply to all the units in this file
199 -- specifying a possibly non-standard floating point format
200 -- (VAX float with Long_Float using G_Float).
201 --
202 -- FI Configuration pragmas apply to all the units in this file
203 -- specifying a possibly non-standard floating point format
204 -- (IEEE Float).
205 --
206 -- Lx A valid Locking_Policy pragma applies to all the units in
207 -- this file, where x is the first character (upper case) of
208 -- the policy name (e.g. 'C' for Ceiling_Locking).
209 --
210 -- NO No object. This flag indicates that the units in this file
211 -- were not compiled to produce an object. This can occur as a
212 -- result of the use of -gnatc, or if no object can be produced
213 -- (e.g. when a package spec is compiled instead of the body,
214 -- or a subunit on its own).
215 --
216 -- NR No_Run_Time. Indicates that a pragma No_Run_Time applies
217 -- to all units in the file.
218 --
219 -- NS Normalize_Scalars pragma in effect for all units in
220 -- this file.
221 --
222 -- Qx A valid Queueing_Policy pragma applies to all the units
223 -- in this file, where x is the first character (upper case)
224 -- of the policy name (e.g. 'P' for Priority_Queueing).
225 --
226 -- SL Indicates that the unit is an Interface to a Standalone
227 -- Library. Note that this indication is never given by the
228 -- compiler, but is added by the Project Manager in gnatmake
229 -- when an Interface ALI file is copied to the library
230 -- directory.
231
232 -- SS This unit references System.Secondary_Stack (that is,
233 -- the unit makes use of the secondary stack facilities).
234 --
235 -- Tx A valid Task_Dispatching_Policy pragma applies to all
236 -- the units in this file, where x is the first character
237 -- (upper case) of the corresponding policy name (e.g. 'F'
238 -- for FIFO_Within_Priorities).
239 --
240 -- UA Unreserve_All_Interrupts pragma was processed in one or
241 -- more units in this file
242 --
243 -- ZX Units in this file use zero-cost exceptions and have
244 -- generated exception tables. If ZX is not present, the
245 -- longjmp/setjmp exception scheme is in use.
246 --
247 -- Note that language defined units never output policy (Lx, Tx, Qx)
248 -- parameters. Language defined units must correctly handle all
249 -- possible cases. These values are checked for consistency by the
250 -- binder and then copied to the generated binder output file.
251
252 -- Note: The P line must be present. Even in Ignore_Errors mode, Scan_ALI
253 -- insists on finding a P line. So if changes are made to the ALI format,
254 -- they should not include removing the P line!
255
256 -- ---------------------
257 -- -- R Restrictions --
258 -- ---------------------
259
260 -- The first R line records the status of restrictions generated by pragma
261 -- Restrictions encountered, as well as information on what the compiler
262 -- has been able to determine with respect to restrictions violations.
263 -- The format is:
264
265 -- R <<restriction-characters>> <<restriction-param-id-entries>>
266
267 -- The first parameter is a string of characters that records
268 -- information regarding restrictions that do not take parameter not
269 -- take parameter values. It is a string of characters, one character
270 -- for each value (in order) in All_Boolean_Restrictions. There are
271 -- three possible settings for each restriction:
272
273 -- r Restricted. Unit was compiled under control of a pragma
274 -- Restrictions for the corresponding restriction. In this case
275 -- the unit certainly does not violate the Restriction, since
276 -- this would have been detected by the compiler.
277
278 -- n Not used. The unit was not compiled under control of a pragma
279 -- Restrictions for the corresponding restriction, and does not
280 -- make any use of the referenced feature.
281
282 -- v Violated. The unit was not compiled under control of a pragma
283 -- Restrictions for the corresponding restriction, and it does
284 -- indeed use the referenced feature.
285
286 -- This information is used in the binder to check consistency, i.e. to
287 -- detect cases where one unit has "r" and another unit has "v", which
288 -- is not permitted, since these restrictions are partition-wide.
289
290 -- The second parameter, which immediately follows the first (with no
291 -- separating space) gives restriction information for identifiers for
292 -- which a parameter is given.
293
294 -- The parameter is a string of entries, one for each value in
295 -- Restrict.All_Parameter_Restrictions. Each entry has two components
296 -- in sequence, the first indicating whether or not there is a
297 -- restriction, and the second indicating whether or not the compiler
298 -- detected violations. In the boolean case it is not necessary to
299 -- separate these, since if a restriction is set, and violated, that is
300 -- an error. But in the parameter case, this is not true. For example,
301 -- we can have a unit with a pragma Restrictions (Max_Tasks => 4),
302 -- where the compiler can detect that there are exactly three tasks
303 -- declared. Both of these pieces of information must be passed to the
304 -- binder. The parameter of 4 is important in case the total number of
305 -- tasks in the partition is greater than 4. The parameter of 3 is
306 -- important in case some other unit has a restrictions pragma with
307 -- Max_Tasks=>2.
308
309 -- The component for the presence of restriction has one of two
310 -- possible forms:
311
312 -- n No pragma for this restriction is present in the set of units
313 -- for this ali file.
314
315 -- rN At least one pragma for this restriction is present in the
316 -- set of units for this ali file. The value N is the minimum
317 -- parameter value encountered in any such pragma. N is in the
318 -- range of Integer (a value larger than N'Last causes the
319 -- pragma to be ignored).
320
321 -- The component for the violation detection has one of three
322 -- possible forms:
323
324 -- n No violations were detected by the compiler
325
326 -- vN A violation was detected. N is either the maximum or total
327 -- count of violations (depending on the checking type) in all
328 -- the units represented by the ali file). Note that this
329 -- setting is only allowed for restrictions that are in
330 -- Checked_[Max|Sum]_Parameter_Restrictions. The value here is
331 -- known to be exact by the compiler and is in the range of
332 -- Natural.
333
334 -- vN+ A violation was detected. The compiler cannot determine
335 -- the exact count of violations, but it is at least N.
336
337 -- There are no spaces within the parameter string, so the entry
338 -- described above in the header of this section for Max_Tasks would
339 -- appear as the string r4v3.
340
341 -- Note: The restrictions line is required to be present. Even in
342 -- Ignore_Errors mode, Scan_ALI expects to find an R line and will
343 -- signal a fatal error if it is missing. This means that future
344 -- changes to the ALI file format must retain the R line.
345
346 -- Subsequent R lines are present only if pragma Restriction No_Dependence
347 -- is used. There is one such line for each such pragma appearing in the
348 -- extended main unit. The format is
349
350 -- R unit_name
351
352 -- Here the unit name is in all lower case. The components of the unit
353 -- name are separated by periods. The names themselves are in encoded
354 -- form, as documented in Namet.
355
356 -- -------------------------
357 -- -- I Interrupt States --
358 -- -------------------------
359
360 -- I interrupt-number interrupt-state line-number
361
362 -- This line records information from an Interrupt_State pragma. There
363 -- is one line for each separate pragma, and if no such pragmas are
364 -- used, then no I lines are present.
365
366 -- The interrupt-number is an unsigned positive integer giving the
367 -- value of the interrupt as defined in Ada.Interrupts.Names.
368
369 -- The interrupt-state is one of r/s/u for Runtime/System/User
370
371 -- The line number is an unsigned decimal integer giving the line
372 -- number of the corresponding Interrupt_State pragma. This is used
373 -- in consistency messages.
374
375 -- --------------------------------------
376 -- -- S Priority Specific Dispatching --
377 -- --------------------------------------
378
379 -- S policy_identifier first_priority last_priority line-number
380
381 -- This line records information from a Priority_Specific_Dispatching
382 -- pragma. There is one line for each separate pragma, and if no such
383 -- pragmas are used, then no S lines are present.
384
385 -- The policy_identifier is the first character (upper case) of the
386 -- corresponding policy name (e.g. 'F' for FIFO_Within_Priorities).
387
388 -- The first_priority and last_priority fields define the range of
389 -- priorities to which the specified dispatching policy apply.
390
391 -- The line number is an unsigned decimal integer giving the line
392 -- number of the corresponding Priority_Specific_Dispatching pragma.
393 -- This is used in consistency messages.
394
395 ----------------------------
396 -- Compilation Unit Lines --
397 ----------------------------
398
399 -- Following these header lines, a set of information lines appears for
400 -- each compilation unit that appears in the corresponding object file. In
401 -- particular, when a package body or subprogram body is compiled, there
402 -- will be two sets of information, one for the spec and one for the body,
403 -- with the entry for the body appearing first. This is the only case in
404 -- which a single ALI file contains more than one unit (in particular note
405 -- that subunits do *not* count as compilation units for this purpose, and
406 -- generate no library information, since they are inlined).
407
408 -- --------------------
409 -- -- U Unit Header --
410 -- --------------------
411
412 -- The lines for each compilation unit have the following form
413
414 -- U unit-name source-name version <<attributes>>
415 --
416 -- This line identifies the unit to which this section of the library
417 -- information file applies. The first three parameters are the unit
418 -- name in internal format, as described in package Uname, and the name
419 -- of the source file containing the unit.
420 --
421 -- Version is the version given as eight hexadecimal characters with
422 -- upper case letters. This value is the exclusive or of the source
423 -- checksums of the unit and all its semantically dependent units.
424 --
425 -- The <<attributes>> are a series of two letter codes indicating
426 -- information about the unit:
427 --
428 -- BD Unit does not have pragma Elaborate_Body, but the elaboration
429 -- circuit has determined that it would be a good idea if this
430 -- pragma were present, since the body of the package contains
431 -- elaboration code that modifies one or more variables in the
432 -- visible part of the package. The binder will try, but does
433 -- not promise, to keep the elaboration of the body close to
434 -- the elaboration of the spec.
435 --
436 -- DE Dynamic Elaboration. This unit was compiled with the dynamic
437 -- elaboration model, as set by either the -gnatE switch or
438 -- pragma Elaboration_Checks (Dynamic).
439 --
440 -- EB Unit has pragma Elaborate_Body, or is a generic instance that
441 -- has a body. Set for instances because RM 12.3(20) requires
442 -- that the body be immediately elaborated after the spec (we
443 -- would normally do that anyway, because elaborate spec and
444 -- body together whenever possible, and for an instance it is
445 -- always possible; however setting EB ensures that this is done
446 -- even when using the -p gnatbind switch).
447 --
448 -- EE Elaboration entity is present which must be set true when
449 -- the unit is elaborated. The name of the elaboration entity is
450 -- formed from the unit name in the usual way. If EE is present,
451 -- then this boolean must be set True as part of the elaboration
452 -- processing routine generated by the binder. Note that EE can
453 -- be set even if NE is set. This happens when the boolean is
454 -- needed solely for checking for the case of access before
455 -- elaboration.
456 --
457 -- GE Unit is a generic declaration, or corresponding body
458 --
459 -- IL Unit source uses a style with identifiers in all lower-case
460 -- IU (IL) or all upper case (IU). If the standard mixed-case usage
461 -- is detected, or the compiler cannot determine the style, then
462 -- no I parameter will appear.
463 --
464 -- IS Initialize_Scalars pragma applies to this unit, or else there
465 -- is at least one use of the Invalid_Value attribute.
466 --
467 -- KM Unit source uses a style with keywords in mixed case (KM)
468 -- KU or all upper case (KU). If the standard lower-case usage is
469 -- is detected, or the compiler cannot determine the style, then
470 -- no K parameter will appear.
471 --
472 -- NE Unit has no elaboration routine. All subprogram bodies and
473 -- specs are in this category. Package bodies and specs may or
474 -- may not have NE set, depending on whether or not elaboration
475 -- code is required. Set if N_Compilation_Unit node has flag
476 -- Has_No_Elaboration_Code set.
477 --
478 -- OL The units in this file are compiled with a local pragma
479 -- Optimize_Alignment, so no consistency requirement applies
480 -- to these units. All internal units have this status since
481 -- they have an automatic default of Optimize_Alignment (Off).
482 --
483 -- OO Optimize_Alignment (Off) is the default setting for all
484 -- units in this file. All files in the partition that specify
485 -- a default must specify the same default.
486 --
487 -- OS Optimize_Alignment (Space) is the default setting for all
488 -- units in this file. All files in the partition that specify
489 -- a default must specify the same default.
490 --
491 -- OT Optimize_Alignment (Time) is the default setting for all
492 -- units in this file. All files in the partition that specify
493 -- a default must specify the same default.
494 --
495 -- PK Unit is package, rather than a subprogram
496 --
497 -- PU Unit has pragma Pure
498 --
499 -- PR Unit has pragma Preelaborate
500 --
501 -- RA Unit declares a Remote Access to Class-Wide (RACW) type
502 --
503 -- RC Unit has pragma Remote_Call_Interface
504 --
505 -- RT Unit has pragma Remote_Types
506 --
507 -- SP Unit has pragma Shared_Passive.
508 --
509 -- SU Unit is a subprogram, rather than a package
510 --
511 -- The attributes may appear in any order, separated by spaces.
512
513 -- ---------------------
514 -- -- W Withed Units --
515 -- ---------------------
516
517 -- Following each U line, is a series of lines of the form
518
519 -- W unit-name [source-name lib-name] [E] [EA] [ED] [AD]
520 --
521 -- One of these lines is present for each unit that is mentioned in an
522 -- explicit with clause by the current unit. The first parameter is the
523 -- unit name in internal format. The second parameter is the file name
524 -- of the file that must be compiled to compile this unit. It is
525 -- usually the file for the body, except for packages which have no
526 -- body. For units that need a body, if the source file for the body
527 -- cannot be found, the file name of the spec is used instead. The
528 -- third parameter is the file name of the library information file
529 -- that contains the results of compiling this unit. The optional
530 -- modifiers are used as follows:
531 --
532 -- E pragma Elaborate applies to this unit
533 --
534 -- EA pragma Elaborate_All applies to this unit
535 --
536 -- ED Elaborate_Desirable set for this unit, which means that there
537 -- is no Elaborate, but the analysis suggests that Program_Error
538 -- may be raised if the Elaborate conditions cannot be satisfied.
539 -- The binder will attempt to treat ED as E if it can.
540 --
541 -- AD Elaborate_All_Desirable set for this unit, which means that
542 -- there is no Elaborate_All, but the analysis suggests that
543 -- Program_Error may be raised if the Elaborate_All conditions
544 -- cannot be satisfied. The binder will attempt to treat AD as
545 -- EA if it can.
546 --
547 -- The parameter source-name and lib-name are omitted for the case of a
548 -- generic unit compiled with earlier versions of GNAT which did not
549 -- generate object or ali files for generics.
550
551 -- In fact W lines include implicit withs ???
552
553 -- -----------------------
554 -- -- L Linker_Options --
555 -- -----------------------
556
557 -- Following the W lines (if any, or the U line if not), are an optional
558 -- series of lines that indicates the usage of the pragma Linker_Options in
559 -- the associated unit. For each appearance of a pragma Linker_Options (or
560 -- Link_With) in the unit, a line is present with the form:
561
562 -- L "string"
563
564 -- where string is the string from the unit line enclosed in quotes.
565 -- Within the quotes the following can occur:
566
567 -- c graphic characters in range 20-7E other than " or {
568 -- "" indicating a single " character
569 -- {hh} indicating a character whose code is hex hh (0-9,A-F)
570 -- {00} [ASCII.NUL] is used as a separator character
571 -- to separate multiple arguments of a single
572 -- Linker_Options pragma.
573
574 -- For further details, see Stringt.Write_String_Table_Entry. Note that
575 -- wide characters in the form {hhhh} cannot be produced, since pragma
576 -- Linker_Option accepts only String, not Wide_String.
577
578 -- The L lines are required to appear in the same order as the
579 -- corresponding Linker_Options (or Link_With) pragmas appear in the
580 -- source file, so that this order is preserved by the binder in
581 -- constructing the set of linker arguments.
582
583 -- --------------
584 -- -- N Notes --
585 -- --------------
586
587 -- The final section of unit-specific lines contains notes which record
588 -- annotations inserted in source code for processing by external tools
589 -- using pragmas. For each occurrence of any of these pragmas, a line is
590 -- generated with the following syntax:
591
592 -- N x<sloc> [<arg_id>:]<arg> ...
593
594 -- x is one of:
595 -- A pragma Annotate
596 -- C pragma Comment
597 -- I pragma Ident
598 -- T pragma Title
599 -- S pragma Subtitle
600
601 -- <sloc> is the source location of the pragma in line:col format
602
603 -- Successive entries record the pragma_argument_associations.
604
605 -- If a pragma argument identifier is present, the entry is prefixed
606 -- with the pragma argument identifier <arg_id> followed by a colon.
607
608 -- <arg> represents the pragma argument, and has the following
609 -- conventions:
610
611 -- - identifiers are output verbatim
612 -- - static string expressions are output as literals encoded as
613 -- for L lines
614 -- - static integer expressions are output as decimal literals
615 -- - any other expression is replaced by the placeholder "<expr>"
616
617 ---------------------
618 -- Reference Lines --
619 ---------------------
620
621 -- The reference lines contain information about references from any of the
622 -- units in the compilation (including body version and version attributes,
623 -- linker options pragmas and source dependencies).
624
625 -- ------------------------------------
626 -- -- E External Version References --
627 -- ------------------------------------
628
629 -- One of these lines is present for each use of 'Body_Version or 'Version
630 -- in any of the units of the compilation. These are used by the linker to
631 -- determine which version symbols must be output. The format is simply:
632
633 -- E name
634
635 -- where name is the external name, i.e. the unit name with either a S or a
636 -- B for spec or body version referenced (Body_Version always references
637 -- the body, Version references the Spec, except in the case of a reference
638 -- to a subprogram with no separate spec). Upper half and wide character
639 -- codes are encoded using the same method as in Namet (Uhh for upper half,
640 -- Whhhh for wide character, where hh are hex digits).
641
642 -- ---------------------
643 -- -- D Dependencies --
644 -- ---------------------
645
646 -- The dependency lines indicate the source files on which the compiled
647 -- units depend. This is used by the binder for consistency checking.
648 -- These lines are also referenced by the cross-reference information.
649
650 -- D source-name time-stamp checksum [subunit-name] line:file-name
651
652 -- The time-stamp field contains the time stamp of the corresponding
653 -- source file. See types.ads for details on time stamp representation.
654
655 -- The checksum is an 8-hex digit representation of the source file
656 -- checksum, with letters given in lower case.
657
658 -- The subunit name is present only if the dependency line is for a
659 -- subunit. It contains the fully qualified name of the subunit in all
660 -- lower case letters.
661
662 -- The line:file-name entry is present only if a Source_Reference
663 -- pragma appeared in the source file identified by source-name. In
664 -- this case, it gives the information from this pragma. Note that this
665 -- allows cross-reference information to be related back to the
666 -- original file. Note: the reason the line number comes first is that
667 -- a leading digit immediately identifies this as a Source_Reference
668 -- entry, rather than a subunit-name.
669
670 -- A line number of zero for line: in this entry indicates that there
671 -- is more than one source reference pragma. In this case, the line
672 -- numbers in the cross-reference are correct, and refer to the
673 -- original line number, but there is no information that allows a
674 -- reader of the ALI file to determine the exact mapping of physical
675 -- line numbers back to the original source.
676
677 -- Files with a zero checksum and a non-zero time stamp are in general
678 -- files on which the compilation depends but which are not Ada files
679 -- with further dependencies. This includes preprocessor data files
680 -- and preprocessor definition files.
681
682 -- Note: blank lines are ignored when the library information is read,
683 -- and separate sections of the file are separated by blank lines to
684 -- ease readability. Blanks between fields are also ignored.
685
686 -- For entries corresponding to files that were not present (and thus
687 -- resulted in error messages), or for files that are not part of the
688 -- dependency set, both the time stamp and checksum are set to all zero
689 -- characters. These dummy entries are ignored by the binder in
690 -- dependency checking, but must be present for proper interpretation
691 -- of the cross-reference data.
692
693 --------------------------
694 -- Cross-Reference Data --
695 --------------------------
696
697 -- The cross-reference data follows the dependency lines. See the spec of
698 -- Lib.Xref for details on the format of this data.
699
700 ---------------------------------
701 -- Source Coverage Obligations --
702 ---------------------------------
703
704 -- The Source Coverage Obligation (SCO) information follows the cross-
705 -- reference data. See the spec of Par_SCO for full details of the format.
706
707 ----------------------
708 -- Global Variables --
709 ----------------------
710
711 -- The table defined here stores one entry for each Interrupt_State pragma
712 -- encountered either in the main source or in an ancillary with'ed source.
713 -- Since interrupt state values have to be consistent across all units in a
714 -- partition, we detect inconsistencies at compile time when we can.
715
716 type Interrupt_State_Entry is record
717 Interrupt_Number : Pos;
718 -- Interrupt number value
719
720 Interrupt_State : Character;
721 -- Set to r/s/u for Runtime/System/User
722
723 Pragma_Loc : Source_Ptr;
724 -- Location of pragma setting this value in place
725 end record;
726
727 package Interrupt_States is new Table.Table (
728 Table_Component_Type => Interrupt_State_Entry,
729 Table_Index_Type => Nat,
730 Table_Low_Bound => 1,
731 Table_Initial => 30,
732 Table_Increment => 200,
733 Table_Name => "Name_Interrupt_States");
734
735 -- The table structure defined here stores one entry for each
736 -- Priority_Specific_Dispatching pragma encountered either in the main
737 -- source or in an ancillary with'ed source. Since have to be consistent
738 -- across all units in a partition, we may as well detect inconsistencies
739 -- at compile time when we can.
740
741 type Specific_Dispatching_Entry is record
742 Dispatching_Policy : Character;
743 -- First character (upper case) of the corresponding policy name
744
745 First_Priority : Nat;
746 -- Lower bound of the priority range to which the specified dispatching
747 -- policy applies.
748
749 Last_Priority : Nat;
750 -- Upper bound of the priority range to which the specified dispatching
751 -- policy applies.
752
753 Pragma_Loc : Source_Ptr;
754 -- Location of pragma setting this value in place
755 end record;
756
757 package Specific_Dispatching is new Table.Table (
758 Table_Component_Type => Specific_Dispatching_Entry,
759 Table_Index_Type => Nat,
760 Table_Low_Bound => 1,
761 Table_Initial => 10,
762 Table_Increment => 100,
763 Table_Name => "Name_Priority_Specific_Dispatching");
764
765 -----------------
766 -- Subprograms --
767 -----------------
768
769 procedure Ensure_System_Dependency;
770 -- This procedure ensures that a dependency is created on system.ads. Even
771 -- if there is no semantic dependency, Targparm has read the file to
772 -- acquire target parameters, so we need a source dependency.
773
774 procedure Write_ALI (Object : Boolean);
775 -- This procedure writes the library information for the current main unit
776 -- The Object parameter is true if an object file is created, and false
777 -- otherwise.
778 --
779 -- Note: in the case where we are not generating code (-gnatc mode), this
780 -- routine only writes an ALI file if it cannot find an existing up to
781 -- date ALI file. If it *can* find an existing up to date ALI file, then
782 -- it reads this file and sets the Lib.Compilation_Arguments table from
783 -- the A lines in this file.
784
785 procedure Add_Preprocessing_Dependency (S : Source_File_Index);
786 -- Indicate that there is a dependency to be added on a preprocessing data
787 -- file or on a preprocessing definition file.
788
789 end Lib.Writ;