From: Piotr Trojanek <troja...@adacore.com> Code cleanup; semantics is unaffected.
gcc/ada/ChangeLog: * exp_dist.adb (Assign_Subprogram_Identifier, Reserve_NamingContext_Methods): Simplify. * osint.adb (Append_Suffix_To_File_Name, Find_File, Get_Directory, Object_File_Name, Strip_Directory): Likewise. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_dist.adb | 8 ++------ gcc/ada/osint.adb | 22 +++++----------------- 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/gcc/ada/exp_dist.adb b/gcc/ada/exp_dist.adb index fcfeba0e1a6..e8f9b68baf3 100644 --- a/gcc/ada/exp_dist.adb +++ b/gcc/ada/exp_dist.adb @@ -2089,8 +2089,7 @@ package body Exp_Dist is -- disambiguated within their own scope. if Overload_Order > 1 then - Name_Buffer (Name_Len + 1 .. Name_Len + 2) := "__"; - Name_Len := Name_Len + 2; + Add_Str_To_Name_Buffer ("__"); Add_Nat_To_Name_Buffer (Overload_Order); end if; @@ -11188,11 +11187,8 @@ package body Exp_Dist is ----------------------------------- procedure Reserve_NamingContext_Methods is - Str_Resolve : constant String := "resolve"; begin - Name_Buffer (1 .. Str_Resolve'Length) := Str_Resolve; - Name_Len := Str_Resolve'Length; - Overload_Counter_Table.Set (Name_Find, 1); + Overload_Counter_Table.Set (Name_Find ("resolve"), 1); end Reserve_NamingContext_Methods; ----------------------- diff --git a/gcc/ada/osint.adb b/gcc/ada/osint.adb index 645cb630b13..364c069a099 100644 --- a/gcc/ada/osint.adb +++ b/gcc/ada/osint.adb @@ -658,8 +658,7 @@ package body Osint is is begin Get_Name_String (Name); - Name_Buffer (Name_Len + 1 .. Name_Len + Suffix'Length) := Suffix; - Name_Len := Name_Len + Suffix'Length; + Add_Str_To_Name_Buffer (Suffix); return Name_Find; end Append_Suffix_To_File_Name; @@ -1225,12 +1224,8 @@ package body Osint is declare Full_Path : constant String := Normalize_Pathname (Get_Name_String (N)); - Full_Size : constant Natural := Full_Path'Length; - begin - Name_Buffer (1 .. Full_Size) := Full_Path; - Name_Len := Full_Size; - Found := Name_Find; + Found := Name_Find (Full_Path); end; end if; @@ -1446,9 +1441,7 @@ package body Osint is end if; end loop; - Name_Len := Hostparm.Normalized_CWD'Length; - Name_Buffer (1 .. Name_Len) := Hostparm.Normalized_CWD; - return Name_Find; + return Name_Find (Hostparm.Normalized_CWD); end Get_Directory; ------------------------------ @@ -2182,10 +2175,7 @@ package body Osint is Get_Name_String (N); Name_Len := Name_Len - ALI_Suffix'Length - 1; - for J in Target_Object_Suffix'Range loop - Name_Len := Name_Len + 1; - Name_Buffer (Name_Len) := Target_Object_Suffix (J); - end loop; + Add_Str_To_Name_Buffer (Target_Object_Suffix); return Name_Enter; end Object_File_Name; @@ -2935,9 +2925,7 @@ package body Osint is -- Return part of Name that follows this last directory separator - Name_Buffer (1 .. Name_Len - J) := Name_Buffer (J + 1 .. Name_Len); - Name_Len := Name_Len - J; - return Name_Find; + return Name_Find (Name_Buffer (J + 1 .. Name_Len)); end if; end loop; -- 2.43.0