Commit 15d8a51d by Arnaud Charlet

[multiple changes]

2011-08-04  Robert Dewar  <dewar@adacore.com>

	* exp_ch5.adb, exp_ch7.adb, exp_util.adb, bindgen.adb, sem_prag.adb,
	s-tassta.adb, exp_ch4.adb, exp_disp.adb, s-stausa.adb: Minor
	reformatting.

2011-08-04  Arnaud Charlet  <charlet@adacore.com>

	* make.adb (Linking_Phase): Set source search path before calling
	gnatlink in CodePeer mode.

From-SVN: r177388
parent f46faa08
2011-08-04 Robert Dewar <dewar@adacore.com>
* exp_ch5.adb, exp_ch7.adb, exp_util.adb, bindgen.adb, sem_prag.adb,
s-tassta.adb, exp_ch4.adb, exp_disp.adb, s-stausa.adb: Minor
reformatting.
2011-08-04 Arnaud Charlet <charlet@adacore.com>
* make.adb (Linking_Phase): Set source search path before calling
gnatlink in CodePeer mode.
2011-08-04 Javier Miranda <miranda@adacore.com> 2011-08-04 Javier Miranda <miranda@adacore.com>
* exp_ch7.adb (Expand_N_Package_Body, Expand_N_Package_Declaration): * exp_ch7.adb (Expand_N_Package_Body, Expand_N_Package_Declaration):
......
----------------------------------------------------------------------------- ------------------------------------------------------------------------------
-- -- -- --
-- GNAT COMPILER COMPONENTS -- -- GNAT COMPILER COMPONENTS --
-- -- -- --
...@@ -467,8 +467,8 @@ package body Bindgen is ...@@ -467,8 +467,8 @@ package body Bindgen is
end if; end if;
-- Pragma Import C cannot be used on virtual machine targets, therefore -- Pragma Import C cannot be used on virtual machine targets, therefore
-- call the runtime finalization routine directly. -- call the runtime finalization routine directly. Similarly in CodePeer
-- Similarly in CodePeer mode, where imported functions are ignored. -- mode, where imported functions are ignored.
else else
WBI (" System.Standard_Library.Adafinal;"); WBI (" System.Standard_Library.Adafinal;");
...@@ -1406,6 +1406,7 @@ package body Bindgen is ...@@ -1406,6 +1406,7 @@ package body Bindgen is
procedure Gen_Elab_Calls_Ada is procedure Gen_Elab_Calls_Ada is
Check_Elab_Flag : Boolean; Check_Elab_Flag : Boolean;
begin begin
for E in Elab_Order.First .. Elab_Order.Last loop for E in Elab_Order.First .. Elab_Order.Last loop
declare declare
...@@ -2179,6 +2180,7 @@ package body Bindgen is ...@@ -2179,6 +2180,7 @@ package body Bindgen is
Callee_Name : String renames Name_Buffer (1 .. Name_Len - 2); Callee_Name : String renames Name_Buffer (1 .. Name_Len - 2);
-- Strip trailing "%b" -- Strip trailing "%b"
begin begin
if ALIs.Table (ALIs.First).Main_Program = Proc then if ALIs.Table (ALIs.First).Main_Program = Proc then
WBI (" procedure " & CodePeer_Wrapper_Name & " is "); WBI (" procedure " & CodePeer_Wrapper_Name & " is ");
...@@ -2277,6 +2279,7 @@ package body Bindgen is ...@@ -2277,6 +2279,7 @@ package body Bindgen is
if ALIs.Table (ALIs.First).Main_Program = Func then if ALIs.Table (ALIs.First).Main_Program = Func then
WBI (" Result : Integer;"); WBI (" Result : Integer;");
end if; end if;
else else
-- To call the main program, we declare it using a pragma Import -- To call the main program, we declare it using a pragma Import
-- Ada with the right link name. -- Ada with the right link name.
...@@ -2330,7 +2333,7 @@ package body Bindgen is ...@@ -2330,7 +2333,7 @@ package body Bindgen is
-- with a pragma Volatile in order to tell the compiler to preserve -- with a pragma Volatile in order to tell the compiler to preserve
-- this variable at any level of optimization. -- this variable at any level of optimization.
if Bind_Main_Program and then not CodePeer_Mode then if Bind_Main_Program and not CodePeer_Mode then
WBI WBI
(" Ensure_Reference : aliased System.Address := " & (" Ensure_Reference : aliased System.Address := " &
"Ada_Main_Program_Name'Address;"); "Ada_Main_Program_Name'Address;");
...@@ -3312,8 +3315,8 @@ package body Bindgen is ...@@ -3312,8 +3315,8 @@ package body Bindgen is
Gen_Adainit_Ada; Gen_Adainit_Ada;
if Bind_Main_Program and then VM_Target = No_VM then if Bind_Main_Program and then VM_Target = No_VM then
-- For CodePeer, declare a wrapper for the
-- user-defined main program. -- For CodePeer, declare a wrapper for the user-defined main program
if CodePeer_Mode then if CodePeer_Mode then
Gen_CodePeer_Wrapper; Gen_CodePeer_Wrapper;
......
...@@ -659,8 +659,7 @@ package body Exp_Ch4 is ...@@ -659,8 +659,7 @@ package body Exp_Ch4 is
Attribute_Name => Name_Tag); Attribute_Name => Name_Tag);
if Tagged_Type_Expansion then if Tagged_Type_Expansion then
New_Node := New_Node := Build_Get_Access_Level (Loc, New_Node);
Build_Get_Access_Level (Loc, New_Node);
elsif VM_Target /= No_VM then elsif VM_Target /= No_VM then
New_Node := New_Node :=
......
...@@ -2462,7 +2462,6 @@ package body Exp_Ch5 is ...@@ -2462,7 +2462,6 @@ package body Exp_Ch5 is
and then Nkind (Alt) = N_Case_Statement_Alternative and then Nkind (Alt) = N_Case_Statement_Alternative
loop loop
Process_Statements_For_Controlled_Objects (Alt); Process_Statements_For_Controlled_Objects (Alt);
Next (Alt); Next (Alt);
end loop; end loop;
end; end;
......
...@@ -5468,7 +5468,6 @@ package body Exp_Util is ...@@ -5468,7 +5468,6 @@ package body Exp_Util is
function Are_Wrapped (L : List_Id) return Boolean is function Are_Wrapped (L : List_Id) return Boolean is
Stmt : constant Node_Id := First (L); Stmt : constant Node_Id := First (L);
begin begin
return return
Present (Stmt) Present (Stmt)
...@@ -5501,8 +5500,7 @@ package body Exp_Util is ...@@ -5501,8 +5500,7 @@ package body Exp_Util is
-- Check the "then statements" for elsif parts and if statements -- Check the "then statements" for elsif parts and if statements
if Nkind_In (N, N_Elsif_Part, if Nkind_In (N, N_Elsif_Part, N_If_Statement)
N_If_Statement)
and then not Is_Empty_List (Then_Statements (N)) and then not Is_Empty_List (Then_Statements (N))
and then not Are_Wrapped (Then_Statements (N)) and then not Are_Wrapped (Then_Statements (N))
and then Requires_Cleanup_Actions and then Requires_Cleanup_Actions
......
...@@ -4357,16 +4357,16 @@ package body Make is ...@@ -4357,16 +4357,16 @@ package body Make is
end if; end if;
end; end;
end if; end if;
end if; end if;
-- Put the object directories in ADA_OBJECTS_PATH -- Put the object directories in ADA_OBJECTS_PATH
-- Ditto for source directories in ADA_INCLUDE_PATH in CodePeer mode
Prj.Env.Set_Ada_Paths Prj.Env.Set_Ada_Paths
(Main_Project, (Main_Project,
Project_Tree, Project_Tree,
Including_Libraries => False, Including_Libraries => False,
Include_Path => False); Include_Path => CodePeer_Mode);
-- Check for attributes Linker'Linker_Options in projects other than -- Check for attributes Linker'Linker_Options in projects other than
-- the main project -- the main project
...@@ -4581,7 +4581,6 @@ package body Make is ...@@ -4581,7 +4581,6 @@ package body Make is
new String'("-F=" & Get_Name_String (Mapping_Path)); new String'("-F=" & Get_Name_String (Mapping_Path));
end if; end if;
end if; end if;
end if; end if;
begin begin
......
...@@ -176,6 +176,7 @@ package body System.Stack_Usage is ...@@ -176,6 +176,7 @@ package body System.Stack_Usage is
---------------- ----------------
procedure Fill_Stack (Analyzer : in out Stack_Analyzer) is procedure Fill_Stack (Analyzer : in out Stack_Analyzer) is
-- Change the local variables and parameters of this function with -- Change the local variables and parameters of this function with
-- super-extra care. The more the stack frame size of this function is -- super-extra care. The more the stack frame size of this function is
-- big, the more an "instrumentation threshold at writing" error is -- big, the more an "instrumentation threshold at writing" error is
...@@ -188,21 +189,23 @@ package body System.Stack_Usage is ...@@ -188,21 +189,23 @@ package body System.Stack_Usage is
-- allocated byte on the stack. -- allocated byte on the stack.
begin begin
if Parameters.Stack_Grows_Down then if Parameters.Stack_Grows_Down then
if Analyzer.Stack_Base - Stack_Address (Analyzer.Pattern_Size) if Analyzer.Stack_Base - Stack_Address (Analyzer.Pattern_Size) >
> To_Stack_Address (Current_Stack_Level'Address) - Guard To_Stack_Address (Current_Stack_Level'Address) - Guard
then then
-- No room for a pattern -- No room for a pattern
Analyzer.Pattern_Size := 0; Analyzer.Pattern_Size := 0;
return; return;
end if; end if;
Analyzer.Pattern_Limit := Analyzer.Stack_Base Analyzer.Pattern_Limit :=
- Stack_Address (Analyzer.Pattern_Size); Analyzer.Stack_Base - Stack_Address (Analyzer.Pattern_Size);
if Analyzer.Stack_Base > if Analyzer.Stack_Base >
To_Stack_Address (Current_Stack_Level'Address) - Guard To_Stack_Address (Current_Stack_Level'Address) - Guard
then then
-- Reduce pattern size to prevent local frame overwrite -- Reduce pattern size to prevent local frame overwrite
Analyzer.Pattern_Size := Analyzer.Pattern_Size :=
Integer (To_Stack_Address (Current_Stack_Level'Address) - Guard Integer (To_Stack_Address (Current_Stack_Level'Address) - Guard
- Analyzer.Pattern_Limit); - Analyzer.Pattern_Limit);
...@@ -211,32 +214,36 @@ package body System.Stack_Usage is ...@@ -211,32 +214,36 @@ package body System.Stack_Usage is
Analyzer.Pattern_Overlay_Address := Analyzer.Pattern_Overlay_Address :=
To_Address (Analyzer.Pattern_Limit); To_Address (Analyzer.Pattern_Limit);
else else
if Analyzer.Stack_Base + Stack_Address (Analyzer.Pattern_Size) if Analyzer.Stack_Base + Stack_Address (Analyzer.Pattern_Size) <
< To_Stack_Address (Current_Stack_Level'Address) + Guard To_Stack_Address (Current_Stack_Level'Address) + Guard
then then
-- No room for a pattern -- No room for a pattern
Analyzer.Pattern_Size := 0; Analyzer.Pattern_Size := 0;
return; return;
end if; end if;
Analyzer.Pattern_Limit := Analyzer.Stack_Base Analyzer.Pattern_Limit :=
+ Stack_Address (Analyzer.Pattern_Size); Analyzer.Stack_Base + Stack_Address (Analyzer.Pattern_Size);
if Analyzer.Stack_Base < if Analyzer.Stack_Base <
To_Stack_Address (Current_Stack_Level'Address) + Guard To_Stack_Address (Current_Stack_Level'Address) + Guard
then then
-- Reduce pattern size to prevent local frame overwrite -- Reduce pattern size to prevent local frame overwrite
Analyzer.Pattern_Size := Integer
(Analyzer.Pattern_Limit Analyzer.Pattern_Size :=
- (To_Stack_Address (Current_Stack_Level'Address) + Guard)); Integer
(Analyzer.Pattern_Limit -
(To_Stack_Address (Current_Stack_Level'Address) + Guard));
end if; end if;
Analyzer.Pattern_Overlay_Address := Analyzer.Pattern_Overlay_Address :=
To_Address (Analyzer.Pattern_Limit To_Address (Analyzer.Pattern_Limit -
- Stack_Address (Analyzer.Pattern_Size)); Stack_Address (Analyzer.Pattern_Size));
end if; end if;
-- Declare and fill the pattern buffer -- Declare and fill the pattern buffer
declare declare
Pattern : aliased Stack_Slots Pattern : aliased Stack_Slots
(1 .. Analyzer.Pattern_Size / Bytes_Per_Pattern); (1 .. Analyzer.Pattern_Size / Bytes_Per_Pattern);
...@@ -247,6 +254,7 @@ package body System.Stack_Usage is ...@@ -247,6 +254,7 @@ package body System.Stack_Usage is
for J in reverse Pattern'Range loop for J in reverse Pattern'Range loop
Pattern (J) := Analyzer.Pattern; Pattern (J) := Analyzer.Pattern;
end loop; end loop;
else else
for J in Pattern'Range loop for J in Pattern'Range loop
Pattern (J) := Analyzer.Pattern; Pattern (J) := Analyzer.Pattern;
...@@ -322,6 +330,7 @@ package body System.Stack_Usage is ...@@ -322,6 +330,7 @@ package body System.Stack_Usage is
begin begin
-- Value if the pattern was not modified -- Value if the pattern was not modified
if Parameters.Stack_Grows_Down then if Parameters.Stack_Grows_Down then
Analyzer.Topmost_Touched_Mark := Analyzer.Topmost_Touched_Mark :=
Analyzer.Pattern_Limit + Stack_Address (Analyzer.Pattern_Size); Analyzer.Pattern_Limit + Stack_Address (Analyzer.Pattern_Size);
...@@ -341,8 +350,8 @@ package body System.Stack_Usage is ...@@ -341,8 +350,8 @@ package body System.Stack_Usage is
if System.Parameters.Stack_Grows_Down then if System.Parameters.Stack_Grows_Down then
for J in Stack'Range loop for J in Stack'Range loop
if Stack (J) /= Analyzer.Pattern then if Stack (J) /= Analyzer.Pattern then
Analyzer.Topmost_Touched_Mark Analyzer.Topmost_Touched_Mark :=
:= To_Stack_Address (Stack (J)'Address); To_Stack_Address (Stack (J)'Address);
exit; exit;
end if; end if;
end loop; end loop;
...@@ -350,8 +359,8 @@ package body System.Stack_Usage is ...@@ -350,8 +359,8 @@ package body System.Stack_Usage is
else else
for J in reverse Stack'Range loop for J in reverse Stack'Range loop
if Stack (J) /= Analyzer.Pattern then if Stack (J) /= Analyzer.Pattern then
Analyzer.Topmost_Touched_Mark Analyzer.Topmost_Touched_Mark :=
:= To_Stack_Address (Stack (J)'Address); To_Stack_Address (Stack (J)'Address);
exit; exit;
end if; end if;
end loop; end loop;
...@@ -407,7 +416,8 @@ package body System.Stack_Usage is ...@@ -407,7 +416,8 @@ package body System.Stack_Usage is
Max_Stack_Size_Len, Max_Actual_Use_Len : Natural := 0; Max_Stack_Size_Len, Max_Actual_Use_Len : Natural := 0;
Task_Name_Blanks : constant Task_Name_Blanks : constant
String (1 .. Task_Name_Length - Task_Name_Str'Length) := String
(1 .. Task_Name_Length - Task_Name_Str'Length) :=
(others => ' '); (others => ' ');
begin begin
...@@ -444,11 +454,13 @@ package body System.Stack_Usage is ...@@ -444,11 +454,13 @@ package body System.Stack_Usage is
declare declare
Stack_Size_Blanks : constant Stack_Size_Blanks : constant
String (1 .. Max_Stack_Size_Len - Stack_Size_Str'Length) := String (1 .. Max_Stack_Size_Len -
Stack_Size_Str'Length) :=
(others => ' '); (others => ' ');
Stack_Usage_Blanks : constant Stack_Usage_Blanks : constant
String (1 .. Max_Actual_Use_Len - Actual_Size_Str'Length) := String (1 .. Max_Actual_Use_Len -
Actual_Size_Str'Length) :=
(others => ' '); (others => ' ');
begin begin
...@@ -496,9 +508,9 @@ package body System.Stack_Usage is ...@@ -496,9 +508,9 @@ package body System.Stack_Usage is
Value => 0); Value => 0);
begin begin
if Analyzer.Pattern_Size = 0 then if Analyzer.Pattern_Size = 0 then
-- If we have that result, it means that we didn't do any computation -- If we have that result, it means that we didn't do any computation
-- at all. In other words, we used at least everything (and possibly -- at all (i.e. we used at least everything (and possibly more).
-- more).
Result.Value := Analyzer.Stack_Size; Result.Value := Analyzer.Stack_Size;
......
...@@ -1127,7 +1127,7 @@ package body System.Tasking.Stages is ...@@ -1127,7 +1127,7 @@ package body System.Tasking.Stages is
Big_Overflow_Guard : constant := 16 * 1024; Big_Overflow_Guard : constant := 16 * 1024;
Small_Stack_Limit : constant := 64 * 1024; Small_Stack_Limit : constant := 64 * 1024;
-- ??? These three values are experimental, and seems to work on -- ??? These three values are experimental, and seem to work on
-- most platforms. They still need to be analyzed further. They -- most platforms. They still need to be analyzed further. They
-- also need documentation, what are they??? -- also need documentation, what are they???
...@@ -1137,22 +1137,27 @@ package body System.Tasking.Stages is ...@@ -1137,22 +1137,27 @@ package body System.Tasking.Stages is
Stack_Base : Address; Stack_Base : Address;
-- Address of the base of the stack -- Address of the base of the stack
begin begin
Stack_Base := Self_ID.Common.Compiler_Data.Pri_Stack_Info.Base; Stack_Base := Self_ID.Common.Compiler_Data.Pri_Stack_Info.Base;
if Stack_Base = Null_Address then if Stack_Base = Null_Address then
-- On many platforms, we don't know the real stack base -- On many platforms, we don't know the real stack base
-- address. Estimate it using an address in the frame. -- address. Estimate it using an address in the frame.
Stack_Base := Bottom_Of_Stack'Address; Stack_Base := Bottom_Of_Stack'Address;
-- Also reduce the size of the stack to take into account the -- Also reduce the size of the stack to take into account the
-- secondary stack array declared in this frame. This is for -- secondary stack array declared in this frame. This is for
-- sure very conservative. -- sure very conservative.
if not Parameters.Sec_Stack_Dynamic then if not Parameters.Sec_Stack_Dynamic then
Pattern_Size := Pattern_Size :=
Pattern_Size - Natural (Secondary_Stack_Size); Pattern_Size - Natural (Secondary_Stack_Size);
end if; end if;
-- Adjustments for inner frames -- Adjustments for inner frames
Pattern_Size := Pattern_Size - Pattern_Size := Pattern_Size -
(if Pattern_Size < Small_Stack_Limit (if Pattern_Size < Small_Stack_Limit
then Small_Overflow_Guard then Small_Overflow_Guard
......
...@@ -426,7 +426,9 @@ package body Sem_Prag is ...@@ -426,7 +426,9 @@ package body Sem_Prag is
-- Checks that the given argument has an identifier, and if so, requires -- Checks that the given argument has an identifier, and if so, requires
-- it to match one of the given identifier names. If there is no -- it to match one of the given identifier names. If there is no
-- identifier, or a non-matching identifier, then an error message is -- identifier, or a non-matching identifier, then an error message is
-- given and Pragma_Exit is raised. -- given and Pragma_Exit is raised. ??? why is this needed, why isnt
-- Check_Arg_Is_One_Of good enough. At the very least explain this
-- odd apparent redundancy
procedure Check_In_Main_Program; procedure Check_In_Main_Program;
-- Common checks for pragmas that appear within a main program -- Common checks for pragmas that appear within a main program
...@@ -6843,9 +6845,9 @@ package body Sem_Prag is ...@@ -6843,9 +6845,9 @@ package body Sem_Prag is
-- Check -- -- Check --
----------- -----------
-- pragma Check ([Name =>] Identifier, -- pragma Check ([Name =>] IDENTIFIER,
-- [Check =>] Boolean_Expression -- [Check =>] Boolean_EXPRESSION
-- [,[Message =>] String_Expression]); -- [,[Message =>] String_EXPRESSION]);
when Pragma_Check => Check : declare when Pragma_Check => Check : declare
Expr : Node_Id; Expr : Node_Id;
...@@ -11527,8 +11529,8 @@ package body Sem_Prag is ...@@ -11527,8 +11529,8 @@ package body Sem_Prag is
-- Postcondition -- -- Postcondition --
------------------- -------------------
-- pragma Postcondition ([Check =>] Boolean_Expression -- pragma Postcondition ([Check =>] Boolean_EXPRESSION
-- [,[Message =>] String_Expression]); -- [,[Message =>] String_EXPRESSION]);
when Pragma_Postcondition => Postcondition : declare when Pragma_Postcondition => Postcondition : declare
In_Body : Boolean; In_Body : Boolean;
...@@ -11550,8 +11552,8 @@ package body Sem_Prag is ...@@ -11550,8 +11552,8 @@ package body Sem_Prag is
-- Precondition -- -- Precondition --
------------------ ------------------
-- pragma Precondition ([Check =>] Boolean_Expression -- pragma Precondition ([Check =>] Boolean_EXPRESSION
-- [,[Message =>] String_Expression]); -- [,[Message =>] String_EXPRESSION]);
when Pragma_Precondition => Precondition : declare when Pragma_Precondition => Precondition : declare
In_Body : Boolean; In_Body : Boolean;
...@@ -13262,10 +13264,14 @@ package body Sem_Prag is ...@@ -13262,10 +13264,14 @@ package body Sem_Prag is
-- Test_Case -- -- Test_Case --
--------------- ---------------
-- pragma Test_Case ([Name =>] String_Expression -- pragma Test_Case ([Name =>] String_EXPRESSION
-- ,[Mode =>] (Normal | Robustness) -- ,[Mode =>] (Normal | Robustness)
-- [, Requires => Boolean_Expression] -- [, Requires => Boolean_EXPRESSION]
-- [, Ensures => Boolean_Expression]); -- [, Ensures => Boolean_EXPRESSION]);
-- ??? Why is Name not static_string_EXPRESSION??? Seems very
-- weird to require it to be a string literal, and if we DO want
-- that restriction the grammar should make this clear.
when Pragma_Test_Case => Test_Case : declare when Pragma_Test_Case => Test_Case : declare
...@@ -13280,10 +13286,14 @@ package body Sem_Prag is ...@@ -13280,10 +13286,14 @@ package body Sem_Prag is
Check_Arg_Is_String_Literal (Arg1); Check_Arg_Is_String_Literal (Arg1);
Check_Optional_Identifier (Arg2, Name_Mode); Check_Optional_Identifier (Arg2, Name_Mode);
Check_Arg_Is_One_Of (Arg2, Name_Normal, Name_Robustness); Check_Arg_Is_One_Of (Arg2, Name_Normal, Name_Robustness);
if Arg_Count = 4 then if Arg_Count = 4 then
Check_Identifier (Arg3, Name_Requires); Check_Identifier (Arg3, Name_Requires);
Check_Identifier (Arg4, Name_Ensures); Check_Identifier (Arg4, Name_Ensures);
else else
-- ??? why not Check_Arg_Is_One_Of, very odd!!! At the very
-- least needs an explanation!
Check_Identifier_Is_One_Of (Arg3, Name_Requires, Name_Ensures); Check_Identifier_Is_One_Of (Arg3, Name_Requires, Name_Ensures);
end if; end if;
......
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