Minimum accessibility level was stored in a variable which was never
modified. It seems cleaner to store it in a constant, which hopefully
allows better optimization (e.g. when tracking know object the value of
a variable is killed on a subprogram called).
No impact on compiler behaviour, expect possibly an optimization.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* exp_ch6.adb (Expand_Actuals): Whitespace cleanup.
* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Make minimum
accessibility a constant object.
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
--- a/gcc/ada/exp_ch6.adb
+++ b/gcc/ada/exp_ch6.adb
@@ -1458,12 +1458,12 @@ package body Exp_Ch6 is
Subp : Entity_Id;
Post_Call : out List_Id)
is
- Loc : constant Source_Ptr := Sloc (N);
- Actual : Node_Id;
- Formal : Entity_Id;
- N_Node : Node_Id;
- E_Actual : Entity_Id;
- E_Formal : Entity_Id;
+ Loc : constant Source_Ptr := Sloc (N);
+ Actual : Node_Id;
+ Formal : Entity_Id;
+ N_Node : Node_Id;
+ E_Actual : Entity_Id;
+ E_Formal : Entity_Id;
procedure Add_Call_By_Copy_Code;
-- For cases where the parameter must be passed by copy, this routine
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -4699,7 +4699,7 @@ package body Sem_Ch6 is
then
-- Generate the minimum accessibility level object
- -- A60b : natural := natural'min(1, paramL);
+ -- A60b : constant natural := natural'min(1, paramL);
declare
Loc : constant Source_Ptr := Sloc (Body_Nod);
@@ -4708,6 +4708,7 @@ package body Sem_Ch6 is
Defining_Identifier =>
Make_Temporary
(Loc, 'A', Extra_Accessibility (Form)),
+ Constant_Present => True,
Object_Definition => New_Occurrence_Of
(Standard_Natural, Loc),
Expression =>