This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Add missing errors in snychronized interfaces


Tested on i686-linux, committed on trunk

This patch allows the frontend to report two errors:
  1) If we have a full-declaration associated with a private type
     declaration that implement interfaces, then the private type
     must be limited.
  2) In case of single-task declaration, the use of the 'access
     attribute is not available (for this purpose the object should
     be explicitly marked as aliased, but being an anonymous type
     this is not possible).
--
procedure do_test is
   package Pkg is
      type I1 is synchronized interface;
      type My_Task is new I1 with private;
   private
      task type My_Task is new I1 with end;     -- ERROR
   end Pkg;
--
   package body Pkg is
      task body My_Task is begin null; end;
   end Pkg;
--
   procedure Dispatch_Call (Obj : access Pkg.I1'Class) is
   begin
      null;
   end Dispatch_Call;
--
   task Single is new Pkg.I1 with end;
   task body Single is begin null; end;
begin
   Dispatch_Call (Single'Access);               -- ERROR
end do_test;
--
After this patch the compiler reports the following errors:
do_test.adb:6:17: (Ada 2005) private type declaration at line 4
                   must be limited
do_test.adb:21:19: prefix of "access" attribute must be aliased

2006-02-13  Javier Miranda  <miranda@adacore.com>

	* sem_ch9.adb (Analyze_Protected_Type, Analyze_Task_Type): Check that
	if this is the full-declaration associated with a private declaration
	that implement interfaces, then the private type declaration must be
	limited.
	(Analyze_Single_Protected, Analyze_Single_Task): Do not mark the object
	as aliased. The use of the 'access attribute is not available for such
	object (for this purpose the object should be explicitly marked as
	aliased, but being an anonymous type this is not possible).

Attachment: difs.75
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]