diff options
author | Robert Dewar <dewar@adacore.com> | 2007-04-06 11:25:29 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2007-04-06 11:25:29 +0200 |
commit | a9a5b8acd29597692a4df9323f790da0d7506c76 (patch) | |
tree | 5452d8d7f7de1a366e554e6d5ccd84c49ad180c9 /gcc/ada/repinfo.adb | |
parent | 2f41ec1a8fe5eab706ed223ab468de003d1995f0 (diff) | |
download | gcc-a9a5b8acd29597692a4df9323f790da0d7506c76.zip gcc-a9a5b8acd29597692a4df9323f790da0d7506c76.tar.gz gcc-a9a5b8acd29597692a4df9323f790da0d7506c76.tar.bz2 |
sem_ch13.ads, [...] (Adjust_Record_For_Reverse_Bit_Order): Use First/Next_Component_Or_Discriminant
2007-04-06 Robert Dewar <dewar@adacore.com>
* sem_ch13.ads, sem_ch13.adb (Adjust_Record_For_Reverse_Bit_Order):
Use First/Next_Component_Or_Discriminant
(Analyze_Record_Representation_Clause):
Use First/Next_Component_Or_Discriminant
(Check_Component_Overlap): Use First/Next_Component_Or_Discriminant
(Analyze_Attribute_Definition_Clause, case Value_Size): Reject
definition if type is unconstrained.
(Adjust_Record_For_Reverse_Bit_Order): New procedure
(Analyze_Attribute_Definition_Clause): Split Is_Abstract flag into
Is_Abstract_Subprogram and Is_Abstract_Type.
(Adjust_Record_For_Reverse_Bit_Order): New procedure
* repinfo.adb (List_Record_Info): Use First/
Next_Component_Or_Discriminant.
* style.ads, styleg-c.adb, styleg-c.ads (Check_Array_Attribute_Index):
New procedure.
* stylesw.ads, stylesw.adb: Recognize new -gnatyA style switch
Include -gnatyA in default switches
* opt.ads: (Warn_On_Non_Local_Exception): New flag
(Warn_On_Reverse_Bit_Order): New flag
(Extensions_Allowed): Update the documentation.
(Warn_On_Questionable_Missing_Parens): Now on by default
* usage.adb: Add documentation of -gnatw.x/X switches
Document new -gnatyA style switch
-gnatq warnings are on by default
From-SVN: r123590
Diffstat (limited to 'gcc/ada/repinfo.adb')
-rw-r--r-- | gcc/ada/repinfo.adb | 237 |
1 files changed, 115 insertions, 122 deletions
diff --git a/gcc/ada/repinfo.adb b/gcc/ada/repinfo.adb index 974dff4..f323442 100644 --- a/gcc/ada/repinfo.adb +++ b/gcc/ada/repinfo.adb @@ -784,172 +784,165 @@ package body Repinfo is Max_Name_Length := 0; Max_Suni_Length := 0; - Comp := First_Entity (Ent); + Comp := First_Component_Or_Discriminant (Ent); while Present (Comp) loop - if Ekind (Comp) = E_Component - or else Ekind (Comp) = E_Discriminant - then - Get_Decoded_Name_String (Chars (Comp)); - Max_Name_Length := Natural'Max (Max_Name_Length, Name_Len); - - Cfbit := Component_Bit_Offset (Comp); + Get_Decoded_Name_String (Chars (Comp)); + Max_Name_Length := Natural'Max (Max_Name_Length, Name_Len); - if Rep_Not_Constant (Cfbit) then - UI_Image_Length := 2; + Cfbit := Component_Bit_Offset (Comp); - else - -- Complete annotation in case not done + if Rep_Not_Constant (Cfbit) then + UI_Image_Length := 2; - Set_Normalized_Position (Comp, Cfbit / SSU); - Set_Normalized_First_Bit (Comp, Cfbit mod SSU); + else + -- Complete annotation in case not done - Sunit := Cfbit / SSU; - UI_Image (Sunit); - end if; + Set_Normalized_Position (Comp, Cfbit / SSU); + Set_Normalized_First_Bit (Comp, Cfbit mod SSU); - -- If the record is not packed, then we know that all fields whose - -- position is not specified have a starting normalized bit - -- position of zero + Sunit := Cfbit / SSU; + UI_Image (Sunit); + end if; - if Unknown_Normalized_First_Bit (Comp) - and then not Is_Packed (Ent) - then - Set_Normalized_First_Bit (Comp, Uint_0); - end if; + -- If the record is not packed, then we know that all fields whose + -- position is not specified have a starting normalized bit position + -- of zero. - Max_Suni_Length := - Natural'Max (Max_Suni_Length, UI_Image_Length); + if Unknown_Normalized_First_Bit (Comp) + and then not Is_Packed (Ent) + then + Set_Normalized_First_Bit (Comp, Uint_0); end if; - Comp := Next_Entity (Comp); + Max_Suni_Length := + Natural'Max (Max_Suni_Length, UI_Image_Length); + + Next_Component_Or_Discriminant (Comp); end loop; -- Second loop does actual output based on those values - Comp := First_Entity (Ent); + Comp := First_Component_Or_Discriminant (Ent); while Present (Comp) loop - if Ekind (Comp) = E_Component - or else Ekind (Comp) = E_Discriminant - then - declare - Esiz : constant Uint := Esize (Comp); - Bofs : constant Uint := Component_Bit_Offset (Comp); - Npos : constant Uint := Normalized_Position (Comp); - Fbit : constant Uint := Normalized_First_Bit (Comp); - Lbit : Uint; + declare + Esiz : constant Uint := Esize (Comp); + Bofs : constant Uint := Component_Bit_Offset (Comp); + Npos : constant Uint := Normalized_Position (Comp); + Fbit : constant Uint := Normalized_First_Bit (Comp); + Lbit : Uint; + + begin + Write_Str (" "); + Get_Decoded_Name_String (Chars (Comp)); + Set_Casing (Unit_Casing); + Write_Str (Name_Buffer (1 .. Name_Len)); - begin - Write_Str (" "); - Get_Decoded_Name_String (Chars (Comp)); - Set_Casing (Unit_Casing); - Write_Str (Name_Buffer (1 .. Name_Len)); + for J in 1 .. Max_Name_Length - Name_Len loop + Write_Char (' '); + end loop; - for J in 1 .. Max_Name_Length - Name_Len loop - Write_Char (' '); - end loop; + Write_Str (" at "); - Write_Str (" at "); + if Known_Static_Normalized_Position (Comp) then + UI_Image (Npos); + Spaces (Max_Suni_Length - UI_Image_Length); + Write_Str (UI_Image_Buffer (1 .. UI_Image_Length)); - if Known_Static_Normalized_Position (Comp) then - UI_Image (Npos); - Spaces (Max_Suni_Length - UI_Image_Length); - Write_Str (UI_Image_Buffer (1 .. UI_Image_Length)); + elsif Known_Component_Bit_Offset (Comp) + and then List_Representation_Info = 3 + then + Spaces (Max_Suni_Length - 2); + Write_Str ("bit offset"); + Write_Val (Bofs, Paren => True); + Write_Str (" size in bits = "); + Write_Val (Esiz, Paren => True); + Write_Eol; + goto Continue; + + elsif Known_Normalized_Position (Comp) + and then List_Representation_Info = 3 + then + Spaces (Max_Suni_Length - 2); + Write_Val (Npos); - elsif Known_Component_Bit_Offset (Comp) - and then List_Representation_Info = 3 - then - Spaces (Max_Suni_Length - 2); - Write_Str ("bit offset"); - Write_Val (Bofs, Paren => True); - Write_Str (" size in bits = "); - Write_Val (Esiz, Paren => True); - Write_Eol; + else + -- For the packed case, we don't know the bit positions if we + -- don't know the starting position! + + if Is_Packed (Ent) then + Write_Line ("?? range ? .. ??;"); goto Continue; - elsif Known_Normalized_Position (Comp) - and then List_Representation_Info = 3 - then - Spaces (Max_Suni_Length - 2); - Write_Val (Npos); + -- Otherwise we can continue else - -- For the packed case, we don't know the bit positions - -- if we don't know the starting position! - - if Is_Packed (Ent) then - Write_Line ("?? range ? .. ??;"); - goto Continue; - - -- Otherwise we can continue - - else - Write_Str ("??"); - end if; + Write_Str ("??"); end if; + end if; - Write_Str (" range "); - UI_Write (Fbit); - Write_Str (" .. "); + Write_Str (" range "); + UI_Write (Fbit); + Write_Str (" .. "); - -- Allowing Uint_0 here is a kludge, really this should be a - -- fine Esize value but currently it means unknown, except that - -- we know after gigi has back annotated that a size of zero is - -- real, since otherwise gigi back annotates using No_Uint as - -- the value to indicate unknown). + -- Allowing Uint_0 here is a kludge, really this should be a + -- fine Esize value but currently it means unknown, except that + -- we know after gigi has back annotated that a size of zero is + -- real, since otherwise gigi back annotates using No_Uint as + -- the value to indicate unknown). - if (Esize (Comp) = Uint_0 or else Known_Static_Esize (Comp)) - and then Known_Static_Normalized_First_Bit (Comp) - then - Lbit := Fbit + Esiz - 1; + if (Esize (Comp) = Uint_0 or else Known_Static_Esize (Comp)) + and then Known_Static_Normalized_First_Bit (Comp) + then + Lbit := Fbit + Esiz - 1; - if Lbit < 10 then - Write_Char (' '); - end if; + if Lbit < 10 then + Write_Char (' '); + end if; - UI_Write (Lbit); + UI_Write (Lbit); - -- The test for Esize (Comp) not being Uint_0 here is a kludge. - -- Officially a value of zero for Esize means unknown, but here - -- we use the fact that we know that gigi annotates Esize with - -- No_Uint, not Uint_0. Really everyone should use No_Uint??? + -- The test for Esize (Comp) not being Uint_0 here is a kludge. + -- Officially a value of zero for Esize means unknown, but here + -- we use the fact that we know that gigi annotates Esize with + -- No_Uint, not Uint_0. Really everyone should use No_Uint??? - elsif List_Representation_Info < 3 - or else (Esize (Comp) /= Uint_0 and then Unknown_Esize (Comp)) - then - Write_Str ("??"); + elsif List_Representation_Info < 3 + or else (Esize (Comp) /= Uint_0 and then Unknown_Esize (Comp)) + then + Write_Str ("??"); - else -- List_Representation >= 3 and Known_Esize (Comp) + -- List_Representation >= 3 and Known_Esize (Comp) - Write_Val (Esiz, Paren => True); + else + Write_Val (Esiz, Paren => True); - -- If in front end layout mode, then dynamic size is stored - -- in storage units, so renormalize for output + -- If in front end layout mode, then dynamic size is stored + -- in storage units, so renormalize for output - if not Back_End_Layout then - Write_Str (" * "); - Write_Int (SSU); - end if; + if not Back_End_Layout then + Write_Str (" * "); + Write_Int (SSU); + end if; - -- Add appropriate first bit offset + -- Add appropriate first bit offset - if Fbit = 0 then - Write_Str (" - 1"); + if Fbit = 0 then + Write_Str (" - 1"); - elsif Fbit = 1 then - null; + elsif Fbit = 1 then + null; - else - Write_Str (" + "); - Write_Int (UI_To_Int (Fbit) - 1); - end if; + else + Write_Str (" + "); + Write_Int (UI_To_Int (Fbit) - 1); end if; + end if; - Write_Line (";"); - end; - end if; + Write_Line (";"); + end; <<Continue>> - Comp := Next_Entity (Comp); + Next_Component_Or_Discriminant (Comp); end loop; Write_Line ("end record;"); |