Daily bump.
[official-gcc.git] / gcc / ada / lib.adb
blobd48dd5b5c4bc7a0a856cf58c222e94b329ec8398
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- L I B --
6 -- --
7 -- B o d y --
8 -- --
9 -- $Revision: 1.2 $
10 -- --
11 -- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
12 -- --
13 -- GNAT is free software; you can redistribute it and/or modify it under --
14 -- terms of the GNU General Public License as published by the Free Soft- --
15 -- ware Foundation; either version 2, or (at your option) any later ver- --
16 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
19 -- for more details. You should have received a copy of the GNU General --
20 -- Public License distributed with GNAT; see file COPYING. If not, write --
21 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
22 -- MA 02111-1307, USA. --
23 -- --
24 -- As a special exception, if other files instantiate generics from this --
25 -- unit, or you link this unit with other files to produce an executable, --
26 -- this unit does not by itself cause the resulting executable to be --
27 -- covered by the GNU General Public License. This exception does not --
28 -- however invalidate any other reasons why the executable file might be --
29 -- covered by the GNU Public License. --
30 -- --
31 -- GNAT was originally developed by the GNAT team at New York University. --
32 -- Extensive contributions were provided by Ada Core Technologies Inc. --
33 -- --
34 ------------------------------------------------------------------------------
36 pragma Style_Checks (All_Checks);
37 -- Subprogram ordering not enforced in this unit
38 -- (because of some logical groupings).
40 with Atree; use Atree;
41 with Einfo; use Einfo;
42 with Fname; use Fname;
43 with Namet; use Namet;
44 with Namet; use Namet;
45 with Output; use Output;
46 with Sinfo; use Sinfo;
47 with Sinput; use Sinput;
48 with Stand; use Stand;
49 with Stringt; use Stringt;
50 with Tree_IO; use Tree_IO;
51 with Uname; use Uname;
53 package body Lib is
55 -----------------------
56 -- Local Subprograms --
57 -----------------------
59 type SEU_Result is (
60 Yes_Before, -- S1 is in same extended unit as S2 and appears before it
61 Yes_Same, -- S1 is in same extended unit as S2, Slocs are the same
62 Yes_After, -- S1 is in same extended unit as S2, and appears after it
63 No); -- S2 is not in same extended unit as S2
65 function Check_Same_Extended_Unit (S1, S2 : Source_Ptr) return SEU_Result;
66 -- Used by In_Same_Extended_Unit and Earlier_In_Extended_Unit. Returns
67 -- value as described above.
69 --------------------------------------------
70 -- Access Functions for Unit Table Fields --
71 --------------------------------------------
73 function Cunit (U : Unit_Number_Type) return Node_Id is
74 begin
75 return Units.Table (U).Cunit;
76 end Cunit;
78 function Cunit_Entity (U : Unit_Number_Type) return Entity_Id is
79 begin
80 return Units.Table (U).Cunit_Entity;
81 end Cunit_Entity;
83 function Dependency_Num (U : Unit_Number_Type) return Nat is
84 begin
85 return Units.Table (U).Dependency_Num;
86 end Dependency_Num;
88 function Dependent_Unit (U : Unit_Number_Type) return Boolean is
89 begin
90 return Units.Table (U).Dependent_Unit;
91 end Dependent_Unit;
93 function Dynamic_Elab (U : Unit_Number_Type) return Boolean is
94 begin
95 return Units.Table (U).Dynamic_Elab;
96 end Dynamic_Elab;
98 function Error_Location (U : Unit_Number_Type) return Source_Ptr is
99 begin
100 return Units.Table (U).Error_Location;
101 end Error_Location;
103 function Expected_Unit (U : Unit_Number_Type) return Unit_Name_Type is
104 begin
105 return Units.Table (U).Expected_Unit;
106 end Expected_Unit;
108 function Fatal_Error (U : Unit_Number_Type) return Boolean is
109 begin
110 return Units.Table (U).Fatal_Error;
111 end Fatal_Error;
113 function Generate_Code (U : Unit_Number_Type) return Boolean is
114 begin
115 return Units.Table (U).Generate_Code;
116 end Generate_Code;
118 function Has_RACW (U : Unit_Number_Type) return Boolean is
119 begin
120 return Units.Table (U).Has_RACW;
121 end Has_RACW;
123 function Ident_String (U : Unit_Number_Type) return Node_Id is
124 begin
125 return Units.Table (U).Ident_String;
126 end Ident_String;
128 function Loading (U : Unit_Number_Type) return Boolean is
129 begin
130 return Units.Table (U).Loading;
131 end Loading;
133 function Main_Priority (U : Unit_Number_Type) return Int is
134 begin
135 return Units.Table (U).Main_Priority;
136 end Main_Priority;
138 function Source_Index (U : Unit_Number_Type) return Source_File_Index is
139 begin
140 return Units.Table (U).Source_Index;
141 end Source_Index;
143 function Unit_File_Name (U : Unit_Number_Type) return File_Name_Type is
144 begin
145 return Units.Table (U).Unit_File_Name;
146 end Unit_File_Name;
148 function Unit_Name (U : Unit_Number_Type) return Unit_Name_Type is
149 begin
150 return Units.Table (U).Unit_Name;
151 end Unit_Name;
153 ------------------------------------------
154 -- Subprograms to Set Unit Table Fields --
155 ------------------------------------------
157 procedure Set_Cunit (U : Unit_Number_Type; N : Node_Id) is
158 begin
159 Units.Table (U).Cunit := N;
160 end Set_Cunit;
162 procedure Set_Cunit_Entity (U : Unit_Number_Type; E : Entity_Id) is
163 begin
164 Units.Table (U).Cunit_Entity := E;
165 Set_Is_Compilation_Unit (E);
166 end Set_Cunit_Entity;
168 procedure Set_Dynamic_Elab (U : Unit_Number_Type; B : Boolean := True) is
169 begin
170 Units.Table (U).Dynamic_Elab := B;
171 end Set_Dynamic_Elab;
173 procedure Set_Error_Location (U : Unit_Number_Type; W : Source_Ptr) is
174 begin
175 Units.Table (U).Error_Location := W;
176 end Set_Error_Location;
178 procedure Set_Fatal_Error (U : Unit_Number_Type; B : Boolean := True) is
179 begin
180 Units.Table (U).Fatal_Error := True;
181 end Set_Fatal_Error;
183 procedure Set_Generate_Code (U : Unit_Number_Type; B : Boolean := True) is
184 begin
185 Units.Table (U).Generate_Code := B;
186 end Set_Generate_Code;
188 procedure Set_Has_RACW (U : Unit_Number_Type; B : Boolean := True) is
189 begin
190 Units.Table (U).Has_RACW := B;
191 end Set_Has_RACW;
193 procedure Set_Ident_String (U : Unit_Number_Type; N : Node_Id) is
194 begin
195 Units.Table (U).Ident_String := N;
196 end Set_Ident_String;
198 procedure Set_Loading (U : Unit_Number_Type; B : Boolean := True) is
199 begin
200 Units.Table (U).Loading := B;
201 end Set_Loading;
203 procedure Set_Main_Priority (U : Unit_Number_Type; P : Int) is
204 begin
205 Units.Table (U).Main_Priority := P;
206 end Set_Main_Priority;
208 procedure Set_Unit_Name (U : Unit_Number_Type; N : Unit_Name_Type) is
209 begin
210 Units.Table (U).Unit_Name := N;
211 end Set_Unit_Name;
213 ------------------------------
214 -- Check_Same_Extended_Unit --
215 ------------------------------
217 function Check_Same_Extended_Unit (S1, S2 : Source_Ptr) return SEU_Result is
218 Sloc1 : Source_Ptr;
219 Sloc2 : Source_Ptr;
220 Sind1 : Source_File_Index;
221 Sind2 : Source_File_Index;
222 Inst1 : Source_Ptr;
223 Inst2 : Source_Ptr;
224 Unum1 : Unit_Number_Type;
225 Unum2 : Unit_Number_Type;
226 Unit1 : Node_Id;
227 Unit2 : Node_Id;
228 Depth1 : Nat;
229 Depth2 : Nat;
231 begin
232 if S1 = No_Location or else S2 = No_Location then
233 return No;
235 elsif S1 = Standard_Location then
236 if S2 = Standard_Location then
237 return Yes_Same;
238 else
239 return No;
240 end if;
242 elsif S2 = Standard_Location then
243 return No;
244 end if;
246 Sloc1 := S1;
247 Sloc2 := S2;
248 Unum1 := Get_Code_Unit (Sloc1);
249 Unum2 := Get_Code_Unit (Sloc2);
251 loop
252 Sind1 := Get_Source_File_Index (Sloc1);
253 Sind2 := Get_Source_File_Index (Sloc2);
255 if Sind1 = Sind2 then
256 if Sloc1 < Sloc2 then
257 return Yes_Before;
258 elsif Sloc1 > Sloc2 then
259 return Yes_After;
260 else
261 return Yes_Same;
262 end if;
263 end if;
265 -- OK, the two nodes are in separate source elements, but this is not
266 -- decisive, because of the issue of subunits and instantiations.
268 -- First we deal with subunits, since if the subunit is in an
269 -- instantiation, we know that the parent is in the corresponding
270 -- instantiation, since that is the only way we can have a subunit
271 -- that is part of an instantiation.
273 Unit1 := Unit (Cunit (Unum1));
274 Unit2 := Unit (Cunit (Unum2));
276 if Nkind (Unit1) = N_Subunit
277 and then Present (Corresponding_Stub (Unit1))
278 then
279 -- Both in subunits. They could have a common ancestor. If they
280 -- do, then the deeper one must have a longer unit name. Replace
281 -- the deeper one with its corresponding stub, in order to find
282 -- nearest common ancestor, if any.
284 if Nkind (Unit2) = N_Subunit
285 and then Present (Corresponding_Stub (Unit2))
286 then
287 if Length_Of_Name (Unit_Name (Unum1)) <
288 Length_Of_Name (Unit_Name (Unum2))
289 then
290 Sloc2 := Sloc (Corresponding_Stub (Unit2));
291 Unum2 := Get_Source_Unit (Sloc2);
292 goto Continue;
294 else
295 Sloc1 := Sloc (Corresponding_Stub (Unit1));
296 Unum1 := Get_Source_Unit (Sloc1);
297 goto Continue;
298 end if;
300 -- Nod1 in subunit, Nod2 not
302 else
303 Sloc1 := Sloc (Corresponding_Stub (Unit1));
304 Unum1 := Get_Source_Unit (Sloc1);
305 goto Continue;
306 end if;
308 -- Nod2 in subunit, Nod1 not
310 elsif Nkind (Unit2) = N_Subunit
311 and then Present (Corresponding_Stub (Unit2))
312 then
313 Sloc2 := Sloc (Corresponding_Stub (Unit2));
314 Unum2 := Get_Source_Unit (Sloc2);
315 goto Continue;
316 end if;
318 -- At this stage we know that neither is a subunit, so we deal
319 -- with instantiations, since we culd have a common ancestor
321 Inst1 := Instantiation (Sind1);
322 Inst2 := Instantiation (Sind2);
324 if Inst1 /= No_Location then
326 -- Both are instantiations
328 if Inst2 /= No_Location then
330 Depth1 := Instantiation_Depth (Sloc1);
331 Depth2 := Instantiation_Depth (Sloc2);
333 if Depth1 < Depth2 then
334 Sloc2 := Inst2;
335 Unum2 := Get_Source_Unit (Sloc2);
336 goto Continue;
338 elsif Depth1 > Depth2 then
339 Sloc1 := Inst1;
340 Unum1 := Get_Source_Unit (Sloc1);
341 goto Continue;
343 else
344 Sloc1 := Inst1;
345 Sloc2 := Inst2;
346 Unum1 := Get_Source_Unit (Sloc1);
347 Unum2 := Get_Source_Unit (Sloc2);
348 goto Continue;
349 end if;
351 -- Only first node is in instantiation
353 else
354 Sloc1 := Inst1;
355 Unum1 := Get_Source_Unit (Sloc1);
356 goto Continue;
357 end if;
359 -- Only second node is instantiation
361 elsif Inst2 /= No_Location then
362 Sloc2 := Inst2;
363 Unum2 := Get_Source_Unit (Sloc2);
364 goto Continue;
365 end if;
367 -- No instantiations involved, so we are not in the same unit
368 -- However, there is one case still to check, namely the case
369 -- where one location is in the spec, and the other in the
370 -- corresponding body (the spec location is earlier).
372 if Nkind (Unit1) = N_Subprogram_Body
373 or else
374 Nkind (Unit1) = N_Package_Body
375 then
376 if Library_Unit (Cunit (Unum1)) = Cunit (Unum2) then
377 return Yes_After;
378 end if;
380 elsif Nkind (Unit2) = N_Subprogram_Body
381 or else
382 Nkind (Unit2) = N_Package_Body
383 then
384 if Library_Unit (Cunit (Unum2)) = Cunit (Unum1) then
385 return Yes_Before;
386 end if;
387 end if;
389 -- If that special case does not occur, then we are certain that
390 -- the two locations are really in separate units.
392 return No;
394 <<Continue>>
395 null;
396 end loop;
398 end Check_Same_Extended_Unit;
400 ------------------------------
401 -- Earlier_In_Extended_Unit --
402 ------------------------------
404 function Earlier_In_Extended_Unit (S1, S2 : Source_Ptr) return Boolean is
405 begin
406 return Check_Same_Extended_Unit (S1, S2) = Yes_Before;
407 end Earlier_In_Extended_Unit;
409 ----------------------------
410 -- Entity_Is_In_Main_Unit --
411 ----------------------------
413 function Entity_Is_In_Main_Unit (E : Entity_Id) return Boolean is
414 S : Entity_Id;
416 begin
417 S := Scope (E);
419 while S /= Standard_Standard loop
420 if S = Main_Unit_Entity then
421 return True;
422 elsif Ekind (S) = E_Package and then Is_Child_Unit (S) then
423 return False;
424 else
425 S := Scope (S);
426 end if;
427 end loop;
429 return False;
430 end Entity_Is_In_Main_Unit;
432 ---------------------------------
433 -- Generic_Separately_Compiled --
434 ---------------------------------
436 function Generic_Separately_Compiled (E : Entity_Id) return Boolean is
437 begin
438 -- We do not generate object files for internal generics, because
439 -- the only thing they would contain is the elaboration boolean, and
440 -- we are careful to elaborate all predefined units first anyway, so
441 -- this boolean is not needed.
443 if Is_Internal_File_Name
444 (Fname => Unit_File_Name (Get_Source_Unit (E)),
445 Renamings_Included => True)
446 then
447 return False;
449 -- All other generic units do generate object files
451 else
452 return True;
453 end if;
454 end Generic_Separately_Compiled;
456 -------------------
457 -- Get_Code_Unit --
458 -------------------
460 function Get_Code_Unit (S : Source_Ptr) return Unit_Number_Type is
461 Source_File : Source_File_Index :=
462 Get_Source_File_Index (Top_Level_Location (S));
464 begin
465 for U in Units.First .. Units.Last loop
466 if Source_Index (U) = Source_File then
467 return U;
468 end if;
469 end loop;
471 -- If not in the table, must be the main source unit, and we just
472 -- have not got it put into the table yet.
474 return Main_Unit;
475 end Get_Code_Unit;
477 function Get_Code_Unit (N : Node_Id) return Unit_Number_Type is
478 begin
479 return Get_Code_Unit (Sloc (N));
480 end Get_Code_Unit;
482 ----------------------------
483 -- Get_Compilation_Switch --
484 ----------------------------
486 function Get_Compilation_Switch (N : Pos) return String_Ptr is
487 begin
488 if N >= Compilation_Switches.Last then
489 return Compilation_Switches.Table (N);
491 else
492 return null;
493 end if;
494 end Get_Compilation_Switch;
496 ----------------------------------
497 -- Get_Cunit_Entity_Unit_Number --
498 ----------------------------------
500 function Get_Cunit_Entity_Unit_Number
501 (E : Entity_Id)
502 return Unit_Number_Type
504 begin
505 for U in Units.First .. Units.Last loop
506 if Cunit_Entity (U) = E then
507 return U;
508 end if;
509 end loop;
511 -- If not in the table, must be the main source unit, and we just
512 -- have not got it put into the table yet.
514 return Main_Unit;
515 end Get_Cunit_Entity_Unit_Number;
517 ---------------------------
518 -- Get_Cunit_Unit_Number --
519 ---------------------------
521 function Get_Cunit_Unit_Number (N : Node_Id) return Unit_Number_Type is
522 begin
523 for U in Units.First .. Units.Last loop
524 if Cunit (U) = N then
525 return U;
526 end if;
527 end loop;
529 -- If not in the table, must be the main source unit, and we just
530 -- have not got it put into the table yet.
532 return Main_Unit;
533 end Get_Cunit_Unit_Number;
535 ---------------------
536 -- Get_Source_Unit --
537 ---------------------
539 function Get_Source_Unit (S : Source_Ptr) return Unit_Number_Type is
540 Source_File : Source_File_Index :=
541 Get_Source_File_Index (Top_Level_Location (S));
543 begin
544 Source_File := Get_Source_File_Index (S);
545 while Template (Source_File) /= No_Source_File loop
546 Source_File := Template (Source_File);
547 end loop;
549 for U in Units.First .. Units.Last loop
550 if Source_Index (U) = Source_File then
551 return U;
552 end if;
553 end loop;
555 -- If not in the table, must be the main source unit, and we just
556 -- have not got it put into the table yet.
558 return Main_Unit;
559 end Get_Source_Unit;
561 function Get_Source_Unit (N : Node_Id) return Unit_Number_Type is
562 begin
563 return Get_Source_Unit (Sloc (N));
564 end Get_Source_Unit;
566 --------------------------------
567 -- In_Extended_Main_Code_Unit --
568 --------------------------------
570 function In_Extended_Main_Code_Unit (N : Node_Id) return Boolean is
571 begin
572 if Sloc (N) = Standard_Location then
573 return True;
575 elsif Sloc (N) = No_Location then
576 return False;
578 -- Special case Itypes to test the Sloc of the associated node. The
579 -- reason we do this is for possible calls from gigi after -gnatD
580 -- processing is complete in sprint. This processing updates the
581 -- sloc fields of all nodes in the tree, but itypes are not in the
582 -- tree so their slocs do not get updated.
584 elsif Nkind (N) = N_Defining_Identifier
585 and then Is_Itype (N)
586 then
587 return In_Extended_Main_Code_Unit (Associated_Node_For_Itype (N));
589 elsif Get_Code_Unit (Sloc (N)) = Get_Code_Unit (Cunit (Main_Unit)) then
590 return True;
592 else -- node may be in spec of main unit
593 return
594 In_Same_Extended_Unit (Sloc (N), Sloc (Cunit (Main_Unit)));
595 end if;
596 end In_Extended_Main_Code_Unit;
598 ----------------------------------
599 -- In_Extended_Main_Source_Unit --
600 ----------------------------------
602 function In_Extended_Main_Source_Unit (N : Node_Id) return Boolean is
603 begin
604 if Sloc (N) = Standard_Location then
605 return True;
607 elsif Sloc (N) = No_Location then
608 return False;
610 -- Special case Itypes to test the Sloc of the associated node. The
611 -- reason we do this is for possible calls from gigi after -gnatD
612 -- processing is complete in sprint. This processing updates the
613 -- sloc fields of all nodes in the tree, but itypes are not in the
614 -- tree so their slocs do not get updated.
616 elsif Nkind (N) = N_Defining_Identifier
617 and then Is_Itype (N)
618 then
619 return In_Extended_Main_Source_Unit (Associated_Node_For_Itype (N));
621 else
622 return
623 In_Same_Extended_Unit
624 (Original_Location (Sloc (N)),
625 Original_Location (Sloc (Cunit (Main_Unit))));
626 end if;
627 end In_Extended_Main_Source_Unit;
629 -----------------------
630 -- In_Same_Code_Unit --
631 -----------------------
633 function In_Same_Code_Unit (N1, N2 : Node_Or_Entity_Id) return Boolean is
634 S1 : constant Source_Ptr := Sloc (N1);
635 S2 : constant Source_Ptr := Sloc (N2);
637 begin
638 if S1 = No_Location or else S2 = No_Location then
639 return False;
641 elsif S1 = Standard_Location then
642 return S2 = Standard_Location;
644 elsif S2 = Standard_Location then
645 return False;
646 end if;
648 return Get_Code_Unit (N1) = Get_Code_Unit (N2);
649 end In_Same_Code_Unit;
651 ---------------------------
652 -- In_Same_Extended_Unit --
653 ---------------------------
655 function In_Same_Extended_Unit (S1, S2 : Source_Ptr) return Boolean is
656 begin
657 return Check_Same_Extended_Unit (S1, S2) /= No;
658 end In_Same_Extended_Unit;
660 -------------------------
661 -- In_Same_Source_Unit --
662 -------------------------
664 function In_Same_Source_Unit (N1, N2 : Node_Or_Entity_Id) return Boolean is
665 S1 : constant Source_Ptr := Sloc (N1);
666 S2 : constant Source_Ptr := Sloc (N2);
668 begin
669 if S1 = No_Location or else S2 = No_Location then
670 return False;
672 elsif S1 = Standard_Location then
673 return S2 = Standard_Location;
675 elsif S2 = Standard_Location then
676 return False;
677 end if;
679 return Get_Source_Unit (N1) = Get_Source_Unit (N2);
680 end In_Same_Source_Unit;
682 -----------------------------
683 -- Increment_Serial_Number --
684 -----------------------------
686 function Increment_Serial_Number return Nat is
687 TSN : Int renames Units.Table (Current_Sem_Unit).Serial_Number;
689 begin
690 TSN := TSN + 1;
691 return TSN;
692 end Increment_Serial_Number;
694 ----------------
695 -- Initialize --
696 ----------------
698 procedure Initialize is
699 begin
700 Linker_Option_Lines.Init;
701 Load_Stack.Init;
702 Units.Init;
703 Unit_Exception_Table_Present := False;
704 Compilation_Switches.Init;
705 end Initialize;
707 ---------------
708 -- Is_Loaded --
709 ---------------
711 function Is_Loaded (Uname : Unit_Name_Type) return Boolean is
712 begin
713 for Unum in Units.First .. Units.Last loop
714 if Uname = Unit_Name (Unum) then
715 return True;
716 end if;
717 end loop;
719 return False;
720 end Is_Loaded;
722 ---------------
723 -- Last_Unit --
724 ---------------
726 function Last_Unit return Unit_Number_Type is
727 begin
728 return Units.Last;
729 end Last_Unit;
731 ----------
732 -- List --
733 ----------
735 procedure List (File_Names_Only : Boolean := False) is separate;
737 ----------
738 -- Lock --
739 ----------
741 procedure Lock is
742 begin
743 Linker_Option_Lines.Locked := True;
744 Load_Stack.Locked := True;
745 Units.Locked := True;
746 Linker_Option_Lines.Release;
747 Load_Stack.Release;
748 Units.Release;
749 end Lock;
751 ---------------
752 -- Num_Units --
753 ---------------
755 function Num_Units return Nat is
756 begin
757 return Int (Units.Last) - Int (Main_Unit) + 1;
758 end Num_Units;
760 ----------------------------------
761 -- Replace_Linker_Option_String --
762 ----------------------------------
764 procedure Replace_Linker_Option_String
765 (S : String_Id; Match_String : String)
767 begin
768 if Match_String'Length > 0 then
769 for J in 1 .. Linker_Option_Lines.Last loop
770 String_To_Name_Buffer (Linker_Option_Lines.Table (J));
772 if Match_String = Name_Buffer (1 .. Match_String'Length) then
773 Linker_Option_Lines.Table (J) := S;
774 return;
775 end if;
776 end loop;
777 end if;
779 Store_Linker_Option_String (S);
780 end Replace_Linker_Option_String;
782 ----------
783 -- Sort --
784 ----------
786 procedure Sort (Tbl : in out Unit_Ref_Table) is separate;
788 ------------------------------
789 -- Store_Compilation_Switch --
790 ------------------------------
792 procedure Store_Compilation_Switch (Switch : String) is
793 begin
794 Compilation_Switches.Increment_Last;
795 Compilation_Switches.Table (Compilation_Switches.Last) :=
796 new String'(Switch);
797 end Store_Compilation_Switch;
799 --------------------------------
800 -- Store_Linker_Option_String --
801 --------------------------------
803 procedure Store_Linker_Option_String (S : String_Id) is
804 begin
805 Linker_Option_Lines.Increment_Last;
806 Linker_Option_Lines.Table (Linker_Option_Lines.Last) := S;
807 end Store_Linker_Option_String;
809 ---------------
810 -- Tree_Read --
811 ---------------
813 procedure Tree_Read is
814 N : Nat;
815 S : String_Ptr;
817 begin
818 Units.Tree_Read;
820 -- Read Compilation_Switches table
822 Tree_Read_Int (N);
823 Compilation_Switches.Set_Last (N);
825 for J in 1 .. N loop
826 Tree_Read_Str (S);
827 Compilation_Switches.Table (J) := S;
828 end loop;
829 end Tree_Read;
831 ----------------
832 -- Tree_Write --
833 ----------------
835 procedure Tree_Write is
836 begin
837 Units.Tree_Write;
839 -- Write Compilation_Switches table
841 Tree_Write_Int (Compilation_Switches.Last);
843 for J in 1 .. Compilation_Switches.Last loop
844 Tree_Write_Str (Compilation_Switches.Table (J));
845 end loop;
846 end Tree_Write;
848 -----------------
849 -- Version_Get --
850 -----------------
852 function Version_Get (U : Unit_Number_Type) return Word_Hex_String is
853 begin
854 return Get_Hex_String (Units.Table (U).Version);
855 end Version_Get;
857 ------------------------
858 -- Version_Referenced --
859 ------------------------
861 procedure Version_Referenced (S : String_Id) is
862 begin
863 Version_Ref.Append (S);
864 end Version_Referenced;
866 end Lib;