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 AI05-0009, which describes two new pragmas, Independent and Independent_Components. The following examples show these pragmas in action: 1. package Indeperr is 2. -- Incorrect syntax cases 3. 4. type R is record 5. a : Integer; 6. pragma Independent (a); -- OK 7. b : Integer; 8. pragma Independent_Components (b); -- ERROR | >>> inappropriate entity for pragma "Independent_Components" 9. end record; 10. 11. a : integer; 12. pragma Independent (a); -- OK 13. 14. b : integer; 15. pragma Independent_Components (b); -- ERROR | >>> inappropriate entity for pragma "Independent_Components" 16. 17. xxx : exception; 18. pragma Independent (xxx); -- ERROR | >>> inappropriate entity for pragma "Independent" 19. end; 1. package Indeperrx is 2. -- Cases of independence not guaranteed 3. 4. a : integer; 5. pragma Independent (a); -- OK 6. 7. x : array (1 .. 10) of integer; 8. pragma Independent_Components (x); -- OK 9. 10. b1 : array (1 .. 10) of Boolean; 11. pragma Independent_Components (b1); -- OK 12. 13. type b2 is array (1 .. 10) of Boolean; 14. pragma Independent_Components (b2); -- ERROR | >>> independent components cannot be guaranteed for "b2" >>> because of pragma Pack at line 15 15. pragma Pack (b2); 16. 17. type b3 is array (1 .. 10) of Boolean; 18. pragma Independent_Components (b3); -- ERROR | >>> independent components cannot be guaranteed for "b3" >>> because of Component_Size clause at line 19 19. for b3'Component_Size use 1; 20. 21. type b4 is array (1 .. 10) of Boolean; 22. pragma Independent_Components (b4); -- OK 23. for b4'Component_Size use 16; 24. 25. v1 : Integer; 26. v2 : integer; 27. for v2'address use v1'address; 28. pragma Independent (v2); -- ERROR | >>> independence cannot be guaranteed for "v2" >>> because of Address clause at line 27 29. 30. type rr1 is record 31. A, B : Character; 32. end record; 33. pragma Independent_Components (RR1); -- OK 34. 35. type rr2 is record 36. A, B : Character; 37. end record; 38. pragma Independent_Components (RR2); -- OK 39. 40. for RR2 use record 41. A at 0 range 0 .. 31; 42. B at 4 range 0 .. 31; 43. end record; 44. 45. type rr3 is record 46. A, B : Character; 47. end record; 48. pragma Independent_Components (RR3); -- ERROR | >>> independent components cannot be guaranteed for "rr3" >>> because of Component_Clause at line 51 49. 50. for RR3 use record 51. A at 0 range 0 .. 9; 52. B at 0 range 10 .. 19; 53. end record; 54. 55. type rr4 is record 56. A, B : Boolean; 57. pragma Independent (A); -- OK 58. end record; 59. 60. type rr5 is record 61. A, B : Boolean; 62. pragma Independent (A); -- ERROR | >>> independence cannot be guaranteed for "A" >>> because of pragma Pack at line 64 63. end record; 64. pragma Pack (rr5); 65. 66. type rr6 is record 67. A, B : Boolean; 68. pragma Independent (B); -- ERROR | >>> independence cannot be guaranteed for "B" >>> because of Component_Clause at line 73 69. end record; 70. 71. for rr6 use record 72. A at 0 range 0 .. 3; 73. B at 0 range 4 .. 7; 74. end record; 75. 76. type rr7 is record 77. A : Integer; 78. pragma Independent (A); -- ERROR | >>> independence cannot be guaranteed for "A" >>> because of Alignment clause at line 81 79. B : Integer; 80. end record; 81. for rr7'Alignment use 1; 82. 83. 84. end; Tested on x86_64-pc-linux-gnu, committed on trunk 2010-10-08 Robert Dewar <dewar@adacore.com> * gnat1drv.adb: Add call to Validate_Independence. * par-prag.adb: Add dummy entries for Independent, Independent_Componentsa. * sem_ch13.adb (Validate_Independence): New procedure (Initialize): Initialize address clause and independence check tables * sem_ch13.ads (Independence_Checks): New table (Validate_Independence): New procedure * sem_prag.adb: Add processing for pragma Independent[_Components] * snames.ads-tmpl: Add entries for pragma Independent[_Components]
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] |