[Ada] Show Bit_Order and Scalar_Storage_Order in -gnatR4 output

This patch modifies the behavior of -gnatR4 so that representation
information for bit and scalar storage order gets displayed in all cases
and not just when defaults are overriden.

------------
-- Source --
------------

--  pkg.ads

package Pkg is
   type Root is tagged record
     Data0 : Integer;
   end record;

   type Derived is new Root with record
      Data1 : Integer;
   end record;
end Pkg;

-----------------
-- Compilation --
-----------------

$ gnatmake -gnatR4 pkg.ads

Representation information for unit Pkg (spec)
----------------------------------------------

for Root'Size use 128;
for Root'Alignment use 8;
for Root use record
   Data0 at 8 range  0 .. 31;
end record;
for Root'Bit_Order use System.Low_Order_First;
for Root'Scalar_Storage_Order use System.Low_Order_First;

for Trootc'Size use 0;
for Trootc'Alignment use 0;
for Trootc use record
end record;
for Trootc'Bit_Order use System.Low_Order_First;
for Trootc'Scalar_Storage_Order use System.Low_Order_First;

for Derived'Size use 192;
for Derived'Alignment use 8;
for Derived use record
   Data0 at  8 range  0 .. 31;
   Data1 at 16 range  0 .. 31;
end record;
for Derived'Bit_Order use System.Low_Order_First;
for Derived'Scalar_Storage_Order use System.Low_Order_First;

for Tderivedc'Size use 0;
for Tderivedc'Alignment use 0;
for Tderivedc use record
   Data0 at  8 range  0 .. 31;
   Data1 at 16 range  0 .. 31;
end record;
for Tderivedc'Bit_Order use System.Low_Order_First;
for Tderivedc'Scalar_Storage_Order use System.Low_Order_First;i

2019-08-13  Justin Squirek  <squirek@adacore.com>

gcc/ada/

	* repinfo.adb (List_Scalar_Storage_Order): Modify conditionals
	for displaying ordering to always be triggered when -gnatR4 is
	in effect.

From-SVN: r274347
This commit is contained in:
Justin Squirek 2019-08-13 08:07:41 +00:00 committed by Pierre-Marie de Rodat
parent 4de811c54e
commit 6aaab5081f
2 changed files with 15 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2019-08-13 Justin Squirek <squirek@adacore.com>
* repinfo.adb (List_Scalar_Storage_Order): Modify conditionals
for displaying ordering to always be triggered when -gnatR4 is
in effect.
2019-08-13 Justin Squirek <squirek@adacore.com>
* aspects.adb, aspects.ads: Register new aspect.

View File

@ -1816,8 +1816,15 @@ package body Repinfo is
begin
-- For record types, list Bit_Order if not default, or if SSO is shown
-- Also, when -gnatR4 is in effect always list bit order and scalar
-- storage order explicitly, so that you don't need to know the native
-- endianness of the target for which the output was produced in order
-- to interpret it.
if Is_Record_Type (Ent)
and then (List_SSO or else Reverse_Bit_Order (Ent))
and then (List_SSO
or else Reverse_Bit_Order (Ent)
or else List_Representation_Info = 4)
then
List_Attr ("Bit_Order", Reverse_Bit_Order (Ent));
end if;
@ -1825,7 +1832,7 @@ package body Repinfo is
-- List SSO if required. If not, then storage is supposed to be in
-- native order.
if List_SSO then
if List_SSO or else List_Representation_Info = 4 then
List_Attr ("Scalar_Storage_Order", Reverse_Storage_Order (Ent));
else
pragma Assert (not Reverse_Storage_Order (Ent));