[Ada] gnatbind: Fix No_Entry_Calls_In_Elaboration_Code message

Message ID 20200716092051.GA146614@adacore.com
State New
Headers show
Series
  • [Ada] gnatbind: Fix No_Entry_Calls_In_Elaboration_Code message
Related show

Commit Message

Pierre-Marie de Rodat July 16, 2020, 9:20 a.m.
This patch fixes a bug where gnatbind would suggest adding the
No_Entry_Calls_In_Elaboration_Code restriction, when that restriction is
already present.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* bindo-diagnostics.adb (Output_Invocation_Related_Suggestions):
	Use Cumulative_Restrictions.Set, because Restriction_Active only
	works at compile time.

Patch

diff --git a/gcc/ada/bindo-diagnostics.adb b/gcc/ada/bindo-diagnostics.adb
--- a/gcc/ada/bindo-diagnostics.adb
+++ b/gcc/ada/bindo-diagnostics.adb
@@ -25,7 +25,6 @@ 
 
 with Binderr;  use Binderr;
 with Debug;    use Debug;
-with Restrict; use Restrict;
 with Rident;   use Rident;
 with Types;    use Types;
 
@@ -1144,7 +1143,7 @@  package body Bindo.Diagnostics is
       --  within the task body on a select or accept statement, eliminating
       --  subsequent invocation edges, thus breaking the cycle.
 
-      if not Restriction_Active (No_Entry_Calls_In_Elaboration_Code)
+      if not Cumulative_Restrictions.Set (No_Entry_Calls_In_Elaboration_Code)
         and then Contains_Task_Activation (G, Cycle)
       then
          Error_Msg_Info