1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
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. --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
30 ------------------------------------------------------------------------------
32 pragma Style_Checks (All_Checks);
33 -- Subprogram ordering not enforced in this unit
34 -- (because of some logical groupings).
36 with Atree; use Atree;
37 with Einfo; use Einfo;
38 with Fname; use Fname;
39 with Output; use Output;
40 with Sinfo; use Sinfo;
41 with Sinput; use Sinput;
42 with Stand; use Stand;
43 with Stringt; use Stringt;
44 with Tree_IO; use Tree_IO;
45 with Uname; use Uname;
49 Switch_Storing_Enabled : Boolean := True;
50 -- Controlled by Enable_Switch_Storing/Disable_Switch_Storing
52 -----------------------
53 -- Local Subprograms --
54 -----------------------
57 Yes_Before, -- S1 is in same extended unit as S2 and appears before it
58 Yes_Same, -- S1 is in same extended unit as S2, Slocs are the same
59 Yes_After, -- S1 is in same extended unit as S2, and appears after it
60 No); -- S2 is not in same extended unit as S2
62 function Check_Same_Extended_Unit (S1, S2 : Source_Ptr) return SEU_Result;
63 -- Used by In_Same_Extended_Unit and Earlier_In_Extended_Unit. Returns
64 -- value as described above.
66 function Get_Code_Or_Source_Unit
68 Unwind_Instances : Boolean) return Unit_Number_Type;
69 -- Common code for Get_Code_Unit (get unit of instantiation for location)
70 -- and Get_Source_Unit (get unit of template for location).
72 --------------------------------------------
73 -- Access Functions for Unit Table Fields --
74 --------------------------------------------
76 function Cunit (U : Unit_Number_Type) return Node_Id is
78 return Units.Table (U).Cunit;
81 function Cunit_Entity (U : Unit_Number_Type) return Entity_Id is
83 return Units.Table (U).Cunit_Entity;
86 function Dependency_Num (U : Unit_Number_Type) return Nat is
88 return Units.Table (U).Dependency_Num;
91 function Dynamic_Elab (U : Unit_Number_Type) return Boolean is
93 return Units.Table (U).Dynamic_Elab;
96 function Error_Location (U : Unit_Number_Type) return Source_Ptr is
98 return Units.Table (U).Error_Location;
101 function Expected_Unit (U : Unit_Number_Type) return Unit_Name_Type is
103 return Units.Table (U).Expected_Unit;
106 function Fatal_Error (U : Unit_Number_Type) return Boolean is
108 return Units.Table (U).Fatal_Error;
111 function Generate_Code (U : Unit_Number_Type) return Boolean is
113 return Units.Table (U).Generate_Code;
116 function Has_RACW (U : Unit_Number_Type) return Boolean is
118 return Units.Table (U).Has_RACW;
121 function Is_Compiler_Unit (U : Unit_Number_Type) return Boolean is
123 return Units.Table (U).Is_Compiler_Unit;
124 end Is_Compiler_Unit;
126 function Ident_String (U : Unit_Number_Type) return Node_Id is
128 return Units.Table (U).Ident_String;
131 function Loading (U : Unit_Number_Type) return Boolean is
133 return Units.Table (U).Loading;
136 function Main_Priority (U : Unit_Number_Type) return Int is
138 return Units.Table (U).Main_Priority;
141 function Munit_Index (U : Unit_Number_Type) return Nat is
143 return Units.Table (U).Munit_Index;
146 function OA_Setting (U : Unit_Number_Type) return Character is
148 return Units.Table (U).OA_Setting;
151 function Source_Index (U : Unit_Number_Type) return Source_File_Index is
153 return Units.Table (U).Source_Index;
156 function Unit_File_Name (U : Unit_Number_Type) return File_Name_Type is
158 return Units.Table (U).Unit_File_Name;
161 function Unit_Name (U : Unit_Number_Type) return Unit_Name_Type is
163 return Units.Table (U).Unit_Name;
166 ------------------------------------------
167 -- Subprograms to Set Unit Table Fields --
168 ------------------------------------------
170 procedure Set_Cunit (U : Unit_Number_Type; N : Node_Id) is
172 Units.Table (U).Cunit := N;
175 procedure Set_Cunit_Entity (U : Unit_Number_Type; E : Entity_Id) is
177 Units.Table (U).Cunit_Entity := E;
178 Set_Is_Compilation_Unit (E);
179 end Set_Cunit_Entity;
181 procedure Set_Dynamic_Elab (U : Unit_Number_Type; B : Boolean := True) is
183 Units.Table (U).Dynamic_Elab := B;
184 end Set_Dynamic_Elab;
186 procedure Set_Error_Location (U : Unit_Number_Type; W : Source_Ptr) is
188 Units.Table (U).Error_Location := W;
189 end Set_Error_Location;
191 procedure Set_Fatal_Error (U : Unit_Number_Type; B : Boolean := True) is
193 Units.Table (U).Fatal_Error := B;
196 procedure Set_Generate_Code (U : Unit_Number_Type; B : Boolean := True) is
198 Units.Table (U).Generate_Code := B;
199 end Set_Generate_Code;
201 procedure Set_Has_RACW (U : Unit_Number_Type; B : Boolean := True) is
203 Units.Table (U).Has_RACW := B;
206 procedure Set_Is_Compiler_Unit
207 (U : Unit_Number_Type;
211 Units.Table (U).Is_Compiler_Unit := B;
212 end Set_Is_Compiler_Unit;
214 procedure Set_Ident_String (U : Unit_Number_Type; N : Node_Id) is
216 Units.Table (U).Ident_String := N;
217 end Set_Ident_String;
219 procedure Set_Loading (U : Unit_Number_Type; B : Boolean := True) is
221 Units.Table (U).Loading := B;
224 procedure Set_Main_Priority (U : Unit_Number_Type; P : Int) is
226 Units.Table (U).Main_Priority := P;
227 end Set_Main_Priority;
229 procedure Set_OA_Setting (U : Unit_Number_Type; C : Character) is
231 Units.Table (U).OA_Setting := C;
234 procedure Set_Unit_Name (U : Unit_Number_Type; N : Unit_Name_Type) is
236 Units.Table (U).Unit_Name := N;
239 ------------------------------
240 -- Check_Same_Extended_Unit --
241 ------------------------------
243 function Check_Same_Extended_Unit (S1, S2 : Source_Ptr) return SEU_Result is
246 Sind1 : Source_File_Index;
247 Sind2 : Source_File_Index;
250 Unum1 : Unit_Number_Type;
251 Unum2 : Unit_Number_Type;
258 if S1 = No_Location or else S2 = No_Location then
261 elsif S1 = Standard_Location then
262 if S2 = Standard_Location then
268 elsif S2 = Standard_Location then
274 Unum1 := Get_Code_Unit (Sloc1);
275 Unum2 := Get_Code_Unit (Sloc2);
278 Sind1 := Get_Source_File_Index (Sloc1);
279 Sind2 := Get_Source_File_Index (Sloc2);
281 if Sind1 = Sind2 then
282 if Sloc1 < Sloc2 then
284 elsif Sloc1 > Sloc2 then
291 -- OK, the two nodes are in separate source elements, but this is not
292 -- decisive, because of the issue of subunits and instantiations.
294 -- First we deal with subunits, since if the subunit is in an
295 -- instantiation, we know that the parent is in the corresponding
296 -- instantiation, since that is the only way we can have a subunit
297 -- that is part of an instantiation.
299 Unit1 := Unit (Cunit (Unum1));
300 Unit2 := Unit (Cunit (Unum2));
302 if Nkind (Unit1) = N_Subunit
303 and then Present (Corresponding_Stub (Unit1))
305 -- Both in subunits. They could have a common ancestor. If they
306 -- do, then the deeper one must have a longer unit name. Replace
307 -- the deeper one with its corresponding stub, in order to find
308 -- nearest common ancestor, if any.
310 if Nkind (Unit2) = N_Subunit
311 and then Present (Corresponding_Stub (Unit2))
313 if Length_Of_Name (Unit_Name (Unum1)) <
314 Length_Of_Name (Unit_Name (Unum2))
316 Sloc2 := Sloc (Corresponding_Stub (Unit2));
317 Unum2 := Get_Source_Unit (Sloc2);
321 Sloc1 := Sloc (Corresponding_Stub (Unit1));
322 Unum1 := Get_Source_Unit (Sloc1);
326 -- Nod1 in subunit, Nod2 not
329 Sloc1 := Sloc (Corresponding_Stub (Unit1));
330 Unum1 := Get_Source_Unit (Sloc1);
334 -- Nod2 in subunit, Nod1 not
336 elsif Nkind (Unit2) = N_Subunit
337 and then Present (Corresponding_Stub (Unit2))
339 Sloc2 := Sloc (Corresponding_Stub (Unit2));
340 Unum2 := Get_Source_Unit (Sloc2);
344 -- At this stage we know that neither is a subunit, so we deal
345 -- with instantiations, since we could have a common ancestor
347 Inst1 := Instantiation (Sind1);
348 Inst2 := Instantiation (Sind2);
350 if Inst1 /= No_Location then
352 -- Both are instantiations
354 if Inst2 /= No_Location then
356 Depth1 := Instantiation_Depth (Sloc1);
357 Depth2 := Instantiation_Depth (Sloc2);
359 if Depth1 < Depth2 then
361 Unum2 := Get_Source_Unit (Sloc2);
364 elsif Depth1 > Depth2 then
366 Unum1 := Get_Source_Unit (Sloc1);
372 Unum1 := Get_Source_Unit (Sloc1);
373 Unum2 := Get_Source_Unit (Sloc2);
377 -- Only first node is in instantiation
381 Unum1 := Get_Source_Unit (Sloc1);
385 -- Only second node is instantiation
387 elsif Inst2 /= No_Location then
389 Unum2 := Get_Source_Unit (Sloc2);
393 -- No instantiations involved, so we are not in the same unit
394 -- However, there is one case still to check, namely the case
395 -- where one location is in the spec, and the other in the
396 -- corresponding body (the spec location is earlier).
398 if Nkind (Unit1) = N_Subprogram_Body
400 Nkind (Unit1) = N_Package_Body
402 if Library_Unit (Cunit (Unum1)) = Cunit (Unum2) then
406 elsif Nkind (Unit2) = N_Subprogram_Body
408 Nkind (Unit2) = N_Package_Body
410 if Library_Unit (Cunit (Unum2)) = Cunit (Unum1) then
415 -- If that special case does not occur, then we are certain that
416 -- the two locations are really in separate units.
423 end Check_Same_Extended_Unit;
425 -------------------------------
426 -- Compilation_Switches_Last --
427 -------------------------------
429 function Compilation_Switches_Last return Nat is
431 return Compilation_Switches.Last;
432 end Compilation_Switches_Last;
434 ---------------------------
435 -- Enable_Switch_Storing --
436 ---------------------------
438 procedure Enable_Switch_Storing is
440 Switch_Storing_Enabled := True;
441 end Enable_Switch_Storing;
443 ----------------------------
444 -- Disable_Switch_Storing --
445 ----------------------------
447 procedure Disable_Switch_Storing is
449 Switch_Storing_Enabled := False;
450 end Disable_Switch_Storing;
452 ------------------------------
453 -- Earlier_In_Extended_Unit --
454 ------------------------------
456 function Earlier_In_Extended_Unit (S1, S2 : Source_Ptr) return Boolean is
458 return Check_Same_Extended_Unit (S1, S2) = Yes_Before;
459 end Earlier_In_Extended_Unit;
461 ----------------------------
462 -- Entity_Is_In_Main_Unit --
463 ----------------------------
465 function Entity_Is_In_Main_Unit (E : Entity_Id) return Boolean is
471 while S /= Standard_Standard loop
472 if S = Main_Unit_Entity then
474 elsif Ekind (S) = E_Package and then Is_Child_Unit (S) then
482 end Entity_Is_In_Main_Unit;
484 --------------------------
485 -- Generic_May_Lack_ALI --
486 --------------------------
488 function Generic_May_Lack_ALI (Sfile : File_Name_Type) return Boolean is
490 -- We allow internal generic units to be used without having a
491 -- corresponding ALI files to help bootstrapping with older compilers
492 -- that did not support generating ALIs for such generics. It is safe
493 -- to do so because the only thing the generated code would contain
494 -- is the elaboration boolean, and we are careful to elaborate all
495 -- predefined units first anyway.
497 return Is_Internal_File_Name
499 Renamings_Included => True);
500 end Generic_May_Lack_ALI;
502 -----------------------------
503 -- Get_Code_Or_Source_Unit --
504 -----------------------------
506 function Get_Code_Or_Source_Unit
508 Unwind_Instances : Boolean) return Unit_Number_Type
511 -- Search table unless we have No_Location, which can happen if the
512 -- relevant location has not been set yet. Happens for example when
513 -- we obtain Sloc (Cunit (Main_Unit)) before it is set.
515 if S /= No_Location then
517 Source_File : Source_File_Index;
518 Source_Unit : Unit_Number_Type;
521 Source_File := Get_Source_File_Index (S);
523 if Unwind_Instances then
524 while Template (Source_File) /= No_Source_File loop
525 Source_File := Template (Source_File);
529 Source_Unit := Unit (Source_File);
531 if Source_Unit /= No_Unit then
537 -- If S was No_Location, or was not in the table, we must be in the main
538 -- source unit (and the value has not been placed in the table yet),
539 -- or in one of the configuration pragma files.
542 end Get_Code_Or_Source_Unit;
548 function Get_Code_Unit (S : Source_Ptr) return Unit_Number_Type is
550 return Get_Code_Or_Source_Unit (Top_Level_Location (S),
551 Unwind_Instances => False);
554 function Get_Code_Unit (N : Node_Or_Entity_Id) return Unit_Number_Type is
556 return Get_Code_Unit (Sloc (N));
559 ----------------------------
560 -- Get_Compilation_Switch --
561 ----------------------------
563 function Get_Compilation_Switch (N : Pos) return String_Ptr is
565 if N <= Compilation_Switches.Last then
566 return Compilation_Switches.Table (N);
571 end Get_Compilation_Switch;
573 ----------------------------------
574 -- Get_Cunit_Entity_Unit_Number --
575 ----------------------------------
577 function Get_Cunit_Entity_Unit_Number
578 (E : Entity_Id) return Unit_Number_Type
581 for U in Units.First .. Units.Last loop
582 if Cunit_Entity (U) = E then
587 -- If not in the table, must be the main source unit, and we just
588 -- have not got it put into the table yet.
591 end Get_Cunit_Entity_Unit_Number;
593 ---------------------------
594 -- Get_Cunit_Unit_Number --
595 ---------------------------
597 function Get_Cunit_Unit_Number (N : Node_Id) return Unit_Number_Type is
599 for U in Units.First .. Units.Last loop
600 if Cunit (U) = N then
605 -- If not in the table, must be a spec created for a main unit that is a
606 -- child subprogram body which we have not inserted into the table yet.
608 if N = Library_Unit (Cunit (Main_Unit)) then
611 -- If it is anything else, something is seriously wrong, and we really
612 -- don't want to proceed, even if assertions are off, so we explicitly
613 -- raise an exception in this case to terminate compilation.
618 end Get_Cunit_Unit_Number;
620 ---------------------
621 -- Get_Source_Unit --
622 ---------------------
624 function Get_Source_Unit (S : Source_Ptr) return Unit_Number_Type is
626 return Get_Code_Or_Source_Unit (S, Unwind_Instances => True);
629 function Get_Source_Unit (N : Node_Or_Entity_Id) return Unit_Number_Type is
631 return Get_Source_Unit (Sloc (N));
634 --------------------------------
635 -- In_Extended_Main_Code_Unit --
636 --------------------------------
638 function In_Extended_Main_Code_Unit
639 (N : Node_Or_Entity_Id) return Boolean
642 if Sloc (N) = Standard_Location then
645 elsif Sloc (N) = No_Location then
648 -- Special case Itypes to test the Sloc of the associated node. The
649 -- reason we do this is for possible calls from gigi after -gnatD
650 -- processing is complete in sprint. This processing updates the
651 -- sloc fields of all nodes in the tree, but itypes are not in the
652 -- tree so their slocs do not get updated.
654 elsif Nkind (N) = N_Defining_Identifier
655 and then Is_Itype (N)
657 return In_Extended_Main_Code_Unit (Associated_Node_For_Itype (N));
659 -- Otherwise see if we are in the main unit
661 elsif Get_Code_Unit (Sloc (N)) = Get_Code_Unit (Cunit (Main_Unit)) then
664 -- Node may be in spec (or subunit etc) of main unit
668 In_Same_Extended_Unit (N, Cunit (Main_Unit));
670 end In_Extended_Main_Code_Unit;
672 function In_Extended_Main_Code_Unit (Loc : Source_Ptr) return Boolean is
674 if Loc = Standard_Location then
677 elsif Loc = No_Location then
680 -- Otherwise see if we are in the main unit
682 elsif Get_Code_Unit (Loc) = Get_Code_Unit (Cunit (Main_Unit)) then
685 -- Location may be in spec (or subunit etc) of main unit
689 In_Same_Extended_Unit (Loc, Sloc (Cunit (Main_Unit)));
691 end In_Extended_Main_Code_Unit;
693 ----------------------------------
694 -- In_Extended_Main_Source_Unit --
695 ----------------------------------
697 function In_Extended_Main_Source_Unit
698 (N : Node_Or_Entity_Id) return Boolean
700 Nloc : constant Source_Ptr := Sloc (N);
701 Mloc : constant Source_Ptr := Sloc (Cunit (Main_Unit));
704 -- If Mloc is not set, it means we are still parsing the main unit,
705 -- so everything so far is in the extended main source unit.
707 if Mloc = No_Location then
710 -- Special value cases
712 elsif Nloc = Standard_Location then
715 elsif Nloc = No_Location then
718 -- Special case Itypes to test the Sloc of the associated node. The
719 -- reason we do this is for possible calls from gigi after -gnatD
720 -- processing is complete in sprint. This processing updates the
721 -- sloc fields of all nodes in the tree, but itypes are not in the
722 -- tree so their slocs do not get updated.
724 elsif Nkind (N) = N_Defining_Identifier
725 and then Is_Itype (N)
727 return In_Extended_Main_Source_Unit (Associated_Node_For_Itype (N));
729 -- Otherwise compare original locations to see if in same unit
733 In_Same_Extended_Unit
734 (Original_Location (Nloc), Original_Location (Mloc));
736 end In_Extended_Main_Source_Unit;
738 function In_Extended_Main_Source_Unit
739 (Loc : Source_Ptr) return Boolean
741 Mloc : constant Source_Ptr := Sloc (Cunit (Main_Unit));
744 -- If Mloc is not set, it means we are still parsing the main unit,
745 -- so everything so far is in the extended main source unit.
747 if Mloc = No_Location then
750 -- Special value cases
752 elsif Loc = Standard_Location then
755 elsif Loc = No_Location then
758 -- Otherwise compare original locations to see if in same unit
762 In_Same_Extended_Unit
763 (Original_Location (Loc), Original_Location (Mloc));
765 end In_Extended_Main_Source_Unit;
767 ------------------------
768 -- In_Predefined_Unit --
769 ------------------------
771 function In_Predefined_Unit (N : Node_Or_Entity_Id) return Boolean is
773 return In_Predefined_Unit (Sloc (N));
774 end In_Predefined_Unit;
776 function In_Predefined_Unit (S : Source_Ptr) return Boolean is
777 Unit : constant Unit_Number_Type := Get_Source_Unit (S);
778 File : constant File_Name_Type := Unit_File_Name (Unit);
780 return Is_Predefined_File_Name (File);
781 end In_Predefined_Unit;
783 -----------------------
784 -- In_Same_Code_Unit --
785 -----------------------
787 function In_Same_Code_Unit (N1, N2 : Node_Or_Entity_Id) return Boolean is
788 S1 : constant Source_Ptr := Sloc (N1);
789 S2 : constant Source_Ptr := Sloc (N2);
792 if S1 = No_Location or else S2 = No_Location then
795 elsif S1 = Standard_Location then
796 return S2 = Standard_Location;
798 elsif S2 = Standard_Location then
802 return Get_Code_Unit (N1) = Get_Code_Unit (N2);
803 end In_Same_Code_Unit;
805 ---------------------------
806 -- In_Same_Extended_Unit --
807 ---------------------------
809 function In_Same_Extended_Unit
810 (N1, N2 : Node_Or_Entity_Id) return Boolean
813 return Check_Same_Extended_Unit (Sloc (N1), Sloc (N2)) /= No;
814 end In_Same_Extended_Unit;
816 function In_Same_Extended_Unit (S1, S2 : Source_Ptr) return Boolean is
818 return Check_Same_Extended_Unit (S1, S2) /= No;
819 end In_Same_Extended_Unit;
821 -------------------------
822 -- In_Same_Source_Unit --
823 -------------------------
825 function In_Same_Source_Unit (N1, N2 : Node_Or_Entity_Id) return Boolean is
826 S1 : constant Source_Ptr := Sloc (N1);
827 S2 : constant Source_Ptr := Sloc (N2);
830 if S1 = No_Location or else S2 = No_Location then
833 elsif S1 = Standard_Location then
834 return S2 = Standard_Location;
836 elsif S2 = Standard_Location then
840 return Get_Source_Unit (N1) = Get_Source_Unit (N2);
841 end In_Same_Source_Unit;
843 -----------------------------
844 -- Increment_Serial_Number --
845 -----------------------------
847 function Increment_Serial_Number return Nat is
848 TSN : Int renames Units.Table (Current_Sem_Unit).Serial_Number;
852 end Increment_Serial_Number;
858 procedure Initialize is
860 Linker_Option_Lines.Init;
863 Compilation_Switches.Init;
870 function Is_Loaded (Uname : Unit_Name_Type) return Boolean is
872 for Unum in Units.First .. Units.Last loop
873 if Uname = Unit_Name (Unum) then
885 function Last_Unit return Unit_Number_Type is
894 procedure List (File_Names_Only : Boolean := False) is separate;
902 Linker_Option_Lines.Locked := True;
903 Load_Stack.Locked := True;
904 Units.Locked := True;
905 Linker_Option_Lines.Release;
914 function Num_Units return Nat is
916 return Int (Units.Last) - Int (Main_Unit) + 1;
923 procedure Remove_Unit (U : Unit_Number_Type) is
925 if U = Units.Last then
926 Units.Decrement_Last;
930 ----------------------------------
931 -- Replace_Linker_Option_String --
932 ----------------------------------
934 procedure Replace_Linker_Option_String
935 (S : String_Id; Match_String : String)
938 if Match_String'Length > 0 then
939 for J in 1 .. Linker_Option_Lines.Last loop
940 String_To_Name_Buffer (Linker_Option_Lines.Table (J).Option);
942 if Match_String = Name_Buffer (1 .. Match_String'Length) then
943 Linker_Option_Lines.Table (J).Option := S;
949 Store_Linker_Option_String (S);
950 end Replace_Linker_Option_String;
956 procedure Sort (Tbl : in out Unit_Ref_Table) is separate;
958 ------------------------------
959 -- Store_Compilation_Switch --
960 ------------------------------
962 procedure Store_Compilation_Switch (Switch : String) is
964 if Switch_Storing_Enabled then
965 Compilation_Switches.Increment_Last;
966 Compilation_Switches.Table (Compilation_Switches.Last) :=
969 -- Fix up --RTS flag which has been transformed by the gcc driver
972 if Switch'Last >= Switch'First + 4
973 and then Switch (Switch'First .. Switch'First + 4) = "-fRTS"
975 Compilation_Switches.Table
976 (Compilation_Switches.Last) (Switch'First + 1) := '-';
979 end Store_Compilation_Switch;
981 --------------------------------
982 -- Store_Linker_Option_String --
983 --------------------------------
985 procedure Store_Linker_Option_String (S : String_Id) is
987 Linker_Option_Lines.Increment_Last;
988 Linker_Option_Lines.Table (Linker_Option_Lines.Last) :=
989 (Option => S, Unit => Current_Sem_Unit);
990 end Store_Linker_Option_String;
992 -------------------------------
993 -- Synchronize_Serial_Number --
994 -------------------------------
996 procedure Synchronize_Serial_Number is
997 TSN : Int renames Units.Table (Current_Sem_Unit).Serial_Number;
1000 end Synchronize_Serial_Number;
1006 procedure Tree_Read is
1013 -- Read Compilation_Switches table. First release the memory occupied
1014 -- by the previously loaded switches.
1016 for J in Compilation_Switches.First .. Compilation_Switches.Last loop
1017 Free (Compilation_Switches.Table (J));
1021 Compilation_Switches.Set_Last (N);
1023 for J in 1 .. N loop
1025 Compilation_Switches.Table (J) := S;
1033 procedure Tree_Write is
1037 -- Write Compilation_Switches table
1039 Tree_Write_Int (Compilation_Switches.Last);
1041 for J in 1 .. Compilation_Switches.Last loop
1042 Tree_Write_Str (Compilation_Switches.Table (J));
1052 Linker_Option_Lines.Locked := False;
1053 Load_Stack.Locked := False;
1054 Units.Locked := False;
1061 function Version_Get (U : Unit_Number_Type) return Word_Hex_String is
1063 return Get_Hex_String (Units.Table (U).Version);
1066 ------------------------
1067 -- Version_Referenced --
1068 ------------------------
1070 procedure Version_Referenced (S : String_Id) is
1072 Version_Ref.Append (S);
1073 end Version_Referenced;