public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Show Bit_Order and Scalar_Storage_Order in -gnatR4 output
@ 2019-08-13  8:32 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2019-08-13  8:32 UTC (permalink / raw)
  To: gcc-patches; +Cc: Justin Squirek

[-- Attachment #1: Type: text/plain, Size: 1785 bytes --]

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

Tested on x86_64-pc-linux-gnu, committed on trunk

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.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 1147 bytes --]

--- gcc/ada/repinfo.adb
+++ 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));


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-08-13  8:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-13  8:32 [Ada] Show Bit_Order and Scalar_Storage_Order in -gnatR4 output Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).