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] |
This patch allows tagged incomplete types to be used in profiles of entries and entry bodies, without the presence of a regular with_clause on the package whose limited view provides those types. The following must compile quietly: gcc -c -gnat12 -gnatws tagged_half_1.adb --- limited with Half_2; package Half_1 is type Unseen_Ref is access all Half_2.Unseen; type Seen is record Value : Unseen_Ref; end record; function foo (Val : Seen) return Half_2.Unseen; function bar (Val : Half_2.Unseen) return Seen; procedure Baz (Val_1 : Half_2.Unseen; Val_2 : in out Half_2.Unseen; Val_3 : out Half_2.Unseen); type Tagged_Unseen_Ref is access all Half_2.Tagged_Unseen; type Tagged_Seen is tagged record Value : Tagged_Unseen_Ref; end record; end Half_1; --- with Half_1; use Half_1; package Half_2 is type Unseen is record Value : Seen; end record; type Tagged_Unseen is tagged record Value : Tagged_Seen; end record; end Half_2; --- with Half_2; package body Half_1 is function foo (Val : Seen) return Half_2.Unseen is begin return Val.Value.all; end; function bar (Val : Half_2.Unseen) return Seen is begin return Val.Value; end; procedure Baz (Val_1 : Half_2.Unseen; Val_2 : in out Half_2.Unseen; Val_3 : out Half_2.Unseen) is begin Val_3 := Val_2; Val_2 := Val_1; end; end Half_1; --- limited with Half_2; package Tagged_Half_1 is type Tagged_Unseen_Ref is access all Half_2.Tagged_Unseen; type Tagged_Seen is tagged record Value : Tagged_Unseen_Ref; end record; function bar (Val : Half_2.Tagged_Unseen) return Tagged_Seen; procedure Baz (Val_1 : Half_2.Tagged_Unseen; Val_2 : in out Half_2.Tagged_Unseen; Val_3 : out Half_2.Tagged_Unseen); function Faux return Boolean; end Tagged_Half_1; --- package body Tagged_Half_1 is -- Note that there's no "with Half_2;" here; we're still seeing the limited -- view. function Faux return Boolean is begin return False; end Faux; function bar (Val : Half_2.Tagged_Unseen) return Tagged_Seen is begin return Result : Tagged_Seen; end; procedure Baz (Val_1 : Half_2.Tagged_Unseen; Val_2 : in out Half_2.Tagged_Unseen; Val_3 : out Half_2.Tagged_Unseen) is begin if Faux then Baz (Val_1, Val_2, Val_3); end if; end; task T is entry E (Val_1 : Half_2.Tagged_Unseen; Val_2 : in out Half_2.Tagged_Unseen; Val_3 : out Half_2.Tagged_Unseen); end T; task body T is begin select accept E (Val_1 : Half_2.Tagged_Unseen; Val_2 : in out Half_2.Tagged_Unseen; Val_3 : out Half_2.Tagged_Unseen); or terminate; end select; end T; protected Prot is entry E (Val_1 : Half_2.Tagged_Unseen; Val_2 : in out Half_2.Tagged_Unseen; Val_3 : out Half_2.Tagged_Unseen); end Prot; protected body Prot is entry E (Val_1 : Half_2.Tagged_Unseen; Val_2 : in out Half_2.Tagged_Unseen; Val_3 : out Half_2.Tagged_Unseen) when True is begin Baz (Val_1, Val_2, Val_3); end E; end Prot; end Tagged_Half_1; Tested on x86_64-pc-linux-gnu, committed on trunk 2011-08-03 Ed Schonberg <schonberg@adacore.com> * exp_ch9.adb (Build_Renamed_Formal_Declaration): common procedure for protected entries and task entries, to build the proper renaming declaration for entry formals, used in debugging. * exp_ch2.adb (Expand_Entry_Parameter): handle task and entry parameters in the same way.
Attachment:
difs
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |