From ffdbd4c44e7b56966d11fcd62335ded7babaed09 Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Thu, 16 Jun 2005 10:38:55 +0200 Subject: [PATCH] g-comlin.adb (Getopt): Skip any leading space in the Switches string. 2005-06-14 Joel Brobecker * g-comlin.adb (Getopt): Skip any leading space in the Switches string. Avoids a CE when it starts with spaces. From-SVN: r101038 --- gcc/ada/g-comlin.adb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gcc/ada/g-comlin.adb b/gcc/ada/g-comlin.adb index 05862b478eb..0c5457a190e 100644 --- a/gcc/ada/g-comlin.adb +++ b/gcc/ada/g-comlin.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1999-2004 Free Software Foundation, Inc. -- +-- Copyright (C) 1999-2005 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- -- @@ -384,11 +384,19 @@ package body GNAT.Command_Line is Arg : String renames CL.Argument (Current_Argument); Index_Switches : Natural := 0; Max_Length : Natural := 0; - Index : Natural := Switches'First; + Index : Natural; Length : Natural := 1; End_Index : Natural; begin + -- Remove all leading spaces first to make sure that Index points + -- at the start of the first switch. + + Index := Switches'First; + while Index <= Switches'Last and then Switches (Index) = ' ' loop + Index := Index + 1; + end loop; + while Index <= Switches'Last loop -- Search the length of the parameter at this position in Switches -- 2.30.2