1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 1992-2010, 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_Allocator (U : Unit_Number_Type) return Boolean is
118 return Units.Table (U).Has_Allocator;
121 function Has_RACW (U : Unit_Number_Type) return Boolean is
123 return Units.Table (U).Has_RACW;
126 function Is_Compiler_Unit (U : Unit_Number_Type) return Boolean is
128 return Units.Table (U).Is_Compiler_Unit;
129 end Is_Compiler_Unit;
131 function Ident_String (U : Unit_Number_Type) return Node_Id is
133 return Units.Table (U).Ident_String;
136 function Loading (U : Unit_Number_Type) return Boolean is
138 return Units.Table (U).Loading;
141 function Main_CPU (U : Unit_Number_Type) return Int is
143 return Units.Table (U).Main_CPU;
146 function Main_Priority (U : Unit_Number_Type) return Int is
148 return Units.Table (U).Main_Priority;
151 function Munit_Index (U : Unit_Number_Type) return Nat is
153 return Units.Table (U).Munit_Index;
156 function OA_Setting (U : Unit_Number_Type) return Character is
158 return Units.Table (U).OA_Setting;
161 function Source_Index (U : Unit_Number_Type) return Source_File_Index is
163 return Units.Table (U).Source_Index;
166 function Unit_File_Name (U : Unit_Number_Type) return File_Name_Type is
168 return Units.Table (U).Unit_File_Name;
171 function Unit_Name (U : Unit_Number_Type) return Unit_Name_Type is
173 return Units.Table (U).Unit_Name;
176 ------------------------------------------
177 -- Subprograms to Set Unit Table Fields --
178 ------------------------------------------
180 procedure Set_Cunit (U : Unit_Number_Type; N : Node_Id) is
182 Units.Table (U).Cunit := N;
185 procedure Set_Cunit_Entity (U : Unit_Number_Type; E : Entity_Id) is
187 Units.Table (U).Cunit_Entity := E;
188 Set_Is_Compilation_Unit (E);
189 end Set_Cunit_Entity;
191 procedure Set_Dynamic_Elab (U : Unit_Number_Type; B : Boolean := True) is
193 Units.Table (U).Dynamic_Elab := B;
194 end Set_Dynamic_Elab;
196 procedure Set_Error_Location (U : Unit_Number_Type; W : Source_Ptr) is
198 Units.Table (U).Error_Location := W;
199 end Set_Error_Location;
201 procedure Set_Fatal_Error (U : Unit_Number_Type; B : Boolean := True) is
203 Units.Table (U).Fatal_Error := B;
206 procedure Set_Generate_Code (U : Unit_Number_Type; B : Boolean := True) is
208 Units.Table (U).Generate_Code := B;
209 end Set_Generate_Code;
211 procedure Set_Has_Allocator (U : Unit_Number_Type; B : Boolean := True) is
213 Units.Table (U).Has_Allocator := B;
214 end Set_Has_Allocator;
216 procedure Set_Has_RACW (U : Unit_Number_Type; B : Boolean := True) is
218 Units.Table (U).Has_RACW := B;
221 procedure Set_Is_Compiler_Unit
222 (U : Unit_Number_Type;
226 Units.Table (U).Is_Compiler_Unit := B;
227 end Set_Is_Compiler_Unit;
229 procedure Set_Ident_String (U : Unit_Number_Type; N : Node_Id) is
231 Units.Table (U).Ident_String := N;
232 end Set_Ident_String;
234 procedure Set_Loading (U : Unit_Number_Type; B : Boolean := True) is
236 Units.Table (U).Loading := B;
239 procedure Set_Main_CPU (U : Unit_Number_Type; P : Int) is
241 Units.Table (U).Main_CPU := P;
244 procedure Set_Main_Priority (U : Unit_Number_Type; P : Int) is
246 Units.Table (U).Main_Priority := P;
247 end Set_Main_Priority;
249 procedure Set_OA_Setting (U : Unit_Number_Type; C : Character) is
251 Units.Table (U).OA_Setting := C;
254 procedure Set_Unit_Name (U : Unit_Number_Type; N : Unit_Name_Type) is
256 Units.Table (U).Unit_Name := N;
259 ------------------------------
260 -- Check_Same_Extended_Unit --
261 ------------------------------
263 function Check_Same_Extended_Unit (S1, S2 : Source_Ptr) return SEU_Result is
266 Sind1 : Source_File_Index;
267 Sind2 : Source_File_Index;
270 Unum1 : Unit_Number_Type;
271 Unum2 : Unit_Number_Type;
278 if S1 = No_Location or else S2 = No_Location then
281 elsif S1 = Standard_Location then
282 if S2 = Standard_Location then
288 elsif S2 = Standard_Location then
294 Unum1 := Get_Code_Unit (Sloc1);
295 Unum2 := Get_Code_Unit (Sloc2);
298 Sind1 := Get_Source_File_Index (Sloc1);
299 Sind2 := Get_Source_File_Index (Sloc2);
301 if Sind1 = Sind2 then
302 if Sloc1 < Sloc2 then
304 elsif Sloc1 > Sloc2 then
311 -- OK, the two nodes are in separate source elements, but this is not
312 -- decisive, because of the issue of subunits and instantiations.
314 -- First we deal with subunits, since if the subunit is in an
315 -- instantiation, we know that the parent is in the corresponding
316 -- instantiation, since that is the only way we can have a subunit
317 -- that is part of an instantiation.
319 Unit1 := Unit (Cunit (Unum1));
320 Unit2 := Unit (Cunit (Unum2));
322 if Nkind (Unit1) = N_Subunit
323 and then Present (Corresponding_Stub (Unit1))
325 -- Both in subunits. They could have a common ancestor. If they
326 -- do, then the deeper one must have a longer unit name. Replace
327 -- the deeper one with its corresponding stub, in order to find
328 -- nearest common ancestor, if any.
330 if Nkind (Unit2) = N_Subunit
331 and then Present (Corresponding_Stub (Unit2))
333 if Length_Of_Name (Unit_Name (Unum1)) <
334 Length_Of_Name (Unit_Name (Unum2))
336 Sloc2 := Sloc (Corresponding_Stub (Unit2));
337 Unum2 := Get_Source_Unit (Sloc2);
341 Sloc1 := Sloc (Corresponding_Stub (Unit1));
342 Unum1 := Get_Source_Unit (Sloc1);
346 -- Nod1 in subunit, Nod2 not
349 Sloc1 := Sloc (Corresponding_Stub (Unit1));
350 Unum1 := Get_Source_Unit (Sloc1);
354 -- Nod2 in subunit, Nod1 not
356 elsif Nkind (Unit2) = N_Subunit
357 and then Present (Corresponding_Stub (Unit2))
359 Sloc2 := Sloc (Corresponding_Stub (Unit2));
360 Unum2 := Get_Source_Unit (Sloc2);
364 -- At this stage we know that neither is a subunit, so we deal
365 -- with instantiations, since we could have a common ancestor
367 Inst1 := Instantiation (Sind1);
368 Inst2 := Instantiation (Sind2);
370 if Inst1 /= No_Location then
372 -- Both are instantiations
374 if Inst2 /= No_Location then
376 Depth1 := Instantiation_Depth (Sloc1);
377 Depth2 := Instantiation_Depth (Sloc2);
379 if Depth1 < Depth2 then
381 Unum2 := Get_Source_Unit (Sloc2);
384 elsif Depth1 > Depth2 then
386 Unum1 := Get_Source_Unit (Sloc1);
392 Unum1 := Get_Source_Unit (Sloc1);
393 Unum2 := Get_Source_Unit (Sloc2);
397 -- Only first node is in instantiation
401 Unum1 := Get_Source_Unit (Sloc1);
405 -- Only second node is instantiation
407 elsif Inst2 /= No_Location then
409 Unum2 := Get_Source_Unit (Sloc2);
413 -- No instantiations involved, so we are not in the same unit
414 -- However, there is one case still to check, namely the case
415 -- where one location is in the spec, and the other in the
416 -- corresponding body (the spec location is earlier).
418 if Nkind (Unit1) = N_Subprogram_Body
420 Nkind (Unit1) = N_Package_Body
422 if Library_Unit (Cunit (Unum1)) = Cunit (Unum2) then
426 elsif Nkind (Unit2) = N_Subprogram_Body
428 Nkind (Unit2) = N_Package_Body
430 if Library_Unit (Cunit (Unum2)) = Cunit (Unum1) then
435 -- If that special case does not occur, then we are certain that
436 -- the two locations are really in separate units.
443 end Check_Same_Extended_Unit;
445 -------------------------------
446 -- Compilation_Switches_Last --
447 -------------------------------
449 function Compilation_Switches_Last return Nat is
451 return Compilation_Switches.Last;
452 end Compilation_Switches_Last;
454 ---------------------------
455 -- Enable_Switch_Storing --
456 ---------------------------
458 procedure Enable_Switch_Storing is
460 Switch_Storing_Enabled := True;
461 end Enable_Switch_Storing;
463 ----------------------------
464 -- Disable_Switch_Storing --
465 ----------------------------
467 procedure Disable_Switch_Storing is
469 Switch_Storing_Enabled := False;
470 end Disable_Switch_Storing;
472 ------------------------------
473 -- Earlier_In_Extended_Unit --
474 ------------------------------
476 function Earlier_In_Extended_Unit (S1, S2 : Source_Ptr) return Boolean is
478 return Check_Same_Extended_Unit (S1, S2) = Yes_Before;
479 end Earlier_In_Extended_Unit;
481 ----------------------------
482 -- Entity_Is_In_Main_Unit --
483 ----------------------------
485 function Entity_Is_In_Main_Unit (E : Entity_Id) return Boolean is
491 while S /= Standard_Standard loop
492 if S = Main_Unit_Entity then
494 elsif Ekind (S) = E_Package and then Is_Child_Unit (S) then
502 end Entity_Is_In_Main_Unit;
504 --------------------------
505 -- Generic_May_Lack_ALI --
506 --------------------------
508 function Generic_May_Lack_ALI (Sfile : File_Name_Type) return Boolean is
510 -- We allow internal generic units to be used without having a
511 -- corresponding ALI files to help bootstrapping with older compilers
512 -- that did not support generating ALIs for such generics. It is safe
513 -- to do so because the only thing the generated code would contain
514 -- is the elaboration boolean, and we are careful to elaborate all
515 -- predefined units first anyway.
517 return Is_Internal_File_Name
519 Renamings_Included => True);
520 end Generic_May_Lack_ALI;
522 -----------------------------
523 -- Get_Code_Or_Source_Unit --
524 -----------------------------
526 function Get_Code_Or_Source_Unit
528 Unwind_Instances : Boolean) return Unit_Number_Type
531 -- Search table unless we have No_Location, which can happen if the
532 -- relevant location has not been set yet. Happens for example when
533 -- we obtain Sloc (Cunit (Main_Unit)) before it is set.
535 if S /= No_Location then
537 Source_File : Source_File_Index;
538 Source_Unit : Unit_Number_Type;
541 Source_File := Get_Source_File_Index (S);
543 if Unwind_Instances then
544 while Template (Source_File) /= No_Source_File loop
545 Source_File := Template (Source_File);
549 Source_Unit := Unit (Source_File);
551 if Source_Unit /= No_Unit then
557 -- If S was No_Location, or was not in the table, we must be in the main
558 -- source unit (and the value has not been placed in the table yet),
559 -- or in one of the configuration pragma files.
562 end Get_Code_Or_Source_Unit;
568 function Get_Code_Unit (S : Source_Ptr) return Unit_Number_Type is
570 return Get_Code_Or_Source_Unit (Top_Level_Location (S),
571 Unwind_Instances => False);
574 function Get_Code_Unit (N : Node_Or_Entity_Id) return Unit_Number_Type is
576 return Get_Code_Unit (Sloc (N));
579 ----------------------------
580 -- Get_Compilation_Switch --
581 ----------------------------
583 function Get_Compilation_Switch (N : Pos) return String_Ptr is
585 if N <= Compilation_Switches.Last then
586 return Compilation_Switches.Table (N);
591 end Get_Compilation_Switch;
593 ----------------------------------
594 -- Get_Cunit_Entity_Unit_Number --
595 ----------------------------------
597 function Get_Cunit_Entity_Unit_Number
598 (E : Entity_Id) return Unit_Number_Type
601 for U in Units.First .. Units.Last loop
602 if Cunit_Entity (U) = E then
607 -- If not in the table, must be the main source unit, and we just
608 -- have not got it put into the table yet.
611 end Get_Cunit_Entity_Unit_Number;
613 ---------------------------
614 -- Get_Cunit_Unit_Number --
615 ---------------------------
617 function Get_Cunit_Unit_Number (N : Node_Id) return Unit_Number_Type is
619 for U in Units.First .. Units.Last loop
620 if Cunit (U) = N then
625 -- If not in the table, must be a spec created for a main unit that is a
626 -- child subprogram body which we have not inserted into the table yet.
628 if N = Library_Unit (Cunit (Main_Unit)) then
631 -- If it is anything else, something is seriously wrong, and we really
632 -- don't want to proceed, even if assertions are off, so we explicitly
633 -- raise an exception in this case to terminate compilation.
638 end Get_Cunit_Unit_Number;
640 ---------------------
641 -- Get_Source_Unit --
642 ---------------------
644 function Get_Source_Unit (S : Source_Ptr) return Unit_Number_Type is
646 return Get_Code_Or_Source_Unit (S, Unwind_Instances => True);
649 function Get_Source_Unit (N : Node_Or_Entity_Id) return Unit_Number_Type is
651 return Get_Source_Unit (Sloc (N));
654 --------------------------------
655 -- In_Extended_Main_Code_Unit --
656 --------------------------------
658 function In_Extended_Main_Code_Unit
659 (N : Node_Or_Entity_Id) return Boolean
662 if Sloc (N) = Standard_Location then
665 elsif Sloc (N) = No_Location then
668 -- Special case Itypes to test the Sloc of the associated node. The
669 -- reason we do this is for possible calls from gigi after -gnatD
670 -- processing is complete in sprint. This processing updates the
671 -- sloc fields of all nodes in the tree, but itypes are not in the
672 -- tree so their slocs do not get updated.
674 elsif Nkind (N) = N_Defining_Identifier
675 and then Is_Itype (N)
677 return In_Extended_Main_Code_Unit (Associated_Node_For_Itype (N));
679 -- Otherwise see if we are in the main unit
681 elsif Get_Code_Unit (Sloc (N)) = Get_Code_Unit (Cunit (Main_Unit)) then
684 -- Node may be in spec (or subunit etc) of main unit
688 In_Same_Extended_Unit (N, Cunit (Main_Unit));
690 end In_Extended_Main_Code_Unit;
692 function In_Extended_Main_Code_Unit (Loc : Source_Ptr) return Boolean is
694 if Loc = Standard_Location then
697 elsif Loc = No_Location then
700 -- Otherwise see if we are in the main unit
702 elsif Get_Code_Unit (Loc) = Get_Code_Unit (Cunit (Main_Unit)) then
705 -- Location may be in spec (or subunit etc) of main unit
709 In_Same_Extended_Unit (Loc, Sloc (Cunit (Main_Unit)));
711 end In_Extended_Main_Code_Unit;
713 ----------------------------------
714 -- In_Extended_Main_Source_Unit --
715 ----------------------------------
717 function In_Extended_Main_Source_Unit
718 (N : Node_Or_Entity_Id) return Boolean
720 Nloc : constant Source_Ptr := Sloc (N);
721 Mloc : constant Source_Ptr := Sloc (Cunit (Main_Unit));
724 -- If parsing, then use the global flag to indicate result
726 if Compiler_State = Parsing then
727 return Parsing_Main_Extended_Source;
729 -- Special value cases
731 elsif Nloc = Standard_Location then
734 elsif Nloc = No_Location then
737 -- Special case Itypes to test the Sloc of the associated node. The
738 -- reason we do this is for possible calls from gigi after -gnatD
739 -- processing is complete in sprint. This processing updates the
740 -- sloc fields of all nodes in the tree, but itypes are not in the
741 -- tree so their slocs do not get updated.
743 elsif Nkind (N) = N_Defining_Identifier
744 and then Is_Itype (N)
746 return In_Extended_Main_Source_Unit (Associated_Node_For_Itype (N));
748 -- Otherwise compare original locations to see if in same unit
752 In_Same_Extended_Unit
753 (Original_Location (Nloc), Original_Location (Mloc));
755 end In_Extended_Main_Source_Unit;
757 function In_Extended_Main_Source_Unit
758 (Loc : Source_Ptr) return Boolean
760 Mloc : constant Source_Ptr := Sloc (Cunit (Main_Unit));
763 -- If parsing, then use the global flag to indicate result
765 if Compiler_State = Parsing then
766 return Parsing_Main_Extended_Source;
768 -- Special value cases
770 elsif Loc = Standard_Location then
773 elsif Loc = No_Location then
776 -- Otherwise compare original locations to see if in same unit
780 In_Same_Extended_Unit
781 (Original_Location (Loc), Original_Location (Mloc));
783 end In_Extended_Main_Source_Unit;
785 ------------------------
786 -- In_Predefined_Unit --
787 ------------------------
789 function In_Predefined_Unit (N : Node_Or_Entity_Id) return Boolean is
791 return In_Predefined_Unit (Sloc (N));
792 end In_Predefined_Unit;
794 function In_Predefined_Unit (S : Source_Ptr) return Boolean is
795 Unit : constant Unit_Number_Type := Get_Source_Unit (S);
796 File : constant File_Name_Type := Unit_File_Name (Unit);
798 return Is_Predefined_File_Name (File);
799 end In_Predefined_Unit;
801 -----------------------
802 -- In_Same_Code_Unit --
803 -----------------------
805 function In_Same_Code_Unit (N1, N2 : Node_Or_Entity_Id) return Boolean is
806 S1 : constant Source_Ptr := Sloc (N1);
807 S2 : constant Source_Ptr := Sloc (N2);
810 if S1 = No_Location or else S2 = No_Location then
813 elsif S1 = Standard_Location then
814 return S2 = Standard_Location;
816 elsif S2 = Standard_Location then
820 return Get_Code_Unit (N1) = Get_Code_Unit (N2);
821 end In_Same_Code_Unit;
823 ---------------------------
824 -- In_Same_Extended_Unit --
825 ---------------------------
827 function In_Same_Extended_Unit
828 (N1, N2 : Node_Or_Entity_Id) return Boolean
831 return Check_Same_Extended_Unit (Sloc (N1), Sloc (N2)) /= No;
832 end In_Same_Extended_Unit;
834 function In_Same_Extended_Unit (S1, S2 : Source_Ptr) return Boolean is
836 return Check_Same_Extended_Unit (S1, S2) /= No;
837 end In_Same_Extended_Unit;
839 -------------------------
840 -- In_Same_Source_Unit --
841 -------------------------
843 function In_Same_Source_Unit (N1, N2 : Node_Or_Entity_Id) return Boolean is
844 S1 : constant Source_Ptr := Sloc (N1);
845 S2 : constant Source_Ptr := Sloc (N2);
848 if S1 = No_Location or else S2 = No_Location then
851 elsif S1 = Standard_Location then
852 return S2 = Standard_Location;
854 elsif S2 = Standard_Location then
858 return Get_Source_Unit (N1) = Get_Source_Unit (N2);
859 end In_Same_Source_Unit;
861 -----------------------------
862 -- Increment_Serial_Number --
863 -----------------------------
865 function Increment_Serial_Number return Nat is
866 TSN : Int renames Units.Table (Current_Sem_Unit).Serial_Number;
870 end Increment_Serial_Number;
876 procedure Initialize is
878 Linker_Option_Lines.Init;
882 Compilation_Switches.Init;
889 function Is_Loaded (Uname : Unit_Name_Type) return Boolean is
891 for Unum in Units.First .. Units.Last loop
892 if Uname = Unit_Name (Unum) then
904 function Last_Unit return Unit_Number_Type is
913 procedure List (File_Names_Only : Boolean := False) is separate;
921 Linker_Option_Lines.Locked := True;
922 Load_Stack.Locked := True;
923 Units.Locked := True;
924 Linker_Option_Lines.Release;
933 function Num_Units return Nat is
935 return Int (Units.Last) - Int (Main_Unit) + 1;
942 procedure Remove_Unit (U : Unit_Number_Type) is
944 if U = Units.Last then
945 Units.Decrement_Last;
949 ----------------------------------
950 -- Replace_Linker_Option_String --
951 ----------------------------------
953 procedure Replace_Linker_Option_String
954 (S : String_Id; Match_String : String)
957 if Match_String'Length > 0 then
958 for J in 1 .. Linker_Option_Lines.Last loop
959 String_To_Name_Buffer (Linker_Option_Lines.Table (J).Option);
961 if Match_String = Name_Buffer (1 .. Match_String'Length) then
962 Linker_Option_Lines.Table (J).Option := S;
968 Store_Linker_Option_String (S);
969 end Replace_Linker_Option_String;
975 procedure Sort (Tbl : in out Unit_Ref_Table) is separate;
977 ------------------------------
978 -- Store_Compilation_Switch --
979 ------------------------------
981 procedure Store_Compilation_Switch (Switch : String) is
983 if Switch_Storing_Enabled then
984 Compilation_Switches.Increment_Last;
985 Compilation_Switches.Table (Compilation_Switches.Last) :=
988 -- Fix up --RTS flag which has been transformed by the gcc driver
991 if Switch'Last >= Switch'First + 4
992 and then Switch (Switch'First .. Switch'First + 4) = "-fRTS"
994 Compilation_Switches.Table
995 (Compilation_Switches.Last) (Switch'First + 1) := '-';
998 end Store_Compilation_Switch;
1000 --------------------------------
1001 -- Store_Linker_Option_String --
1002 --------------------------------
1004 procedure Store_Linker_Option_String (S : String_Id) is
1006 Linker_Option_Lines.Append ((Option => S, Unit => Current_Sem_Unit));
1007 end Store_Linker_Option_String;
1013 procedure Store_Note (N : Node_Id) is
1015 Notes.Append ((Pragma_Node => N, Unit => Current_Sem_Unit));
1018 -------------------------------
1019 -- Synchronize_Serial_Number --
1020 -------------------------------
1022 procedure Synchronize_Serial_Number is
1023 TSN : Int renames Units.Table (Current_Sem_Unit).Serial_Number;
1026 end Synchronize_Serial_Number;
1032 procedure Tree_Read is
1039 -- Read Compilation_Switches table. First release the memory occupied
1040 -- by the previously loaded switches.
1042 for J in Compilation_Switches.First .. Compilation_Switches.Last loop
1043 Free (Compilation_Switches.Table (J));
1047 Compilation_Switches.Set_Last (N);
1049 for J in 1 .. N loop
1051 Compilation_Switches.Table (J) := S;
1059 procedure Tree_Write is
1063 -- Write Compilation_Switches table
1065 Tree_Write_Int (Compilation_Switches.Last);
1067 for J in 1 .. Compilation_Switches.Last loop
1068 Tree_Write_Str (Compilation_Switches.Table (J));
1078 Linker_Option_Lines.Locked := False;
1079 Load_Stack.Locked := False;
1080 Units.Locked := False;
1087 function Version_Get (U : Unit_Number_Type) return Word_Hex_String is
1089 return Get_Hex_String (Units.Table (U).Version);
1092 ------------------------
1093 -- Version_Referenced --
1094 ------------------------
1096 procedure Version_Referenced (S : String_Id) is
1098 Version_Ref.Append (S);
1099 end Version_Referenced;