aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/g-comlin.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2008-08-20 17:30:04 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2008-08-20 17:30:04 +0200
commit7486d8e0c87a721a4b04229d1a3c3638d53d870c (patch)
tree7cd84483c9de707e504b57f3b06cfea1f6a94481 /gcc/ada/g-comlin.adb
parent26a29f015c8fcd83cd199443745c9dfd462913bd (diff)
downloadgcc-7486d8e0c87a721a4b04229d1a3c3638d53d870c.zip
gcc-7486d8e0c87a721a4b04229d1a3c3638d53d870c.tar.gz
gcc-7486d8e0c87a721a4b04229d1a3c3638d53d870c.tar.bz2
g-comlin.adb (For_Each_Simple_Switch): Take care of switches not part of any alias or prefix but having attached...
2008-08-20 Jerome Lambourg <lambourg@adacore.com> * g-comlin.adb (For_Each_Simple_Switch): Take care of switches not part of any alias or prefix but having attached parameters (as \"-O2\"). From-SVN: r139314
Diffstat (limited to 'gcc/ada/g-comlin.adb')
-rw-r--r--gcc/ada/g-comlin.adb44
1 files changed, 44 insertions, 0 deletions
diff --git a/gcc/ada/g-comlin.adb b/gcc/ada/g-comlin.adb
index d37d06b..e307041 100644
--- a/gcc/ada/g-comlin.adb
+++ b/gcc/ada/g-comlin.adb
@@ -1566,6 +1566,50 @@ package body GNAT.Command_Line is
end loop;
end if;
+ -- Determine if the added switch is a known switch with parameter
+ -- attached.
+ if Parameter = ""
+ and then Cmd.Config /= null
+ and then Cmd.Config.Switches /= null
+ then
+ for S in Cmd.Config.Switches'Range loop
+ declare
+ Sw : constant String :=
+ Actual_Switch (Cmd.Config.Switches (S).all);
+ Last : Natural;
+ Param : Natural;
+
+ begin
+ if Switch'Length >= Sw'Length
+ -- Verify that switch starts with Sw
+ and then Looking_At (Switch, Switch'First, Sw)
+ then
+ Param := Switch'First + Sw'Length - 1;
+ Last := Param;
+
+ if Can_Have_Parameter (Cmd.Config.Switches (S).all) then
+ while Last < Switch'Last
+ and then Switch (Last + 1) in '0' .. '9'
+ loop
+ Last := Last + 1;
+ end loop;
+ end if;
+
+ -- If the full Switch is a known switch with attached
+ -- parameter, then we use this parameter in the callback.
+ if Last = Switch'Last then
+ Callback
+ (Switch (Switch'First .. Param),
+ Switch (Param + 1 .. Last));
+
+ return;
+
+ end if;
+ end if;
+ end;
+ end loop;
+ end if;
+
Callback (Switch, Parameter);
end For_Each_Simple_Switch;