diff options
Diffstat (limited to 'gcc/ada/sem_prag.adb')
-rw-r--r-- | gcc/ada/sem_prag.adb | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index af5506a..e5dfde9 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -505,6 +505,10 @@ package body Sem_Prag is -- Check the specified argument Arg to make sure that it is a valid -- locking policy name. If not give error and raise Pragma_Exit. + procedure Check_Arg_Is_Partition_Elaboration_Policy (Arg : Node_Id); + -- Check the specified argument Arg to make sure that it is a valid + -- elaboration policy name. If not give error and raise Pragma_Exit. + procedure Check_Arg_Is_One_Of (Arg : Node_Id; N1, N2 : Name_Id); @@ -1190,6 +1194,22 @@ package body Sem_Prag is end if; end Check_Arg_Is_Locking_Policy; + ----------------------------------------------- + -- Check_Arg_Is_Partition_Elaboration_Policy -- + ----------------------------------------------- + + procedure Check_Arg_Is_Partition_Elaboration_Policy (Arg : Node_Id) is + Argx : constant Node_Id := Get_Pragma_Arg (Arg); + + begin + Check_Arg_Is_Identifier (Argx); + + if not Is_Partition_Elaboration_Policy_Name (Chars (Argx)) then + Error_Pragma_Arg + ("& is not a valid partition elaboration policy name", Argx); + end if; + end Check_Arg_Is_Partition_Elaboration_Policy; + ------------------------- -- Check_Arg_Is_One_Of -- ------------------------- @@ -12039,6 +12059,53 @@ package body Sem_Prag is when Pragma_Page => null; + ---------------------------------- + -- Partition_Elaboration_Policy -- + ---------------------------------- + + -- pragma Partition_Elaboration_Policy (policy_IDENTIFIER); + + when Pragma_Partition_Elaboration_Policy => declare + subtype PEP_Range is Name_Id + range First_Partition_Elaboration_Policy_Name + .. Last_Partition_Elaboration_Policy_Name; + PEP_Val : PEP_Range; + PEP : Character; + + begin + Ada_2005_Pragma; + Check_Arg_Count (1); + Check_No_Identifiers; + Check_Arg_Is_Partition_Elaboration_Policy (Arg1); + Check_Valid_Configuration_Pragma; + PEP_Val := Chars (Get_Pragma_Arg (Arg1)); + + case PEP_Val is + when Name_Concurrent => + PEP := 'C'; + when Name_Sequential => + PEP := 'S'; + end case; + + if Partition_Elaboration_Policy /= ' ' + and then Partition_Elaboration_Policy /= PEP + then + Error_Msg_Sloc := Partition_Elaboration_Policy_Sloc; + Error_Pragma + ("partition elaboration policy incompatible with policy#"); + + -- Set new policy, but always preserve System_Location since we + -- like the error message with the run time name. + + else + Partition_Elaboration_Policy := PEP; + + if Partition_Elaboration_Policy_Sloc /= System_Location then + Partition_Elaboration_Policy_Sloc := Loc; + end if; + end if; + end; + ------------- -- Passive -- ------------- @@ -15312,6 +15379,7 @@ package body Sem_Prag is Pragma_Ordered => 0, Pragma_Pack => 0, Pragma_Page => -1, + Pragma_Partition_Elaboration_Policy => -1, Pragma_Passive => -1, Pragma_Preelaborable_Initialization => -1, Pragma_Polling => -1, |