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 fixes a bug, and improves an error message for the handling of the check that the values in an enumeration representation clause are consistent with a previously given size clause. The improvement has to do with the error message given when a literal value is too large for a previously given size clause. This message now gives the size and the value involoved, as shown in this example: 1. package BadSizeRep is 2. type Signal1 is (OFF, STANDBY, ON); 3. for Signal1'Size use 5; 4. for Signal1 use (OFF => 16#00000#, 5. STANDBY => 16#01010#, 6. ON => 16#11011#); | >>> previously given size (5) is too small for this value (69649) 7. type Signal2 is (OFF, STANDBY, ON); 8. for Signal2 use (OFF => 16#00000#, 9. STANDBY => 16#01010#, 10. ON => 16#11011#); 11. for Signal2'Size use 5; | >>> size for "Signal2" too small, minimum allowed is 17 12. end BadSizeRep; Second the bug, the code was testing Esize instead of RM_Size meaning that the error shown in this example was not caught: 1. package badenumcheck is 2. type a is (b, c); 3. for a'size use 3; 4. for a use (1, 9); | >>> previously given size (3) is too small for this value (9) 5. end badenumcheck; Tested on x86_64-pc-linux-gnu, committed on trunk 2010-10-04 Robert Dewar <dewar@adacore.com> * sem_ch13.adb (Analyze_Enumeration_Representation_Clause): Set Enumeration_Rep_Expr to point to the literal, not the identifier. (Analyze_Enumeration_Representation_Clause): Improve error message for size too small for enum rep value (Analyze_Enumeration_Representation_Clause): Fix size test to use proper size (RM_Size, not Esize).
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] |