aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/g-comlin.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/g-comlin.adb')
-rw-r--r--gcc/ada/g-comlin.adb56
1 files changed, 42 insertions, 14 deletions
diff --git a/gcc/ada/g-comlin.adb b/gcc/ada/g-comlin.adb
index 60dde35..8615b02 100644
--- a/gcc/ada/g-comlin.adb
+++ b/gcc/ada/g-comlin.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1999-2011, Free Software Foundation, Inc. --
+-- Copyright (C) 1999-2012, 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- --
@@ -128,7 +128,8 @@ package body GNAT.Command_Line is
Switch : String := "";
Long_Switch : String := "";
Help : String := "";
- Section : String := "");
+ Section : String := "";
+ Argument : String := "ARG");
-- Initialize [Def] with the contents of the other parameters.
-- This also checks consistency of the switch parameters, and will raise
-- Invalid_Switch if they do not match.
@@ -1280,11 +1281,12 @@ package body GNAT.Command_Line is
---------------------------
procedure Initialize_Switch_Def
- (Def : out Switch_Definition;
+ (Def : out Switch_Definition;
Switch : String := "";
Long_Switch : String := "";
Help : String := "";
- Section : String := "")
+ Section : String := "";
+ Argument : String := "ARG")
is
P1, P2 : Switch_Parameter_Type := Parameter_None;
Last1, Last2 : Integer;
@@ -1316,6 +1318,10 @@ package body GNAT.Command_Line is
Def.Section := new String'(Section);
end if;
+ if Argument /= "ARG" then
+ Def.Argument := new String'(Argument);
+ end if;
+
if Help /= "" then
Def.Help := new String'(Help);
end if;
@@ -1330,12 +1336,14 @@ package body GNAT.Command_Line is
Switch : String := "";
Long_Switch : String := "";
Help : String := "";
- Section : String := "")
+ Section : String := "";
+ Argument : String := "ARG")
is
Def : Switch_Definition;
begin
if Switch /= "" or else Long_Switch /= "" then
- Initialize_Switch_Def (Def, Switch, Long_Switch, Help, Section);
+ Initialize_Switch_Def
+ (Def, Switch, Long_Switch, Help, Section, Argument);
Add (Config, Def);
end if;
end Define_Switch;
@@ -1375,12 +1383,14 @@ package body GNAT.Command_Line is
Help : String := "";
Section : String := "";
Initial : Integer := 0;
- Default : Integer := 1)
+ Default : Integer := 1;
+ Argument : String := "ARG")
is
Def : Switch_Definition (Switch_Integer);
begin
if Switch /= "" or else Long_Switch /= "" then
- Initialize_Switch_Def (Def, Switch, Long_Switch, Help, Section);
+ Initialize_Switch_Def
+ (Def, Switch, Long_Switch, Help, Section, Argument);
Def.Integer_Output := Output.all'Unchecked_Access;
Def.Integer_Default := Default;
Def.Integer_Initial := Initial;
@@ -1398,12 +1408,14 @@ package body GNAT.Command_Line is
Switch : String := "";
Long_Switch : String := "";
Help : String := "";
- Section : String := "")
+ Section : String := "";
+ Argument : String := "ARG")
is
Def : Switch_Definition (Switch_String);
begin
if Switch /= "" or else Long_Switch /= "" then
- Initialize_Switch_Def (Def, Switch, Long_Switch, Help, Section);
+ Initialize_Switch_Def
+ (Def, Switch, Long_Switch, Help, Section, Argument);
Def.String_Output := Output.all'Unchecked_Access;
Add (Config, Def);
end if;
@@ -3206,17 +3218,31 @@ package body GNAT.Command_Line is
Decompose_Switch (Def.Long_Switch.all, P2, Last2);
Append (Result, ", "
& Def.Long_Switch (Def.Long_Switch'First .. Last2));
- Append (Result, Param_Name (P2, "ARG"));
+
+ if Def.Argument = null then
+ Append (Result, Param_Name (P2, "ARG"));
+ else
+ Append (Result, Param_Name (P2, Def.Argument.all));
+ end if;
else
- Append (Result, Param_Name (P1, "ARG"));
+ if Def.Argument = null then
+ Append (Result, Param_Name (P1, "ARG"));
+ else
+ Append (Result, Param_Name (P1, Def.Argument.all));
+ end if;
end if;
else -- Long_Switch necessarily not null
Decompose_Switch (Def.Long_Switch.all, P2, Last2);
Append (Result,
Def.Long_Switch (Def.Long_Switch'First .. Last2));
- Append (Result, Param_Name (P2, "ARG"));
+
+ if Def.Argument = null then
+ Append (Result, Param_Name (P2, "ARG"));
+ else
+ Append (Result, Param_Name (P2, Def.Argument.all));
+ end if;
end if;
end if;
@@ -3393,7 +3419,9 @@ package body GNAT.Command_Line is
Config.Switches (S).Integer_Initial;
when Switch_String =>
- Config.Switches (S).String_Output.all := new String'("");
+ if Config.Switches (S).String_Output.all = null then
+ Config.Switches (S).String_Output.all := new String'("");
+ end if;
end case;
end loop;