aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@adacore.com>2005-06-16 10:38:55 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2005-06-16 10:38:55 +0200
commitffdbd4c44e7b56966d11fcd62335ded7babaed09 (patch)
tree435e509832965dcd444d4e7b46cd65b0f37cda9f
parenta49c3e1607d7a9fd80d4899e68821e9ff8594015 (diff)
downloadgcc-ffdbd4c44e7b56966d11fcd62335ded7babaed09.zip
gcc-ffdbd4c44e7b56966d11fcd62335ded7babaed09.tar.gz
gcc-ffdbd4c44e7b56966d11fcd62335ded7babaed09.tar.bz2
g-comlin.adb (Getopt): Skip any leading space in the Switches string.
2005-06-14 Joel Brobecker <brobecker@adacore.com> * g-comlin.adb (Getopt): Skip any leading space in the Switches string. Avoids a CE when it starts with spaces. From-SVN: r101038
-rw-r--r--gcc/ada/g-comlin.adb12
1 files changed, 10 insertions, 2 deletions
diff --git a/gcc/ada/g-comlin.adb b/gcc/ada/g-comlin.adb
index 05862b4..0c5457a 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