@@ -7802,8 +7802,7 @@ package body GNATCOLL.Projects is
78027802 -- Name, Index and Pack parameters are not case-sensitive.
78037803
78047804 function Gnatls_From_CGPR
7805- (Target : String;
7806- Runtime : String;
7805+ (Runtime : String;
78077806 Gcc : String) return String;
78087807 -- Constructs call to gnatls based on attributes from configuration
78097808 -- project.
@@ -7912,38 +7911,25 @@ package body GNATCOLL.Projects is
79127911 -- --------------------
79137912
79147913 function Gnatls_From_CGPR
7915- (Target : String;
7916- Runtime : String;
7914+ (Runtime : String;
79177915 Gcc : String) return String
79187916 is
7919- Include_Prefix : Boolean := True;
7920- N_Target : constant String := Normalize_Target_Name (Target);
7917+ Idx : Integer;
79217918 begin
7922- Set_Host_Targets_List;
7923- for Tgt of Host_Targets_List loop
7924- if N_Target = Tgt then
7925- Include_Prefix := False;
7926- exit ;
7927- end if ;
7928- end loop ;
79297919
79307920 if Gcc = " " then
79317921 return
7932- (if Include_Prefix then Target & " -" else " " )
7933- & " gnatls -v"
7922+ " gnatls -v"
79347923 & (if Runtime = " " then " " else " --RTS=" & Runtime);
79357924 else
7936- for I in reverse Gcc'Range loop
7937- if Gcc (I) in ' /' | ' \' then
7938-
7939- return
7940- Gcc (Gcc'First .. I)
7941- & (if Include_Prefix then Target & " -" else " " )
7942- & " gnatls -v"
7943- & (if Runtime = " " then " " else " --RTS=" & Runtime);
7944- end if ;
7925+ Idx := Index (Gcc, " gcc" , Backward);
79457926
7946- end loop ;
7927+ if Idx > Gcc'First and then Idx = Gcc'Last - 2 then
7928+ return
7929+ Gcc (Gcc'First .. Idx - 1 )
7930+ & " gnatls -v"
7931+ & (if Runtime = " " then " " else " --RTS=" & Runtime);
7932+ end if ;
79477933 end if ;
79487934
79497935 return " gnatls -v" ;
@@ -8012,10 +7998,10 @@ package body GNATCOLL.Projects is
80127998 Trace (Me, CGPR_GCC);
80137999
80148000 Trace (Me,
8015- Gnatls_From_CGPR (CGPR_Target, CGPR_Runtime, CGPR_GCC));
8001+ Gnatls_From_CGPR (CGPR_Runtime, CGPR_GCC));
80168002
80178003 Self.Set_Default_Gnatls
8018- (Gnatls_From_CGPR (CGPR_Target, CGPR_Runtime, CGPR_GCC));
8004+ (Gnatls_From_CGPR (CGPR_Runtime, CGPR_GCC));
80198005 end ;
80208006 Free (Project_Tree);
80218007 Free (Project_Node_Tree);
@@ -8054,13 +8040,14 @@ package body GNATCOLL.Projects is
80548040 Target_Value : constant Variable_Value :=
80558041 Value_Of (Get_String (" target" ), Project.Decl.Attributes, Shared);
80568042 Target : constant String :=
8057- Normalize_Target_Name
8058- (if Tree.Data.Env.Forced_Target /= null then
8059- Tree.Data.Env.Forced_Target.all
8060- elsif Target_Value.Project = Project then
8061- Value_Of (Target_Value, Unset)
8062- else
8063- " " );
8043+ (if Tree.Data.Env.Forced_Target /= null then
8044+ Tree.Data.Env.Forced_Target.all
8045+ elsif Target_Value.Project = Project then
8046+ Value_Of (Target_Value, Unset)
8047+ else
8048+ " " );
8049+
8050+ N_Target : constant String := Normalize_Target_Name (Target);
80648051
80658052 function Get_Value_Of_Runtime (Project : Project_Id) return String;
80668053 -- Look for the value of Runtime attribute in given project or projects
@@ -8105,7 +8092,7 @@ package body GNATCOLL.Projects is
81058092 end if ;
81068093
81078094 for Tgt of Host_Targets_List loop
8108- if Target = Tgt then
8095+ if N_Target = Tgt then
81098096 No_Prefix := True;
81108097 exit ;
81118098 end if ;
0 commit comments