Commit ea2af26a by Arnaud Charlet

[multiple changes]

2012-07-30  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_ch12.adb (Earlier): Add local variables T1 and T2. Minor code
	refactoring.

2012-07-30  Thomas Quinot  <quinot@adacore.com>

	* gnatcmd.adb, make.adb, makeutl.adb, makeutl.ads
	(Test_If_Relative_Path): Rename to Ensure_Absolute_Path to better
	reflect what this subprogram does. Rename argument Including_L_Switch
	to For_Gnatbind, and also exempt -A from rewriting.
	* bindusg.adb: Document optional =file argument to gnatbind -A.

2012-07-30  Ed Schonberg  <schonberg@adacore.com>

	* freeze.adb (Freeze_Entity): Do no apply restriction check on
	storage pools to access to subprogram types.

From-SVN: r189978
parent 29ba9f52
2012-07-30 Hristian Kirtchev <kirtchev@adacore.com>
* sem_ch12.adb (Earlier): Add local variables T1 and T2. Minor code
refactoring.
2012-07-30 Thomas Quinot <quinot@adacore.com>
* gnatcmd.adb, make.adb, makeutl.adb, makeutl.ads
(Test_If_Relative_Path): Rename to Ensure_Absolute_Path to better
reflect what this subprogram does. Rename argument Including_L_Switch
to For_Gnatbind, and also exempt -A from rewriting.
* bindusg.adb: Document optional =file argument to gnatbind -A.
2012-07-30 Ed Schonberg <schonberg@adacore.com>
* freeze.adb (Freeze_Entity): Do no apply restriction check on
storage pools to access to subprogram types.
2012-07-30 Robert Dewar <dewar@adacore.com> 2012-07-30 Robert Dewar <dewar@adacore.com>
* par_sco.adb, a-cihama.adb, a-coinve.adb, exp_ch7.adb, a-ciorse.adb, * par_sco.adb, a-cihama.adb, a-coinve.adb, exp_ch7.adb, a-ciorse.adb,
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2011, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -78,7 +78,7 @@ package body Bindusg is ...@@ -78,7 +78,7 @@ package body Bindusg is
-- Line for -A switch -- Line for -A switch
Write_Line (" -A Give list of ALI files in partition"); Write_Line (" -A[=file] Give list of ALI files in partition");
-- Line for -b switch -- Line for -b switch
......
...@@ -4201,12 +4201,16 @@ package body Freeze is ...@@ -4201,12 +4201,16 @@ package body Freeze is
Check_Suspicious_Modulus (E); Check_Suspicious_Modulus (E);
end if; end if;
elsif Is_Access_Type (E) then elsif Is_Access_Type (E)
and then not Is_Access_Subprogram_Type (E)
then
-- If a pragma Default_Storage_Pool applies, and this type has no -- If a pragma Default_Storage_Pool applies, and this type has no
-- Storage_Pool or Storage_Size clause (which must have occurred -- Storage_Pool or Storage_Size clause (which must have occurred
-- before the freezing point), then use the default. This applies -- before the freezing point), then use the default. This applies
-- only to base types. -- only to base types.
-- None of this applies to access to subprogramss, for which there
-- are clearly no pools.
if Present (Default_Pool) if Present (Default_Pool)
and then Is_Base_Type (E) and then Is_Base_Type (E)
......
...@@ -273,7 +273,7 @@ procedure GNATCmd is ...@@ -273,7 +273,7 @@ procedure GNATCmd is
-- Add the -L and -l switches to the linker for all of the library -- Add the -L and -l switches to the linker for all of the library
-- projects. -- projects.
procedure Test_If_Relative_Path procedure Ensure_Absolute_Path
(Switch : in out String_Access; (Switch : in out String_Access;
Parent : String); Parent : String);
-- Test if Switch is a relative search path switch. If it is and it -- Test if Switch is a relative search path switch. If it is and it
...@@ -1303,20 +1303,20 @@ procedure GNATCmd is ...@@ -1303,20 +1303,20 @@ procedure GNATCmd is
end Set_Library_For; end Set_Library_For;
--------------------------- ---------------------------
-- Test_If_Relative_Path -- -- Ensure_Absolute_Path --
--------------------------- ---------------------------
procedure Test_If_Relative_Path procedure Ensure_Absolute_Path
(Switch : in out String_Access; (Switch : in out String_Access;
Parent : String) Parent : String)
is is
begin begin
Makeutl.Test_If_Relative_Path Makeutl.Ensure_Absolute_Path
(Switch, Parent, (Switch, Parent,
Do_Fail => Osint.Fail'Access, Do_Fail => Osint.Fail'Access,
Including_Non_Switch => False, Including_Non_Switch => False,
Including_RTS => True); Including_RTS => True);
end Test_If_Relative_Path; end Ensure_Absolute_Path;
------------------- -------------------
-- Non_VMS_Usage -- -- Non_VMS_Usage --
...@@ -2387,7 +2387,7 @@ begin ...@@ -2387,7 +2387,7 @@ begin
-- arguments. -- arguments.
for J in 1 .. Last_Switches.Last loop for J in 1 .. Last_Switches.Last loop
GNATCmd.Test_If_Relative_Path GNATCmd.Ensure_Absolute_Path
(Last_Switches.Table (J), Current_Work_Dir); (Last_Switches.Table (J), Current_Work_Dir);
end loop; end loop;
...@@ -2397,7 +2397,7 @@ begin ...@@ -2397,7 +2397,7 @@ begin
Project_Dir : constant String := Name_Buffer (1 .. Name_Len); Project_Dir : constant String := Name_Buffer (1 .. Name_Len);
begin begin
for J in 1 .. First_Switches.Last loop for J in 1 .. First_Switches.Last loop
GNATCmd.Test_If_Relative_Path GNATCmd.Ensure_Absolute_Path
(First_Switches.Table (J), Project_Dir); (First_Switches.Table (J), Project_Dir);
end loop; end loop;
end; end;
......
...@@ -2366,7 +2366,7 @@ package body Make is ...@@ -2366,7 +2366,7 @@ package body Make is
Last_New := Last_New + 1; Last_New := Last_New + 1;
New_Args (Last_New) := New_Args (Last_New) :=
new String'(Name_Buffer (1 .. Name_Len)); new String'(Name_Buffer (1 .. Name_Len));
Test_If_Relative_Path Ensure_Absolute_Path
(New_Args (Last_New), (New_Args (Last_New),
Do_Fail => Make_Failed'Access, Do_Fail => Make_Failed'Access,
Parent => Dir_Path, Parent => Dir_Path,
...@@ -2399,7 +2399,7 @@ package body Make is ...@@ -2399,7 +2399,7 @@ package body Make is
Directory.Display_Name); Directory.Display_Name);
begin begin
Test_If_Relative_Path Ensure_Absolute_Path
(New_Args (1), (New_Args (1),
Do_Fail => Make_Failed'Access, Do_Fail => Make_Failed'Access,
Parent => Dir_Path, Parent => Dir_Path,
...@@ -5028,36 +5028,36 @@ package body Make is ...@@ -5028,36 +5028,36 @@ package body Make is
Get_Name_String (Main_Project.Directory.Display_Name); Get_Name_String (Main_Project.Directory.Display_Name);
begin begin
for J in 1 .. Binder_Switches.Last loop for J in 1 .. Binder_Switches.Last loop
Test_If_Relative_Path Ensure_Absolute_Path
(Binder_Switches.Table (J), (Binder_Switches.Table (J),
Do_Fail => Make_Failed'Access, Do_Fail => Make_Failed'Access,
Parent => Dir_Path, Including_L_Switch => False); Parent => Dir_Path, For_Gnatbind => True);
end loop; end loop;
for J in 1 .. Saved_Binder_Switches.Last loop for J in 1 .. Saved_Binder_Switches.Last loop
Test_If_Relative_Path Ensure_Absolute_Path
(Saved_Binder_Switches.Table (J), (Saved_Binder_Switches.Table (J),
Do_Fail => Make_Failed'Access, Do_Fail => Make_Failed'Access,
Parent => Current_Work_Dir, Parent => Current_Work_Dir,
Including_L_Switch => False); For_Gnatbind => True);
end loop; end loop;
for J in 1 .. Linker_Switches.Last loop for J in 1 .. Linker_Switches.Last loop
Test_If_Relative_Path Ensure_Absolute_Path
(Linker_Switches.Table (J), (Linker_Switches.Table (J),
Parent => Dir_Path, Parent => Dir_Path,
Do_Fail => Make_Failed'Access); Do_Fail => Make_Failed'Access);
end loop; end loop;
for J in 1 .. Saved_Linker_Switches.Last loop for J in 1 .. Saved_Linker_Switches.Last loop
Test_If_Relative_Path Ensure_Absolute_Path
(Saved_Linker_Switches.Table (J), (Saved_Linker_Switches.Table (J),
Do_Fail => Make_Failed'Access, Do_Fail => Make_Failed'Access,
Parent => Current_Work_Dir); Parent => Current_Work_Dir);
end loop; end loop;
for J in 1 .. Gcc_Switches.Last loop for J in 1 .. Gcc_Switches.Last loop
Test_If_Relative_Path Ensure_Absolute_Path
(Gcc_Switches.Table (J), (Gcc_Switches.Table (J),
Do_Fail => Make_Failed'Access, Do_Fail => Make_Failed'Access,
Parent => Dir_Path, Parent => Dir_Path,
...@@ -5065,7 +5065,7 @@ package body Make is ...@@ -5065,7 +5065,7 @@ package body Make is
end loop; end loop;
for J in 1 .. Saved_Gcc_Switches.Last loop for J in 1 .. Saved_Gcc_Switches.Last loop
Test_If_Relative_Path Ensure_Absolute_Path
(Saved_Gcc_Switches.Table (J), (Saved_Gcc_Switches.Table (J),
Parent => Current_Work_Dir, Parent => Current_Work_Dir,
Do_Fail => Make_Failed'Access, Do_Fail => Make_Failed'Access,
...@@ -5387,14 +5387,14 @@ package body Make is ...@@ -5387,14 +5387,14 @@ package body Make is
Get_Name_String (Main_Project.Directory.Display_Name); Get_Name_String (Main_Project.Directory.Display_Name);
begin begin
for J in Last_Binder_Switch + 1 .. Binder_Switches.Last loop for J in Last_Binder_Switch + 1 .. Binder_Switches.Last loop
Test_If_Relative_Path Ensure_Absolute_Path
(Binder_Switches.Table (J), (Binder_Switches.Table (J),
Do_Fail => Make_Failed'Access, Do_Fail => Make_Failed'Access,
Parent => Dir_Path, Including_L_Switch => False); Parent => Dir_Path, For_Gnatbind => True);
end loop; end loop;
for J in Last_Linker_Switch + 1 .. Linker_Switches.Last loop for J in Last_Linker_Switch + 1 .. Linker_Switches.Last loop
Test_If_Relative_Path Ensure_Absolute_Path
(Linker_Switches.Table (J), (Linker_Switches.Table (J),
Parent => Dir_Path, Parent => Dir_Path,
Do_Fail => Make_Failed'Access); Do_Fail => Make_Failed'Access);
......
...@@ -1316,11 +1316,12 @@ package body Makeutl is ...@@ -1316,11 +1316,12 @@ package body Makeutl is
-- Object files and -L switches specified with relative -- Object files and -L switches specified with relative
-- paths must be converted to absolute paths. -- paths must be converted to absolute paths.
Test_If_Relative_Path Ensure_Absolute_Path
(Switch => Linker_Options_Buffer (Last_Linker_Option), (Switch =>
Parent => Dir_Path, Linker_Options_Buffer (Last_Linker_Option),
Do_Fail => Do_Fail, Parent => Dir_Path,
Including_L_Switch => True); Do_Fail => Do_Fail,
For_Gnatbind => False);
end if; end if;
Options := In_Tree.Shared.String_Elements.Table (Options).Next; Options := In_Tree.Shared.String_Elements.Table (Options).Next;
...@@ -1936,14 +1937,14 @@ package body Makeutl is ...@@ -1936,14 +1937,14 @@ package body Makeutl is
end Path_Or_File_Name; end Path_Or_File_Name;
--------------------------- ---------------------------
-- Test_If_Relative_Path -- -- Ensure_Absolute_Path --
--------------------------- ---------------------------
procedure Test_If_Relative_Path procedure Ensure_Absolute_Path
(Switch : in out String_Access; (Switch : in out String_Access;
Parent : String; Parent : String;
Do_Fail : Fail_Proc; Do_Fail : Fail_Proc;
Including_L_Switch : Boolean := True; For_Gnatbind : Boolean := False;
Including_Non_Switch : Boolean := True; Including_Non_Switch : Boolean := True;
Including_RTS : Boolean := False) Including_RTS : Boolean := False)
is is
...@@ -1958,9 +1959,10 @@ package body Makeutl is ...@@ -1958,9 +1959,10 @@ package body Makeutl is
if Sw (1) = '-' then if Sw (1) = '-' then
if Sw'Length >= 3 if Sw'Length >= 3
and then (Sw (2) = 'A' and then (Sw (2) = 'I'
or else Sw (2) = 'I' or else (not For_Gnatbind
or else (Including_L_Switch and then Sw (2) = 'L')) and then (Sw (2) = 'L'
or else Sw (2) = 'A')))
then then
Start := 3; Start := 3;
...@@ -1973,7 +1975,9 @@ package body Makeutl is ...@@ -1973,7 +1975,9 @@ package body Makeutl is
or else or else
Sw (2 .. 3) = "aO" Sw (2 .. 3) = "aO"
or else or else
Sw (2 .. 3) = "aI") Sw (2 .. 3) = "aI"
or else
(For_Gnatbind and then Sw (2 .. 3) = "A="))
then then
Start := 4; Start := 4;
...@@ -2033,7 +2037,7 @@ package body Makeutl is ...@@ -2033,7 +2037,7 @@ package body Makeutl is
end if; end if;
end; end;
end if; end if;
end Test_If_Relative_Path; end Ensure_Absolute_Path;
------------------- -------------------
-- Unit_Index_Of -- -- Unit_Index_Of --
......
...@@ -235,20 +235,19 @@ package Makeutl is ...@@ -235,20 +235,19 @@ package Makeutl is
-- Find the index of a unit in a source file. Return zero if the file is -- Find the index of a unit in a source file. Return zero if the file is
-- not a multi-unit source file. -- not a multi-unit source file.
procedure Test_If_Relative_Path procedure Ensure_Absolute_Path
(Switch : in out String_Access; (Switch : in out String_Access;
Parent : String; Parent : String;
Do_Fail : Fail_Proc; Do_Fail : Fail_Proc;
Including_L_Switch : Boolean := True; For_Gnatbind : Boolean := False;
Including_Non_Switch : Boolean := True; Including_Non_Switch : Boolean := True;
Including_RTS : Boolean := False); Including_RTS : Boolean := False);
-- Test if Switch is a relative search path switch. If so, fail if Parent -- Do nothing if Switch is an absolute path switch. If relative, fail if
-- is the empty string, otherwise prepend the path with Parent. This -- Parent is the empty string, otherwise prepend the path with Parent. This
-- subprogram is only used when using project files. For gnatbind switches, -- subprogram is only used when using project files. If For_Gnatbind is
-- Including_L_Switch is False, because the argument of the -L switch is -- True, gnatbind switches that are not paths (-L, -A) are left unchaned.
-- not a path. If Including_RTS is True, process also switches --RTS=. -- If Including_RTS is True, process also switches --RTS=. Do_Fail is
-- Do_Fail is called in case of error. Using Osint.Fail might be -- called in case of error. Using Osint.Fail might be appropriate.
-- appropriate.
function Path_Or_File_Name (Path : Path_Name_Type) return String; function Path_Or_File_Name (Path : Path_Name_Type) return String;
-- Returns a file name if -df is used, otherwise return a path name -- Returns a file name if -df is used, otherwise return a path name
......
...@@ -7068,6 +7068,8 @@ package body Sem_Ch12 is ...@@ -7068,6 +7068,8 @@ package body Sem_Ch12 is
D2 : Integer := 0; D2 : Integer := 0;
P1 : Node_Id := N1; P1 : Node_Id := N1;
P2 : Node_Id := N2; P2 : Node_Id := N2;
T1 : Source_Ptr;
T2 : Source_Ptr;
-- Start of processing for Earlier -- Start of processing for Earlier
...@@ -7208,19 +7210,21 @@ package body Sem_Ch12 is ...@@ -7208,19 +7210,21 @@ package body Sem_Ch12 is
-- At this point either both nodes came from source or we approximated -- At this point either both nodes came from source or we approximated
-- their source locations through neighbouring source statements. -- their source locations through neighbouring source statements.
T1 := Top_Level_Location (Sloc (P1));
T2 := Top_Level_Location (Sloc (P2));
-- When two nodes come from the same instance, they have identical top -- When two nodes come from the same instance, they have identical top
-- level locations. To determine proper relation within the tree, check -- level locations. To determine proper relation within the tree, check
-- their locations within the template. -- their locations within the template.
if Top_Level_Location (Sloc (P1)) = Top_Level_Location (Sloc (P2)) then if T1 = T2 then
return Sloc (P1) < Sloc (P2); return Sloc (P1) < Sloc (P2);
-- The two nodes either come from unrelated instances or do not come -- The two nodes either come from unrelated instances or do not come
-- from instantiated code at all. -- from instantiated code at all.
else else
return Top_Level_Location (Sloc (P1)) return T1 < T2;
< Top_Level_Location (Sloc (P2));
end if; end if;
end Earlier; end Earlier;
......
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