diff options
Diffstat (limited to 'gcc/ada/lib.adb')
-rw-r--r-- | gcc/ada/lib.adb | 63 |
1 files changed, 32 insertions, 31 deletions
diff --git a/gcc/ada/lib.adb b/gcc/ada/lib.adb index d298267..44a4af0 100644 --- a/gcc/ada/lib.adb +++ b/gcc/ada/lib.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2020, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2021, 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- -- @@ -27,18 +27,20 @@ pragma Style_Checks (All_Checks); -- Subprogram ordering not enforced in this unit -- (because of some logical groupings). -with Atree; use Atree; -with Csets; use Csets; -with Einfo; use Einfo; -with Nlists; use Nlists; -with Opt; use Opt; -with Output; use Output; -with Sinfo; use Sinfo; -with Sinput; use Sinput; -with Stand; use Stand; -with Stringt; use Stringt; -with Uname; use Uname; -with Widechar; use Widechar; +with Atree; use Atree; +with Csets; use Csets; +with Einfo; use Einfo; +with Einfo.Entities; use Einfo.Entities; +with Nlists; use Nlists; +with Opt; use Opt; +with Output; use Output; +with Sinfo; use Sinfo; +with Sinfo.Nodes; use Sinfo.Nodes; +with Sinput; use Sinput; +with Stand; use Stand; +with Stringt; use Stringt; +with Uname; use Uname; +with Widechar; use Widechar; package body Lib is @@ -126,12 +128,12 @@ package body Lib is return Units.Table (U).Is_Predefined_Renaming; end Is_Predefined_Renaming; - function Is_Internal_Unit (U : Unit_Number_Type) return Boolean is + function Is_Internal_Unit (U : Unit_Number_Type) return Boolean is begin return Units.Table (U).Is_Internal_Unit; end Is_Internal_Unit; - function Is_Predefined_Unit (U : Unit_Number_Type) return Boolean is + function Is_Predefined_Unit (U : Unit_Number_Type) return Boolean is begin return Units.Table (U).Is_Predefined_Unit; end Is_Predefined_Unit; @@ -480,18 +482,12 @@ package body Lib is -- body of the same unit. The location in the spec is considered -- earlier. - if Nkind (Unit1) = N_Subprogram_Body - or else - Nkind (Unit1) = N_Package_Body - then + if Nkind (Unit1) in N_Subprogram_Body | N_Package_Body then if Library_Unit (Cunit (Unum1)) = Cunit (Unum2) then return Yes_After; end if; - elsif Nkind (Unit2) = N_Subprogram_Body - or else - Nkind (Unit2) = N_Package_Body - then + elsif Nkind (Unit2) in N_Subprogram_Body | N_Package_Body then if Library_Unit (Cunit (Unum2)) = Cunit (Unum1) then return Yes_Before; end if; @@ -509,8 +505,8 @@ package body Lib is if Counter > Max_Iterations then - -- ??? Not quite right, but return a value to be able to generate - -- SCIL files and hope for the best. + -- In CodePeer_Mode, return a value to be able to generate SCIL + -- files and hope for the best. if CodePeer_Mode then return No; @@ -1178,10 +1174,9 @@ package body Lib is procedure Remove_Unit (U : Unit_Number_Type) is begin - if U = Units.Last then - Unit_Names.Set (Unit_Name (U), No_Unit); - Units.Decrement_Last; - end if; + pragma Assert (U = Units.Last); + Unit_Names.Set (Unit_Name (U), No_Unit); + Units.Decrement_Last; end Remove_Unit; ---------------------------------- @@ -1266,10 +1261,16 @@ package body Lib is -- Synchronize_Serial_Number -- ------------------------------- - procedure Synchronize_Serial_Number is + procedure Synchronize_Serial_Number (SN : Nat) is TSN : Int renames Units.Table (Current_Sem_Unit).Serial_Number; begin - TSN := TSN + 1; + -- We should not be trying to synchronize downward + + pragma Assert (TSN <= SN); + + if TSN < SN then + TSN := SN; + end if; end Synchronize_Serial_Number; -------------------- |