aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/g-comlin.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2012-05-15 11:26:48 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2012-05-15 11:26:48 +0200
commitdb664118be5bc2ea3e04784d45da659b13af1ef8 (patch)
treef379d457c02670132f951efa9f8c06c306d1a80b /gcc/ada/g-comlin.adb
parenta02f0c5dfa9246a57970aeefe5c7196a17bf7b1c (diff)
downloadgcc-db664118be5bc2ea3e04784d45da659b13af1ef8.zip
gcc-db664118be5bc2ea3e04784d45da659b13af1ef8.tar.gz
gcc-db664118be5bc2ea3e04784d45da659b13af1ef8.tar.bz2
[multiple changes]
2012-05-15 Hristian Kirtchev <kirtchev@adacore.com> * a-calend.adb (Day_Of_Week): The routine once again treats all dates as historic. (Formatting_Operations.Split): All calls to UTC_Time_Offset are now controlled through formal parameter Is_Historic. (Formatting_Operations.Time_Of): All calls to UTC_Time_Offset are now handled through formal parameter Is_Historic. (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. (To_Ada_Time): Update the call to Formatting_Operations.Time_Of. (To_Strict_Tm): Update the call to Formatting_Operations.Split. * a-calend.ads (Split): Add new formal Is_Historic along with comment on usage. This routine is now exported for the purposes of GNAT.Calendar.Locale. (Time_Of): Remove defaults. Add new formal Is_Historic along with comment on usage. This routine is now exported for the purposes of GNAT.Calendar.Locale. * a-calend-vms.adb (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. * a-calend-vms.ads (Split): Add new formal Is_Historic along with comment on usage. (Time_Of): Remove defaults. Add new formal Is_Historic along with comment on usage. * a-calfor.adb (Split): Update the call to Formatting_Operations.Split. (Time_Of): Update the call to Formatting_Operations.Time_Of. * impunit.adb: Include g-calloc to the list of non-RM defined units. 2012-05-15 Vincent Celier <celier@adacore.com> * prj-nmsc.adb (Add_Source): Always add the source if it is excluded, to avoid incorrect duplicate checks. 2012-05-15 Yannick Moy <moy@adacore.com> * sem_aux.ads: Correct typo. * sem_eval.adb (Compile_Time_Known_Value): Return False in Alfa mode for a deferred constant when outside of the scope of its full view. 2012-05-15 Emmanuel Briot <briot@adacore.com> * g-comlin.adb, g-comlin.ads (Define_Switch): Allow specifying the name of the argument, for the automatic help message. (Getopt): do not systematically initialize switches with string values to the empty string, when the user has already specified a default. From-SVN: r187504
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;