[Ada] Ignore both Global and Refined_Global in CodePeer mode

Message ID 20170912101618.GA9706@adacore.com
State New
Headers show
Series
  • [Ada] Ignore both Global and Refined_Global in CodePeer mode
Related show

Commit Message

Arnaud Charlet Sept. 12, 2017, 10:16 a.m.
Only the first pragma was ignored in CodePeer mode, to allow analysis of
legacy code, which caused errors when the second was also present. Now
both are ignored in CodePeer mode.

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

2017-09-12  Yannick Moy  <moy@adacore.com>

	* gnat1drv.adb (Adjust_Global_Switches): Consider Refined_Global
	together with Global when ignoring one in CodePeer mode.

Patch

Index: gnat1drv.adb
===================================================================
--- gnat1drv.adb	(revision 252000)
+++ gnat1drv.adb	(working copy)
@@ -66,7 +66,7 @@ 
 with Set_Targ;
 with Sinfo;    use Sinfo;
 with Sinput.L; use Sinput.L;
-with Snames;
+with Snames;   use Snames;
 with Sprint;   use Sprint;
 with Stringt;
 with Stylesw;  use Stylesw;
@@ -272,9 +272,13 @@ 
          Restrict.Restrictions.Set   (Max_Asynchronous_Select_Nesting) := True;
          Restrict.Restrictions.Value (Max_Asynchronous_Select_Nesting) := 0;
 
-         --  Enable pragma Ignore_Pragma (Global) to support legacy code
+         --  Enable pragma Ignore_Pragma (Global) to support legacy code. As a
+         --  consequence, Refined_Global pragma should be ignored as well, as
+         --  it is only allowed on a body when pragma Global is given for the
+         --  spec.
 
-         Set_Name_Table_Boolean3 (Name_Id'(Name_Find ("global")), True);
+         Set_Name_Table_Boolean3 (Name_Global, True);
+         Set_Name_Table_Boolean3 (Name_Refined_Global, True);
 
          --  Suppress division by zero checks since they are handled
          --  implicitly by CodePeer.