-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2003 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2004 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
package body Lib is
+ Switch_Storing_Enabled : Boolean := True;
+ -- Set to False by Disable_Switch_Storing
+
-----------------------
-- Local Subprograms --
-----------------------
return Units.Table (U).Dependency_Num;
end Dependency_Num;
- function Dependent_Unit (U : Unit_Number_Type) return Boolean is
- begin
- return Units.Table (U).Dependent_Unit;
- end Dependent_Unit;
-
function Dynamic_Elab (U : Unit_Number_Type) return Boolean is
begin
return Units.Table (U).Dynamic_Elab;
return Units.Table (U).Main_Priority;
end Main_Priority;
+ function Munit_Index (U : Unit_Number_Type) return Nat is
+ begin
+ return Units.Table (U).Munit_Index;
+ end Munit_Index;
+
function Source_Index (U : Unit_Number_Type) return Source_File_Index is
begin
return Units.Table (U).Source_Index;
return Compilation_Switches.Last;
end Compilation_Switches_Last;
+ procedure Disable_Switch_Storing is
+ begin
+ Switch_Storing_Enabled := False;
+ end Disable_Switch_Storing;
+
------------------------------
-- Earlier_In_Extended_Unit --
------------------------------
end if;
-- If S was No_Location, or was not in the table, we must be in the
- -- main source unit (and the value is not got put into the table yet)
+ -- main source unit (and the value has not got put into the table yet)
return Main_Unit;
end Get_Source_Unit;
else
return
- In_Same_Extended_Unit (Sloc (N), Sloc (Cunit (Main_Unit)));
+ In_Same_Extended_Unit (N, Cunit (Main_Unit));
end if;
end In_Extended_Main_Code_Unit;
-- In_Same_Extended_Unit --
---------------------------
+ function In_Same_Extended_Unit
+ (N1, N2 : Node_Or_Entity_Id) return Boolean
+ is
+ begin
+ return Check_Same_Extended_Unit (Sloc (N1), Sloc (N2)) /= No;
+ end In_Same_Extended_Unit;
+
function In_Same_Extended_Unit (S1, S2 : Source_Ptr) return Boolean is
begin
return Check_Same_Extended_Unit (S1, S2) /= No;
function Increment_Serial_Number return Nat is
TSN : Int renames Units.Table (Current_Sem_Unit).Serial_Number;
-
begin
TSN := TSN + 1;
return TSN;
return Int (Units.Last) - Int (Main_Unit) + 1;
end Num_Units;
+ -----------------
+ -- Remove_Unit --
+ -----------------
+
+ procedure Remove_Unit (U : Unit_Number_Type) is
+ begin
+ if U = Units.Last then
+ Units.Decrement_Last;
+ end if;
+ end Remove_Unit;
+
----------------------------------
-- Replace_Linker_Option_String --
----------------------------------
procedure Store_Compilation_Switch (Switch : String) is
begin
- Compilation_Switches.Increment_Last;
- Compilation_Switches.Table (Compilation_Switches.Last) :=
- new String'(Switch);
+ if Switch_Storing_Enabled then
+ Compilation_Switches.Increment_Last;
+ Compilation_Switches.Table (Compilation_Switches.Last) :=
+ new String'(Switch);
- -- Fix up --RTS flag which has been transformed by the gcc driver
- -- into -fRTS
+ -- Fix up --RTS flag which has been transformed by the gcc driver
+ -- into -fRTS
- if Switch'Last >= Switch'First + 4
- and then Switch (Switch'First .. Switch'First + 4) = "-fRTS"
- then
- Compilation_Switches.Table
- (Compilation_Switches.Last) (Switch'First + 1) := '-';
+ if Switch'Last >= Switch'First + 4
+ and then Switch (Switch'First .. Switch'First + 4) = "-fRTS"
+ then
+ Compilation_Switches.Table
+ (Compilation_Switches.Last) (Switch'First + 1) := '-';
+ end if;
end if;
end Store_Compilation_Switch;
(Option => S, Unit => Current_Sem_Unit);
end Store_Linker_Option_String;
+ -------------------------------
+ -- Synchronize_Serial_Number --
+ -------------------------------
+
+ procedure Synchronize_Serial_Number is
+ TSN : Int renames Units.Table (Current_Sem_Unit).Serial_Number;
+ begin
+ TSN := TSN + 1;
+ end Synchronize_Serial_Number;
+
---------------
-- Tree_Read --
---------------