This patch adds a check to ensure that there is no attempt to expand a single protected declaration as the declaration should have been transformed into a protected type along with an anonymous object. No change in behavior, no test needed.
Tested on x86_64-pc-linux-gnu, committed on trunk 2015-10-26 Hristian Kirtchev <kirtc...@adacore.com> * expander.adb (Expand): Expand a single protected declaration. * exp_ch9.ads, exp_ch9.adb (Expand_N_Single_Protected_Declaration): New routine.
Index: exp_ch9.adb =================================================================== --- exp_ch9.adb (revision 229328) +++ exp_ch9.adb (working copy) @@ -11388,14 +11388,28 @@ end loop; end Expand_N_Selective_Accept; + ------------------------------------------- + -- Expand_N_Single_Protected_Declaration -- + ------------------------------------------- + + -- A single protected declaration should never be present after semantic + -- analysis because it is transformed into a protected type declaration + -- and an accompanying anonymous object. This routine ensures that the + -- transformation takes place. + + procedure Expand_N_Single_Protected_Declaration (N : Node_Id) is + begin + raise Program_Error; + end Expand_N_Single_Protected_Declaration; + -------------------------------------- -- Expand_N_Single_Task_Declaration -- -------------------------------------- - -- Single task declarations should never be present after semantic - -- analysis, since we expect them to be replaced by a declaration of an - -- anonymous task type, followed by a declaration of the task object. We - -- include this routine to make sure that is happening. + -- A single task declaration should never be present after semantic + -- analysis because it is transformed into a task type declaration and + -- an accompanying anonymous object. This routine ensures that the + -- transformation takes place. procedure Expand_N_Single_Task_Declaration (N : Node_Id) is begin Index: exp_ch9.ads =================================================================== --- exp_ch9.ads (revision 229313) +++ exp_ch9.ads (working copy) @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2015, Free Software Foundation, Inc. -- -- -- -- 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- -- @@ -266,12 +266,13 @@ -- allows these two nodes to be found from the type, without benefit of -- further attributes, using Corresponding_Record. - procedure Expand_N_Requeue_Statement (N : Node_Id); - procedure Expand_N_Selective_Accept (N : Node_Id); - procedure Expand_N_Single_Task_Declaration (N : Node_Id); - procedure Expand_N_Task_Body (N : Node_Id); - procedure Expand_N_Task_Type_Declaration (N : Node_Id); - procedure Expand_N_Timed_Entry_Call (N : Node_Id); + procedure Expand_N_Requeue_Statement (N : Node_Id); + procedure Expand_N_Selective_Accept (N : Node_Id); + procedure Expand_N_Single_Protected_Declaration (N : Node_Id); + procedure Expand_N_Single_Task_Declaration (N : Node_Id); + procedure Expand_N_Task_Body (N : Node_Id); + procedure Expand_N_Task_Type_Declaration (N : Node_Id); + procedure Expand_N_Timed_Entry_Call (N : Node_Id); procedure Expand_Protected_Body_Declarations (N : Node_Id; Index: expander.adb =================================================================== --- expander.adb (revision 229313) +++ expander.adb (working copy) @@ -432,6 +432,9 @@ when N_Selective_Accept => Expand_N_Selective_Accept (N); + when N_Single_Protected_Declaration => + Expand_N_Single_Protected_Declaration (N); + when N_Single_Task_Declaration => Expand_N_Single_Task_Declaration (N); @@ -471,7 +474,7 @@ when N_Variant_Part => Expand_N_Variant_Part (N); - -- For all other node kinds, no expansion activity required + -- For all other node kinds, no expansion activity required when others => null;