if No (Prev) then
if No (Parameter_Associations (Call_Node)) then
Set_Parameter_Associations (Call_Node, New_List);
- Append (Insert_Param, Parameter_Associations (Call_Node));
end if;
+
+ Append (Insert_Param, Parameter_Associations (Call_Node));
+
else
Insert_After (Prev, Insert_Param);
end if;
-- passed in to it, then pass it in.
if Ekind_In (Subp, E_Function, E_Operator, E_Subprogram_Type)
- and then Present (Extra_Accessibility_Of_Result (Subp))
+ and then
+ Present (Extra_Accessibility_Of_Result (Ultimate_Alias (Subp)))
then
declare
Ancestor : Node_Id := Parent (Call_Node);
begin
-- Unimplemented: if Subp returns an anonymous access type, then
+
-- a) if the call is the operand of an explict conversion, then
-- the target type of the conversion (a named access type)
-- determines the accessibility level pass in;
+
-- b) if the call defines an access discriminant of an object
-- (e.g., the discriminant of an object being created by an
-- allocator, or the discriminant of a function result),
-- then the accessibility level to pass in is that of the
-- discriminated object being initialized).
+ -- ???
+
while Nkind (Ancestor) = N_Qualified_Expression
loop
Ancestor := Parent (Ancestor);
Scope_Depth (Current_Scope) + 1);
end if;
- Add_Extra_Actual (Level, Extra_Accessibility_Of_Result (Subp));
+ Add_Extra_Actual
+ (Level,
+ Extra_Accessibility_Of_Result (Ultimate_Alias (Subp)));
end if;
end;
end if;
-- ensure that the function result does not outlive an
-- object designated by one of it discriminants.
- if Ada_Version >= Ada_2012
+ if Present (Extra_Accessibility_Of_Result (Scope_Id))
and then Has_Unconstrained_Access_Discriminants (R_Type)
then
declare
return False;
end Has_Unconstrained_Access_Discriminant_Component;
+ Feature_Disabled : constant Boolean := True;
+ -- Temporary
+
-- Start of processing for Needs_Result_Accessibility_Level
begin
if not Present (Func_Typ) then
return False;
+ elsif Feature_Disabled then
+ return False;
+
-- False if not a function, also handle enum-lit renames case
elsif Func_Typ = Standard_Void_Type
(Config : in out Command_Line_Configuration;
Switch : Switch_Definition);
procedure Add
- (Def : in out Alias_Definitions_List;
- Alias : Alias_Definition);
- -- Add a new element to Def.
+ (Def : in out Alias_Definitions_List;
+ Alias : Alias_Definition);
+ -- Add a new element to Def
procedure Initialize_Switch_Def
(Def : out Switch_Definition;
for J in S'Range loop
if S (J) in 'A' .. 'Z' then
S (J) := Character'Val
- (Character'Pos (S (J)) +
- Character'Pos ('a') -
- Character'Pos ('A'));
+ (Character'Pos (S (J)) +
+ (Character'Pos ('a') - Character'Pos ('A')));
end if;
end loop;
end if;
-- go to the next level.
elsif Is_Directory
- (It.Dir_Name (1 .. It.Levels (Current).Name_Last) & S (1 .. Last))
+ (It.Dir_Name (1 .. It.Levels (Current).Name_Last) &
+ S (1 .. Last))
and then S (1 .. Last) /= "."
and then S (1 .. Last) /= ".."
then
loop
Parser.Current_Argument := Parser.Current_Argument + 1;
end loop;
+
else
return String'(1 .. 0 => ' ');
end if;
Length := Length + 1;
end loop;
- -- Length now marks the separator after the current switch
- -- Last will mark the last character of the name of the switch
+ -- Length now marks the separator after the current switch. Last will
+ -- mark the last character of the name of the switch.
if Length = Index + 1 then
P := Parameter_None;
-- If we have finished parsing the current command line item (there
-- might be multiple switches in a single item), then go to the next
- -- element
+ -- element.
if Parser.Current_Argument > Parser.Arg_Count
or else (Parser.Current_Index >
-- If it isn't a switch, return it immediately. We also know it
-- isn't the parameter to a previous switch, since that has
- -- already been handled
+ -- already been handled.
if Switches (Switches'First) = '*' then
Set_Parameter
First => End_Index + 2,
Last => Arg'Last);
Dummy := Goto_Next_Argument_In_Section (Parser);
+
else
Parser.Current_Index := End_Index + 1;
raise Invalid_Parameter;
Parser.Stop_At_First := Stop_At_First_Non_Switch;
Parser.Section := (others => 1);
- -- If we are using sections, we have to preprocess the command line
- -- to delimit them. A section can be repeated, so we just give each
- -- item on the command line a section number
+ -- If we are using sections, we have to preprocess the command line to
+ -- delimit them. A section can be repeated, so we just give each item
+ -- on the command line a section number
Section_Num := 1;
Section_Index := Section_Delimiters'First;
if Argument (Parser, Index)(1) = Parser.Switch_Character
and then
Argument (Parser, Index) = Parser.Switch_Character &
- Section_Delimiters
- (Section_Index .. Last - 1)
+ Section_Delimiters
+ (Section_Index .. Last - 1)
then
Parser.Section (Index) := 0;
Delimiter_Found := True;
----------
procedure Free (Parser : in out Opt_Parser) is
- procedure Unchecked_Free is new Ada.Unchecked_Deallocation
- (Opt_Parser_Data, Opt_Parser);
+ procedure Unchecked_Free is new
+ Ada.Unchecked_Deallocation (Opt_Parser_Data, Opt_Parser);
begin
if Parser /= null
and then Parser /= Command_Line_Parser
-- Add --
---------
- procedure Add (Config : in out Command_Line_Configuration;
- Switch : Switch_Definition)
+ procedure Add
+ (Config : in out Command_Line_Configuration;
+ Switch : Switch_Definition)
is
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(Switch_Definitions, Switch_Definitions_List);
+
Tmp : Switch_Definitions_List;
begin
procedure Add (Def : in out Alias_Definitions_List;
Alias : Alias_Definition)
is
- procedure Unchecked_Free is new Ada.Unchecked_Deallocation
- (Alias_Definitions, Alias_Definitions_List);
+ procedure Unchecked_Free is new
+ Ada.Unchecked_Deallocation
+ (Alias_Definitions, Alias_Definitions_List);
+
Tmp : Alias_Definitions_List := Def;
begin
if (Section = "" and then Config.Switches (J).Section = null)
or else
(Config.Switches (J).Section /= null
- and then Config.Switches (J).Section.all = Section)
+ and then Config.Switches (J).Section.all = Section)
then
exit when Config.Switches (J).Switch /= null
and then not Callback (Config.Switches (J).Switch.all, J);
else
Append (Ret, " " & S);
end if;
+
return True;
end Add_Switch;
function Is_In_Config
(Config_Switch : String; Index : Integer) return Boolean;
-- If Switch is the same as Config_Switch, run the callback and sets
- -- Found_In_Config to True
+ -- Found_In_Config to True.
function Starts_With
(Config_Switch : String; Index : Integer) return Boolean;
-- if Switch starts with Config_Switch, sets Found_In_Config to True.
- -- The return value is for the Foreach_Switch iterator
+ -- The return value is for the Foreach_Switch iterator.
--------------------
-- Group_Analysis --
end loop;
end if;
- if not Require_Parameter (Switch)
- or else Last >= Param
- then
+ if not Require_Parameter (Switch) or else Last >= Param then
if Idx = Group'First
and then Last = Group'Last
and then Last < Param
Section,
Prefix & Group (Idx .. Param - 1),
Group (Param .. Last));
+
else
For_Each_Simple_Switch
(Config, Section, Prefix & Group (Idx .. Last), "");
Idx := Group'First;
while Idx <= Group'Last loop
Found := False;
-
Foreach (Config, Section);
if not Found then
Decompose_Switch (Config_Switch, P, Last);
if Looking_At
- (Switch, Switch'First, Config_Switch (Config_Switch'First .. Last))
+ (Switch, Switch'First,
+ Config_Switch (Config_Switch'First .. Last))
then
-- Set first char of Param, and last char of Switch
if Result (C) /= null
and then Compatible_Parameter (Params (C))
and then Looking_At
- (Result (C).all, Result (C)'First, Cmd.Config.Prefixes (P).all)
+ (Result (C).all,
+ Result (C)'First,
+ Cmd.Config.Prefixes (P).all)
then
-- If we are still in the same section, group the switches
Group :=
Ada.Strings.Unbounded.To_Unbounded_String
(Result (C)
- (Result (C)'First + Cmd.Config.Prefixes (P)'Length ..
- Result (C)'Last));
+ (Result (C)'First + Cmd.Config.Prefixes (P)'Length ..
+ Result (C)'Last));
First := C;
end if;
end if;
if Result (E) /= null
and then
(Params (E) = null
- or else Params (E) (Params (E)'First + 1
- .. Params (E)'Last) = Param)
+ or else Params (E) (Params (E)'First + 1 ..
+ Params (E)'Last) = Param)
and then Result (E).all = Switch
then
return;
function Is_New_Section (Iter : Command_Line_Iterator) return Boolean is
Section : constant String := Current_Section (Iter);
+
begin
if Iter.Sections = null then
return False;
+
elsif Iter.Current = Iter.Sections'First
or else Iter.Sections (Iter.Current - 1) = null
then
return Section /= "";
- end if;
- return Section /= Iter.Sections (Iter.Current - 1).all;
+ else
+ return Section /= Iter.Sections (Iter.Current - 1).all;
+ end if;
end Is_New_Section;
---------------------
return "";
else
+ -- Return result, skipping separator
+
declare
P : constant String := Iter.Params (Iter.Current).all;
-
begin
- -- Skip separator
-
return P (P'First + 1 .. P'Last);
end;
end if;
----------
procedure Free (Config : in out Command_Line_Configuration) is
- procedure Unchecked_Free is new Ada.Unchecked_Deallocation
- (Switch_Definitions, Switch_Definitions_List);
- procedure Unchecked_Free is new Ada.Unchecked_Deallocation
- (Alias_Definitions, Alias_Definitions_List);
+ procedure Unchecked_Free is new
+ Ada.Unchecked_Deallocation
+ (Switch_Definitions, Switch_Definitions_List);
+
+ procedure Unchecked_Free is new
+ Ada.Unchecked_Deallocation
+ (Alias_Definitions, Alias_Definitions_List);
+
begin
if Config /= null then
Free (Config.Prefixes);
Free (Config.Aliases (A).Expansion);
Free (Config.Aliases (A).Section);
end loop;
+
Unchecked_Free (Config.Aliases);
end if;
Free (Config.Usage);
Free (Config.Help);
Free (Config.Help_Msg);
+
Config.Usage := new String'(Usage);
Config.Help := new String'(Help);
Config.Help_Msg := new String'(Help_Msg);
procedure Display_Section_Help (Section : String) is
Max_Len : Natural := 0;
+
begin
-- ??? Special display for "*"
for S in Config.Switches'Range loop
declare
N : constant String :=
- Switch_Name (Config.Switches (S), Section);
+ Switch_Name (Config.Switches (S), Section);
+
begin
if N /= "" then
Put (" ");
if (Section = "" and then Def.Section = null)
or else (Def.Section /= null and then Def.Section.all = Section)
then
- if Def.Switch /= null
- and then Def.Switch.all = "*"
- then
+ if Def.Switch /= null and then Def.Switch.all = "*" then
return "[any switch]";
end if;
if Config.Help_Msg /= null and then Config.Help_Msg.all /= "" then
Put_Line (Config.Help_Msg.all);
+
else
Display_Section_Help ("");
+
if Config.Sections /= null and then Config.Switches /= null then
for S in Config.Sections'Range loop
Display_Section_Help (Config.Sections (S).all);
elsif C /= ASCII.NUL then
if Full_Switch (Parser) = "h"
- or else Full_Switch (Parser) = "-help"
+ or else
+ Full_Switch (Parser) = "-help"
then
Display_Help (Config);
raise Exit_From_Command_Line;
end if;
-- Do switch expansion if needed
+
For_Each_Simple
(Config,
Section => Section_Name.all,
Start (Line, Iter, Expanded => Expanded);
while Has_More (Iter) loop
if Is_New_Section (Iter) then
- Args (Count) := new String'
- (Switch_Char & Current_Section (Iter));
+ Args (Count) := new String'(Switch_Char & Current_Section (Iter));
Count := Count + 1;
end if;