[Ada] Extend pragma Implicit_Packing for records to composite components

Eric Botcazou ebotcazou@adacore.com
Mon May 16 11:21:00 GMT 2016


The implementation of pragma Implicit_Packing for record types was restricted
to scalar components, i.e. it gave up as soon as there was one non-scalar
component in the record type.  This change extends it to all the other kinds
of components, at least if they are small.

The following package must compile quietly:

pragma Implicit_Packing;

package P is

  type Rec1 is record
    B : Boolean;
  end record;
  for Rec1'Size use 1;

  type Rec2 is record
    B : Boolean;
    R : Rec1;
  end record;
  for Rec2'Size use 2;

  type Rec3 is record
    B : Boolean;
    R : Rec2;
  end record;
  for Rec3'Size use 3;

end P;


Tested on x86_64-suse-linux, applied on the mainline.


2016-05-16  Eric Botcazou  <ebotcazou@adacore.com>

	* freeze.adb (Freeze_Record_Type): Extend pragma Implicit_Packing to
	components of any elementary types and of composite types.

-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-patch
Size: 5069 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20160516/3fb02e75/attachment.bin>


More information about the Gcc-patches mailing list