diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2020-03-20 23:00:32 +0100 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-06-12 04:29:15 -0400 |
commit | ec772e4b269206a943b3caa5544d9c7ac1d8de1a (patch) | |
tree | 2e4f88df493177cf8b9d464d87e8045c9450b5b3 /gcc/ada/sinfo.adb | |
parent | 6f6f89a494e3b9b2d9ed73589f04b54c3282a5ef (diff) | |
download | gcc-ec772e4b269206a943b3caa5544d9c7ac1d8de1a.zip gcc-ec772e4b269206a943b3caa5544d9c7ac1d8de1a.tar.gz gcc-ec772e4b269206a943b3caa5544d9c7ac1d8de1a.tar.bz2 |
[Ada] Implement AI12-0175 Preelaborable packages with address clauses
2020-06-12 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* rtsfind.ads (RTU_Id): Add System_Address_To_Access_Conversions.
* sem_elab.adb (Elaboration_Phase_Active): Alphabetize.
(Finalize_All_Data_Structures): Likewise.
(Error_Preelaborated_Call): New procedure.
(Build_Call_Marker): Set Is_Preelaborable_Call flag in marker.
(Build_Access_Marker): Likewise.
(Build_Subprogram_Invocation): Likewise.
(Build_Task_Activation): Likewise.
(Check_Preelaborated_Call): Return when the call is preelaborable.
Call Error_Preelaborated_Call to give the error otherwise.
(Check_Elab_Call): Likewise.
* sem_util.adb (Is_Preelaborable_Function): New predicate.
(Is_Non_Preelaborable_Construct.Visit): Recurse on the
Explicit_Actual_Parameter field of N_Parameter_Association.
(Is_Non_Preelaborable_Construct.Visit_Subexpression): In Ada 2020,
for a call to a preelaborable function, visit the parameter list;
otherwise, raise Non_Preelaborable exception.
(Is_Preelaborable_Construct): Likewise, but recursively check the
parameters instead and return false upon failure, otherwise true.
* sinfo.ads (Is_Preelaborable_Call): New flag in call marker nodes.
(Is_Preelaborable_Call): New inline function.
(Set_Is_Preelaborable_Call): New inline procedure.
* sinfo.adb (Is_Preelaborable_Call): New inline function.
(Set_Is_Preelaborable_Call): New inline procedure.
Diffstat (limited to 'gcc/ada/sinfo.adb')
-rw-r--r-- | gcc/ada/sinfo.adb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/ada/sinfo.adb b/gcc/ada/sinfo.adb index f6e70c1..642e859 100644 --- a/gcc/ada/sinfo.adb +++ b/gcc/ada/sinfo.adb @@ -2096,6 +2096,14 @@ package body Sinfo is return Flag13 (N); end Is_Power_Of_2_For_Shift; + function Is_Preelaborable_Call + (N : Node_Id) return Boolean is + begin + pragma Assert (False + or else NT (N).Nkind = N_Call_Marker); + return Flag7 (N); + end Is_Preelaborable_Call; + function Is_Prefixed_Call (N : Node_Id) return Boolean is begin @@ -5563,6 +5571,14 @@ package body Sinfo is Set_Flag13 (N, Val); end Set_Is_Power_Of_2_For_Shift; + procedure Set_Is_Preelaborable_Call + (N : Node_Id; Val : Boolean := True) is + begin + pragma Assert (False + or else NT (N).Nkind = N_Call_Marker); + Set_Flag7 (N, Val); + end Set_Is_Preelaborable_Call; + procedure Set_Is_Prefixed_Call (N : Node_Id; Val : Boolean := True) is begin |