From 6aaab5081f44b00b78e9550b5a33ba81f85c162c Mon Sep 17 00:00:00 2001 From: Justin Squirek Date: Tue, 13 Aug 2019 08:07:41 +0000 Subject: [PATCH] [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 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 --- gcc/ada/ChangeLog | 6 ++++++ gcc/ada/repinfo.adb | 11 +++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 3acda6af652..ade7e68212d 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2019-08-13 Justin Squirek + + * 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 * aspects.adb, aspects.ads: Register new aspect. diff --git a/gcc/ada/repinfo.adb b/gcc/ada/repinfo.adb index 77b5c21c346..d168e90e0a9 100644 --- a/gcc/ada/repinfo.adb +++ b/gcc/ada/repinfo.adb @@ -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)); -- 2.30.2