From: Arnaud Charlet Date: Mon, 26 Oct 2015 13:30:23 +0000 (+0100) Subject: [multiple changes] X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=64dfccae7b6b30498e1ce660941051bb4d3108bd;p=gcc.git [multiple changes] 2015-10-26 Emmanuel Briot * s-os_lib.adb (Argument_String_To_List): Remove backslashes in argument value. 2015-10-26 Javier Miranda * exp_unst.ads, exp_unst.adb (Is_Uplevel_Referenced): Removed. From-SVN: r229361 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 65f700c7341..4f63dfe074e 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,12 @@ +2015-10-26 Emmanuel Briot + + * s-os_lib.adb (Argument_String_To_List): Remove backslashes in + argument value. + +2015-10-26 Javier Miranda + + * exp_unst.ads, exp_unst.adb (Is_Uplevel_Referenced): Removed. + 2015-10-26 Hristian Kirtchev * exp_util.adb, sem_aux.adb, exp_attr.adb, sem_eval.adb: Minor diff --git a/gcc/ada/exp_unst.adb b/gcc/ada/exp_unst.adb index 689726bd919..99d546fab9e 100644 --- a/gcc/ada/exp_unst.adb +++ b/gcc/ada/exp_unst.adb @@ -119,21 +119,6 @@ package body Exp_Unst is Table_Increment => 200, Table_Name => "Unnest_Urefs"); - --------------------------- - -- Is_Uplevel_Referenced -- - --------------------------- - - function Is_Uplevel_Referenced (E : Entity_Id) return Boolean is - begin - for J in Urefs.First .. Urefs.Last loop - if Urefs.Table (J).Ent = E then - return True; - end if; - end loop; - - return False; - end Is_Uplevel_Referenced; - ----------------------- -- Unnest_Subprogram -- ----------------------- diff --git a/gcc/ada/exp_unst.ads b/gcc/ada/exp_unst.ads index 1458853610c..084e904b677 100644 --- a/gcc/ada/exp_unst.ads +++ b/gcc/ada/exp_unst.ads @@ -686,7 +686,4 @@ package Exp_Unst is -- adds the ARECP parameter to all nested subprograms which need it, and -- modifies all uplevel references appropriately. - function Is_Uplevel_Referenced (E : Entity_Id) return Boolean; - -- Determines if E has some uplevel reference from a nested subprogram - end Exp_Unst; diff --git a/gcc/ada/s-os_lib.adb b/gcc/ada/s-os_lib.adb index 61c0b41ea16..573b738541d 100644 --- a/gcc/ada/s-os_lib.adb +++ b/gcc/ada/s-os_lib.adb @@ -189,6 +189,12 @@ package body System.OS_Lib is New_Argc : Natural := 0; Idx : Integer; + Cleaned : String (1 .. Arg_String'Length); + Cleaned_Idx : Natural; + -- A cleaned up version of the argument. This function is taking + -- backslash escapes when computing the bounds for arguments. It is + -- then removing the extra backslashes from the argument. + begin Idx := Arg_String'First; @@ -198,10 +204,9 @@ package body System.OS_Lib is declare Quoted : Boolean := False; Backqd : Boolean := False; - Old_Idx : Integer; begin - Old_Idx := Idx; + Cleaned_Idx := Cleaned'First; loop -- An unquoted space is the end of an argument @@ -217,25 +222,34 @@ package body System.OS_Lib is and then Arg_String (Idx) = '"' then Quoted := True; + Cleaned (Cleaned_Idx) := Arg_String (Idx); + Cleaned_Idx := Cleaned_Idx + 1; -- End of a quoted string and end of an argument elsif (Quoted and not Backqd) and then Arg_String (Idx) = '"' then + Cleaned (Cleaned_Idx) := Arg_String (Idx); + Cleaned_Idx := Cleaned_Idx + 1; Idx := Idx + 1; exit; - -- Following character is backquoted - - elsif Arg_String (Idx) = '\' then - Backqd := True; - -- Turn off backquoting after advancing one character elsif Backqd then Backqd := False; + Cleaned (Cleaned_Idx) := Arg_String (Idx); + Cleaned_Idx := Cleaned_Idx + 1; + -- Following character is backquoted + + elsif Arg_String (Idx) = '\' then + Backqd := True; + + else + Cleaned (Cleaned_Idx) := Arg_String (Idx); + Cleaned_Idx := Cleaned_Idx + 1; end if; Idx := Idx + 1; @@ -246,7 +260,7 @@ package body System.OS_Lib is New_Argc := New_Argc + 1; New_Argv (New_Argc) := - new String'(Arg_String (Old_Idx .. Idx - 1)); + new String'(Cleaned (Cleaned'First .. Cleaned_Idx - 1)); -- Skip extraneous spaces