diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2012-10-29 12:41:01 +0100 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2012-10-29 12:41:01 +0100 |
commit | 6db566c308dd9ecf9e82938d7bec32884a596e74 (patch) | |
tree | 3beb37af116d2dcf9f705e6d213741c7822895b3 /gcc/ada/xoscons.adb | |
parent | 43254605cb483d1f7fd5f8df8390d29e4442ba4e (diff) | |
download | gcc-6db566c308dd9ecf9e82938d7bec32884a596e74.zip gcc-6db566c308dd9ecf9e82938d7bec32884a596e74.tar.gz gcc-6db566c308dd9ecf9e82938d7bec32884a596e74.tar.bz2 |
[multiple changes]
2012-10-29 Robert Dewar <dewar@adacore.com>
* gnat_rm.texi: Document that pragma Optimize_Alignment (Space) is
ignored with a warning for packed variable length records.
2012-10-29 Thomas Quinot <quinot@adacore.com>
* socket.c, g-socthi-dummy.adb, g-socthi-dummy.ads, g-socthi-vms.adb,
g-socthi-vms.ads, g-socthi-vxworks.adb, g-socthi-vxworks.ads,
s-oscons-tmplt.c, g-socthi-mingw.adb, g-socthi-mingw.ads, g-socthi.adb,
g-socthi.ads, xoscons.adb, g-socket.adb, g-sothco.ads: Introduce an
appropriate subtype for IOCTL requests, since these may be signed or
unsigned.
From-SVN: r192939
Diffstat (limited to 'gcc/ada/xoscons.adb')
-rw-r--r-- | gcc/ada/xoscons.adb | 121 |
1 files changed, 72 insertions, 49 deletions
diff --git a/gcc/ada/xoscons.adb b/gcc/ada/xoscons.adb index 90d1b2d..4c58eba 100644 --- a/gcc/ada/xoscons.adb +++ b/gcc/ada/xoscons.adb @@ -76,6 +76,7 @@ procedure XOSCons is CNU, -- Named number (decimal, unsigned) CNS, -- Named number (freeform text) C, -- Constant object + SUB, -- Subtype TXT); -- Literal text -- Recognized markers found in assembly file. These markers are produced by -- the same-named macros from the C template. @@ -181,65 +182,84 @@ procedure XOSCons is -- Start of processing for Output_Info begin - -- Case of non-TXT case (TXT case handled by common code below) + case Info.Kind is + when TXT => - if Info.Kind /= TXT then - case Lang is - when Lang_Ada => - Put (" " & Info.Constant_Name.all); - Put (Spaces (Max_Constant_Name_Len - - Info.Constant_Name'Length)); + -- Handled in the common code for comments below - if Info.Kind in Named_Number then - Put (" : constant := "); - else - Put (" : constant " & Info.Constant_Type.all); - Put (Spaces (Max_Constant_Type_Len - - Info.Constant_Type'Length)); - Put (" := "); - end if; + null; - when Lang_C => - Put ("#define " & Info.Constant_Name.all & " "); - Put (Spaces (Max_Constant_Name_Len - - Info.Constant_Name'Length)); - end case; + when SUB => + case Lang is + when Lang_Ada => + Put (" subtype " & Info.Constant_Name.all + & " is Interfaces.C." + & Info.Text_Value.all & ";"); + when Lang_C => + Put ("#define " & Info.Constant_Name.all & " " + & Info.Text_Value.all); + end case; - if Info.Kind in Asm_Int_Kind then - if not Info.Int_Value.Positive then - Put ("-"); - end if; + when others => - Put (Trim (Info.Int_Value.Abs_Value'Img, Side => Left)); + -- All named number cases + + case Lang is + when Lang_Ada => + Put (" " & Info.Constant_Name.all); + Put (Spaces (Max_Constant_Name_Len + - Info.Constant_Name'Length)); + + if Info.Kind in Named_Number then + Put (" : constant := "); + else + Put (" : constant " & Info.Constant_Type.all); + Put (Spaces (Max_Constant_Type_Len + - Info.Constant_Type'Length)); + Put (" := "); + end if; - else - declare - Is_String : constant Boolean := - Info.Kind = C - and then Info.Constant_Type.all = "String"; - - begin - if Is_String then - Put (""""); + when Lang_C => + Put ("#define " & Info.Constant_Name.all & " "); + Put (Spaces (Max_Constant_Name_Len + - Info.Constant_Name'Length)); + end case; + + if Info.Kind in Asm_Int_Kind then + if not Info.Int_Value.Positive then + Put ("-"); end if; - Put (Info.Text_Value.all); + Put (Trim (Info.Int_Value.Abs_Value'Img, Side => Left)); - if Is_String then - Put (""""); - end if; - end; - end if; + else + declare + Is_String : constant Boolean := + Info.Kind = C + and then Info.Constant_Type.all = "String"; + + begin + if Is_String then + Put (""""); + end if; - if Lang = Lang_Ada then - Put (";"); + Put (Info.Text_Value.all); - if Info.Comment'Length > 0 then - Put (Spaces (Max_Constant_Value_Len - Info.Value_Len)); - Put (" -- "); + if Is_String then + Put (""""); + end if; + end; end if; - end if; - end if; + + if Lang = Lang_Ada then + Put (";"); + + if Info.Comment'Length > 0 then + Put (Spaces (Max_Constant_Value_Len - Info.Value_Len)); + Put (" -- "); + end if; + end if; + end case; if Lang = Lang_Ada then Put (Info.Comment.all); @@ -349,13 +369,16 @@ procedure XOSCons is Integer (Parse_Int (Line (Index1 .. Index2 - 1), CNU).Abs_Value); case Info.Kind is - when CND | CNU | CNS | C => + when CND | CNU | CNS | C | SUB => Index1 := Index2 + 1; Find_Colon (Index2); Info.Constant_Name := Field_Alloc; - if Info.Constant_Name'Length > Max_Constant_Name_Len then + if Info.Kind /= SUB + and then + Info.Constant_Name'Length > Max_Constant_Name_Len + then Max_Constant_Name_Len := Info.Constant_Name'Length; end if; |