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 includes the Small and Range for fixed-point types, and also improves the UR_Write routine used for this purpose to catch many more cases where values can be printed as literals. Also in the context of sprint output, expressions for values that cannot be printed as literals are surrounded by square brackets [] instead of ambiguous parentheses. The following test program: package fixrep is type f1 is delta 1.0 range 0.0 .. 255.0; type f2 is delta 0.5 range 0.0 .. 128.0; type f3 is delta 1.0 / 3.0 range 0.0 .. 30.4; type f4 is delta 1.0 / 3.0 range 0.0 .. 30.4; for f4'small use 1.0 / 3.0; type f5 is delta 0.6 range 0.0 .. 1000.0; type f6 is delta 0.6 range 0.0 .. 1000.0; for f6'small use 0.6; end; Generates the following -gnatR2 output: Representation information for unit fixrep (spec) for f1'Size use 8; for f1'Alignment use 1; for f1'Small use 1.0; for f1'Range use 0.0 .. 255.0; for f2'Size use 8; for f2'Alignment use 1; for f2'Small use 0.5; for f2'Range use 0.0 .. 127.5; for f3'Object_Size use 8; for f3'Value_Size use 7; for f3'Alignment use 1; for f3'Small use 0.25; for f3'Range use 0.0 .. 30.5; for f4'Object_Size use 8; for f4'Value_Size use 7; for f4'Alignment use 1; for f4'Small use 1.0/3.0; for f4'Range use 0.0 .. 92.0/3.0; for f5'Object_Size use 16; for f5'Value_Size use 11; for f5'Alignment use 2; for f5'Small use 0.5; for f5'Range use 0.0 .. 1000.0; for f6'Object_Size use 16; for f6'Value_Size use 11; for f6'Alignment use 2; for f6'Small use 0.6; for f6'Range use 0.0 .. 1000.2; Tested on x86_64-pc-linux-gnu, committed on trunk 2010-09-10 Robert Dewar <dewar@adacore.com> * repinfo.adb (List_Type_Info): List Small and Range for fixed-point types. * sprint.adb (Write_Ureal_With_Col_Check_Sloc): Use square brackets rather than parens for fixed constants. * sprint.ads: Use square brackets rather than parens for fixed constants * urealp.adb (UR_Write): Use square brackets rather than parens (UR_Write): Add Brackets argument (UR_Write): Add many more special cases to output literals * urealp.ads (UR_Write): Use square brackets rather than parens (UR_Write): Add Brackets argument
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] |