Commit d403cfad by Bob Duff Committed by Pierre-Marie de Rodat

[Ada] Process type extensions for -gnatw.h

This patch enables gap detection in type extensions.

With the -gnatw.h switch, on 64-bit machines,
the following test should get warnings:

gcc -c gaps.ads -gnatw.h
gaps.ads:16:07: warning: 48-bit gap before component "Comp2"
gaps.ads:17:07: warning: 8-bit gap before component "Comp3"

package Gaps is
   type Integer_16 is mod 2**16;

   type TestGap is tagged record
      Comp1 : Integer_16;
   end record;
   for TestGap use record
      Comp1 at 0 + 8 range 0..15;
   end record;

   type TestGap2 is new TestGap with record
      Comp2  : Integer_16;
      Comp3  : Integer_16;
   end record;
   for TestGap2 use record
      Comp2 at 08 + 8 range 0..15;
      Comp3 at 11 + 8 range 0..15;
   end record;

end Gaps;

2019-08-19  Bob Duff  <duff@adacore.com>

gcc/ada/

	* sem_ch13.adb (Record_Hole_Check): Procedure to check for holes
	that incudes processing type extensions. A type extension is
	processed by first calling Record_Hole_Check recursively on the
	parent type to compute the bit number after the last component
	of the parent.

From-SVN: r274653
parent eb6b9c9b
2019-08-19 Bob Duff <duff@adacore.com>
* sem_ch13.adb (Record_Hole_Check): Procedure to check for holes
that incudes processing type extensions. A type extension is
processed by first calling Record_Hole_Check recursively on the
parent type to compute the bit number after the last component
of the parent.
2019-08-19 Gary Dismukes <dismukes@adacore.com> 2019-08-19 Gary Dismukes <dismukes@adacore.com>
* checks.adb (Length_Mismatch_Info_Message): New function in * checks.adb (Length_Mismatch_Info_Message): New function in
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment