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 implements delay of all aspects till the freeze point as finally decided in the Ada 2012 design. It also corrects a couple of errors in handling delayed aspects (now that we have many more of them, these errors showed up). Here is a test program (compiled with -gnatws) 1. pragma Ada_2012; 2. with Ada.Text_IO; use Ada.Text_IO; 3. procedure DelayAllAspect is 4. Outer_X : constant Integer := 8; 5. Outer_Y : constant Integer := 8; 6. 7. package X1 is 8. type X1T is range 1 .. 2 with 9. Size => Outer_X; 10. Outer_X : constant Integer := 16; 11. end; 12. 13. package X2 is 14. type X2T is range 1 .. 2 with 15. Size => Outer_X; 16. V2T : X2T; -- freezes 17. Outer_X : constant Integer := 16; 18. -- Should give error! 19. end X2; 20. 21. package X3 is 22. type X3T is range 1 .. 2 with 23. Size => Outer_X + Outer_Y; 24. Outer_Y : constant Integer := 24; 25. V3T : X3T; -- freezes 26. Outer_X : constant Integer := 40; 27. -- Should give error! 28. end X3; 29. 30. begin 31. Put_Line (X1.X1T'Size'Img & " should be 16"); 32. Put_Line (X2.X2T'Size'Img & " should be 8"); 33. Put_Line (X3.X3T'Size'Img & " should be 32"); 34. end DelayAllAspect; The output with this patch is: 16 should be 16 8 should be 8 32 should be 32 Note the two lines marked "Should give error", These reflect the requirement under discussion that if the freeze point is before the end of the declarative region, and the visibility changes between the freeze point and the end of this region, the program is illegal. This seems very hard to do, and we will wait on this till (a) the final decision is to go in this direction and (b) we figure out how the heck to implement this (sees awfully difficult). Tested on x86_64-pc-linux-gnu, committed on trunk 2011-08-01 Robert Dewar <dewar@adacore.com> * aspects.ads (Boolean_Aspects): New subtype. * exp_ch13.adb (Expand_Freeze_Entity): Fix errors in handling aspects for derived types in cases where the parent type and derived type have aspects. * freeze.adb (Freeze_Entity): Fix problems in handling derived type with aspects when parent type also has aspects. (Freeze_Entity): Deal with delay of boolean aspects (must evaluate boolean expression at this point). * sem_ch13.adb (Analyze_Aspect_Specifications): Delay all aspects in accordance with final decision on the Ada 2012 feature. * sinfo.ads, sinfo.adb (Is_Boolean_Aspect): New flag.
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] |