Commit 9acd1a9c by Arnaud Charlet

[multiple changes]

2010-10-12  Arnaud Charlet  <charlet@adacore.com>

	* g-comlin.adb (Foreach_Switch): Make this procedure generic to avoid
	using 'Access.

2010-10-12  Emmanuel Briot  <briot@adacore.com>

	* switch-m.adb: Allow building even in -gnat05 mode.

From-SVN: r165374
parent f16e8df9
2010-10-12 Arnaud Charlet <charlet@adacore.com>
* g-comlin.adb (Foreach_Switch): Make this procedure generic to avoid
using 'Access.
2010-10-12 Emmanuel Briot <briot@adacore.com>
* switch-m.adb: Allow building even in -gnat05 mode.
2010-10-12 Robert Dewar <dewar@adacore.com> 2010-10-12 Robert Dewar <dewar@adacore.com>
* debug.adb: Add comment. * debug.adb: Add comment.
......
...@@ -194,9 +194,10 @@ package body GNAT.Command_Line is ...@@ -194,9 +194,10 @@ package body GNAT.Command_Line is
-- Return True if the characters starting at Index in Type_Str are -- Return True if the characters starting at Index in Type_Str are
-- equivalent to Substring. -- equivalent to Substring.
generic
with function Callback (S : String; Index : Integer) return Boolean;
procedure Foreach_Switch procedure Foreach_Switch
(Config : Command_Line_Configuration; (Config : Command_Line_Configuration;
Callback : access function (S : String; Index : Integer) return Boolean;
Section : String); Section : String);
-- Iterate over all switches defined in Config, for a specific section. -- Iterate over all switches defined in Config, for a specific section.
-- Index is set to the index in Config.Switches -- Index is set to the index in Config.Switches
...@@ -1400,7 +1401,6 @@ package body GNAT.Command_Line is ...@@ -1400,7 +1401,6 @@ package body GNAT.Command_Line is
procedure Foreach_Switch procedure Foreach_Switch
(Config : Command_Line_Configuration; (Config : Command_Line_Configuration;
Callback : access function (S : String; Index : Integer) return Boolean;
Section : String) Section : String)
is is
begin begin
...@@ -1457,10 +1457,12 @@ package body GNAT.Command_Line is ...@@ -1457,10 +1457,12 @@ package body GNAT.Command_Line is
Tmp : Boolean; Tmp : Boolean;
pragma Unreferenced (Tmp); pragma Unreferenced (Tmp);
procedure Foreach is new Foreach_Switch (Add_Switch);
-- Start of processing for Get_Switches -- Start of processing for Get_Switches
begin begin
Foreach_Switch (Config, Add_Switch'Access, Section => Section); Foreach (Config, Section => Section);
-- Adding relevant aliases -- Adding relevant aliases
...@@ -1816,6 +1818,8 @@ package body GNAT.Command_Line is ...@@ -1816,6 +1818,8 @@ package body GNAT.Command_Line is
return True; return True;
end Analyze_Simple_Switch; end Analyze_Simple_Switch;
procedure Foreach is new Foreach_Switch (Analyze_Simple_Switch);
-- Start of processing for Group_Analysis -- Start of processing for Group_Analysis
begin begin
...@@ -1823,7 +1827,7 @@ package body GNAT.Command_Line is ...@@ -1823,7 +1827,7 @@ package body GNAT.Command_Line is
while Idx <= Group'Last loop while Idx <= Group'Last loop
Found := False; Found := False;
Foreach_Switch (Config, Analyze_Simple_Switch'Access, Section); Foreach (Config, Section);
if not Found then if not Found then
For_Each_Simple_Switch For_Each_Simple_Switch
...@@ -1945,13 +1949,16 @@ package body GNAT.Command_Line is ...@@ -1945,13 +1949,16 @@ package body GNAT.Command_Line is
return True; return True;
end Starts_With; end Starts_With;
procedure Foreach_In_Config is new Foreach_Switch (Is_In_Config);
procedure Foreach_Starts_With is new Foreach_Switch (Starts_With);
-- Start of processing for For_Each_Simple_Switch -- Start of processing for For_Each_Simple_Switch
begin begin
-- First determine if the switch corresponds to one belonging to the -- First determine if the switch corresponds to one belonging to the
-- configuration. If so, run callback and exit. -- configuration. If so, run callback and exit.
Foreach_Switch (Config, Is_In_Config'Access, Section); Foreach_In_Config (Config, Section);
if Found_In_Config then if Found_In_Config then
return; return;
...@@ -2024,7 +2031,7 @@ package body GNAT.Command_Line is ...@@ -2024,7 +2031,7 @@ package body GNAT.Command_Line is
and then Config.Switches /= null and then Config.Switches /= null
then then
Found_In_Config := False; Found_In_Config := False;
Foreach_Switch (Config, Starts_With'Access, Section); Foreach_Starts_With (Config, Section);
if Found_In_Config then if Found_In_Config then
return; return;
end if; end if;
......
...@@ -31,7 +31,9 @@ with Prj; use Prj; ...@@ -31,7 +31,9 @@ with Prj; use Prj;
with Prj.Env; use Prj.Env; with Prj.Env; use Prj.Env;
with Table; with Table;
pragma Warnings (Off, "*is an Ada 2012 unit");
with System.Multiprocessors; use System.Multiprocessors; with System.Multiprocessors; use System.Multiprocessors;
pragma Warnings (On, "*is an Ada 2012 unit");
package body Switch.M is package body Switch.M is
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment