[Ada] Prohibit concurrent types in Ghost regions

Pierre-Marie de Rodat derodat@adacore.com
Thu Jan 11 09:14:00 GMT 2018


This patch ensures that single concurrent type declarations are marked as Ghost
when they appear within a Ghost region. In addition, the patch verifies that no
concurrent type is declared within a Ghost region and issues an error.

------------
-- Source --
------------

--  types.ads

package Types with Ghost is
   protected Prot_Obj is                                             --  Error
   end Prot_Obj;

   protected type Prot_Typ is                                        --  Error
   end Prot_Typ;

   task Task_Obj;                                                    --  Error

   task type Task_Typ;                                               --  Error
end Types;

----------------------------
-- Compilation and output --
----------------------------

$ gcc -c types.ads
types.ads:2:14: ghost type "Prot_Obj" cannot be concurrent
types.ads:5:19: ghost type "Prot_Typ" cannot be concurrent
types.ads:8:09: ghost type "Task_Obj" cannot be concurrent
types.ads:10:14: ghost type "Task_Typ" cannot be concurrent

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

2018-01-11  Hristian Kirtchev  <kirtchev@adacore.com>

gcc/ada/

	* freeze.adb (Freeze_Entity): Ensure that a Ghost type is not
	concurrent, nor effectively volatile.
	* ghost.adb (Check_Ghost_Type): New routine.
	* ghost.ads (Check_Ghost_Type): New routine.
	* sem_util.adb (Is_Declaration): Reimplemented. The routine can now
	consider specific subsets of declarations.
	(Is_Declaration_Other_Than_Renaming): Removed. Its functionality is
	replicated by Is_Declaration.
	* sem_util.ads (Is_Declaration): New parameter profile. Update the
	comment on usage.
	(Is_Declaration_Other_Than_Renaming): Removed.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-diff
Size: 9112 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20180111/23f764e3/attachment.bin>


More information about the Gcc-patches mailing list