OSDN Git Service

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