diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-05-15 09:29:46 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-05-15 09:29:46 +0000 |
commit | 7413d80df0db9a5082f700e04318b9d639f10b5c (patch) | |
tree | 4a1bddd2f4929ab05a86932cff22860124f1fb69 /gcc/ada/g-comlin.ads | |
parent | f74ffaae4fc78497c6bf3edb8c5ea7d3ae90d8cb (diff) | |
download | gcc-7413d80df0db9a5082f700e04318b9d639f10b5c.tar.gz |
2012-05-15 Robert Dewar <dewar@adacore.com>
* g-comlin.adb, g-comlin.ads: Minor reformatting.
2012-05-15 Vincent Pucci <pucci@adacore.com>
* aspects.adb, aspects.adb: Reordering of the Aspect_Idi list. New
aspect Aspect_Lock_Free.
* einfo.adb, einfo.ads: New flag Uses_Lock_Free (flag 188).
(Set_Uses_Lock_Free): New routine.
(Uses_Lock_Free): New routine.
* exp_ch7.adb (Is_Simple_Protected_Type): Return False for
lock-free implementation.
* exp_ch9.adb (Allows_Lock_Free_Implementation): Moved to Sem_Ch9.
(Build_Lock_Free_Unprotected_Subprogram_Body): Protected
procedure uses __sync_synchronise. Check both Object_Size
and Value_Size.
(Expand_N_Protected_Body): Lock_Free_Active
renames Lock_Free_On.
(Expand_N_Protected_Type_Declaration):
_Object field removed for lock-free implementation.
(Install_Private_Data_Declarations): Protection object removed
for lock-free implementation.
(Make_Initialize_Protection):
Protection object initialization removed for lock-free implementation.
* rtsfind.ads: RE_Atomic_Synchronize and RE_Relaxed added.
* sem_ch13.adb (Analyze_Aspect_Specifications): Aspect_Lock_Free
analysis added.
* sem_ch9.adb (Allows_Lock_Free_Implementation): New routine.
(Analyze_Protected_Body): Allows_Lock_Free_Implementation call added.
(Analyze_Protected_Type_Declaration):
Allows_Lock_Free_Implementation call added.
(Analyze_Single_Protected_Declaration): Second analysis of
aspects removed.
* s-atopri.ads: Header added.
(Atomic_Synchronize): New routine.
2012-05-15 Robert Dewar <dewar@adacore.com>
* exp_ch7.ads: Add comment.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@187505 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/g-comlin.ads')
-rw-r--r-- | gcc/ada/g-comlin.ads | 92 |
1 files changed, 49 insertions, 43 deletions
diff --git a/gcc/ada/g-comlin.ads b/gcc/ada/g-comlin.ads index c3479bbfb42..c4b290e5567 100644 --- a/gcc/ada/g-comlin.ads +++ b/gcc/ada/g-comlin.ads @@ -181,16 +181,20 @@ -- ... -- Specifying the help message is optional, but makes it easy to then call --- the function +-- the function: + -- Display_Help (Config); + -- that will display a properly formatted help message for your application, -- listing all possible switches. That way you have a single place in which -- to maintain the list of switches and their meaning, rather than maintaining -- both the string to pass to Getopt and a subprogram to display the help. -- Both will properly stay synchronized. --- Once you have this Config, you just have to call +-- Once you have this Config, you just have to call: + -- Getopt (Config, Callback'Access); + -- to parse the command line. The Callback will be called for each switch -- found on the command line (in the case of our example, that is "-gnatwu" -- and then "-gnatwv", not "-gnatwa" itself). This simplifies command line @@ -203,13 +207,13 @@ -- Optimization : aliased Integer; -- Verbose : aliased Boolean; --- + -- Define_Switch (Config, Verbose'Access, -- "-v", Long_Switch => "--verbose", -- Help => "Output extra verbose information"); -- Define_Switch (Config, Optimization'Access, -- "-O?", Help => "Optimization level"); --- + -- Getopt (Config); -- No callback -- Since all switches are handled automatically, we don't even need to pass @@ -263,8 +267,8 @@ -- Some command line arguments can have parameters, which on a command line -- appear as a separate argument that must immediately follow the switch. -- Since the subprograms in this package will reorganize the switches to group --- them, you need to indicate what is a command line --- parameter, and what is a switch argument. +-- them, you need to indicate what is a command line parameter, and what is a +-- switch argument. -- This is done by passing an extra argument to Add_Switch, as in: @@ -308,18 +312,18 @@ package GNAT.Command_Line is Stop_At_First_Non_Switch : Boolean := False; Section_Delimiters : String := ""); -- The first procedure resets the internal state of the package to prepare - -- to rescan the parameters. It does not need to be called before the first - -- use of Getopt (but it could be), but it must be called if you want to - -- start rescanning the command line parameters from the start. The - -- optional parameter Switch_Char can be used to reset the switch + -- to rescan the parameters. It does not need to be called before the + -- first use of Getopt (but it could be), but it must be called if you + -- want to start rescanning the command line parameters from the start. + -- The optional parameter Switch_Char can be used to reset the switch -- character, e.g. to '/' for use in DOS-like systems. -- - -- The second subprogram initializes a parser that takes its arguments from - -- an array of strings rather than directly from the command line. In this - -- case, the parser is responsible for freeing the strings stored in + -- The second subprogram initializes a parser that takes its arguments + -- from an array of strings rather than directly from the command line. In + -- this case, the parser is responsible for freeing the strings stored in -- Command_Line. If you pass null to Command_Line, this will in fact create -- a second parser for Ada.Command_Line, which doesn't share any data with - -- the default parser. This parser must be free-ed. + -- the default parser. This parser must be free'ed. -- -- The optional parameter Stop_At_First_Non_Switch indicates if Getopt is -- to look for switches on the whole command line, or if it has to stop as @@ -451,9 +455,9 @@ package GNAT.Command_Line is -- spaces. -- -- Example - -- Getopt ("a b", Concatenate => False) - -- If the command line is '-ab', exception Invalid_Switch will be - -- raised and Full_Switch will return "ab". + -- Getopt ("a b", Concatenate => False) + -- If the command line is '-ab', exception Invalid_Switch will be + -- raised and Full_Switch will return "ab". function Get_Argument (Do_Expansion : Boolean := False; @@ -559,8 +563,8 @@ package GNAT.Command_Line is -- The section name should not include the leading '-'. So for instance in -- the case of gnatmake we would use: -- - -- Define_Section (Config, "cargs"); - -- Define_Section (Config, "bargs"); + -- Define_Section (Config, "cargs"); + -- Define_Section (Config, "bargs"); procedure Define_Alias (Config : in out Command_Line_Configuration; @@ -609,9 +613,9 @@ package GNAT.Command_Line is -- -- Switch and Long_Switch (when specified) are aliases and can be used -- interchangeably. There is no check that they both take an argument or - -- both take no argument. - -- Switch can be set to "*" to indicate that any switch is supported (in - -- which case Getopt will return '*', see its documentation). + -- both take no argument. Switch can be set to "*" to indicate that any + -- switch is supported (in which case Getopt will return '*', see its + -- documentation). -- -- Help is used by the Display_Help procedure to describe the supported -- switches. @@ -633,11 +637,13 @@ package GNAT.Command_Line is -- See Define_Switch for a description of the parameters. -- When the switch is found on the command line, Getopt will set -- Output.all to Value. + -- -- Output is always initially set to "not Value", so that if the switch is -- not found on the command line, Output still has a valid value. -- The switch must not take any parameter. - -- Output must exist at least as long as Config, otherwise erroneous memory - -- access may happen. + -- + -- Output must exist at least as long as Config, otherwise an erroneous + -- memory access may occur. procedure Define_Switch (Config : in out Command_Line_Configuration; @@ -649,14 +655,14 @@ package GNAT.Command_Line is Initial : Integer := 0; Default : Integer := 1; Argument : String := "ARG"); - -- See Define_Switch for a description of the parameters. - -- When the switch is found on the command line, Getopt will set - -- Output.all to the value of the switch's parameter. If the parameter is - -- not an integer, Invalid_Parameter is raised. + -- See Define_Switch for a description of the parameters. When the + -- switch is found on the command line, Getopt will set Output.all to the + -- value of the switch's parameter. If the parameter is not an integer, + -- Invalid_Parameter is raised. + -- Output is always initialized to Initial. If the switch has an optional -- argument which isn't specified by the user, then Output will be set to - -- Default. - -- The switch must accept an argument. + -- Default. The switch must accept an argument. procedure Define_Switch (Config : in out Command_Line_Configuration; @@ -667,11 +673,10 @@ package GNAT.Command_Line is Section : String := ""; Argument : String := "ARG"); -- Set Output to the value of the switch's parameter when the switch is - -- found on the command line. - -- Output is always initialized to the empty string if it does not have - -- a value already (otherwise it is left as is so that you can specify the - -- default value directly in the declaration of the variable). - -- The switch must accept an argument. + -- found on the command line. Output is always initialized to the empty + -- string if it does not have a value already (otherwise it is left as is + -- so that you can specify the default value directly in the declaration + -- of the variable). The switch must accept an argument. procedure Set_Usage (Config : in out Command_Line_Configuration; @@ -705,15 +710,14 @@ package GNAT.Command_Line is (Switch : String; Parameter : String; Section : String); - -- Called when a switch is found on the command line. - -- [Switch] includes any leading '-' that was specified in Define_Switch. - -- This is slightly different from the functional version of Getopt above, - -- for which Full_Switch omits the first leading '-'. + -- Called when a switch is found on the command line. Switch includes + -- any leading '-' that was specified in Define_Switch. This is slightly + -- different from the functional version of Getopt above, for which + -- Full_Switch omits the first leading '-'. Exit_From_Command_Line : exception; - -- Emitted when the program should exit. - -- This is called when Getopt below has seen -h, --help or an invalid - -- switch. + -- Emitted when the program should exit. This is called when Getopt below + -- has seen -h, --help or an invalid switch. procedure Getopt (Config : Command_Line_Configuration; @@ -823,7 +827,7 @@ package GNAT.Command_Line is -- If the command line has sections (such as -bargs -cargs), then they -- should be listed in the Sections parameter (as "-bargs -cargs"). -- - -- This function can be used to reset Cmd by passing an empty string. + -- This function can be used to reset Cmd by passing an empty string -- -- If an invalid switch is found on the command line (ie wasn't defined in -- the configuration via Define_Switch), and the configuration wasn't set @@ -947,6 +951,7 @@ package GNAT.Command_Line is --------------- -- Iteration -- --------------- + -- When a command line was created with the above, you can then iterate -- over its contents using the following iterator. @@ -992,6 +997,7 @@ package GNAT.Command_Line is -- create an Opt_Parser. -- -- Args must be freed by the caller. + -- -- Expanded has the same meaning as in Start. private |