[Ada] Extend legality of Scalar_Storage_Order to formal types
commit8b55e70d2f62c12ce7bc3d3aecf795e7a3e001f8
authorEd Schonberg <schonberg@adacore.com>
Mon, 21 May 2018 14:50:06 +0000 (21 14:50 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Mon, 21 May 2018 14:50:06 +0000 (21 14:50 +0000)
tree17f41073b895892b4f7b9b1d8dca80b622adae42
parent66c0fa2cc9a2dbe62db5bed4fe5310d2e5912baf
[Ada] Extend legality of Scalar_Storage_Order to formal types

This patch extends the legality of the GNAT attribute Scalar_Storage_Order,
to apply to formal private types. Previously this extension applied only
in GNAT_Mode, to support instantiations of Ada.Sequential_IO, but it is more
generally useful.

The following must compile quietly:

----
with Memory_View_Generic;
procedure Main is
   type T is array (1..10) of integer;
   package OK is new Memory_View_Generic (T);

   type T2 is new Long_Float;
   package Wrong is new Memory_View_Generic (T2);
begin
   null;
end;
----
with System;
generic
   type Source_Type is private;
package Memory_View_Generic is
   -- various declarations ...
   SSO : System.Bit_Order := Source_Type'Scalar_Storage_Order;
end Memory_View_Generic;

2018-05-21  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* sem_attr.adb (Analyze_Attribute, case Scalar_Storage_Order): The
attribute reference is legal within a generic unit when the prefix is a
formal private type.

From-SVN: r260444
gcc/ada/ChangeLog
gcc/ada/sem_attr.adb