aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/layout.adb
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2019-07-03 08:14:33 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-07-03 08:14:33 +0000
commitbf4f18bded58c7710276877ea8648b12ac3088be (patch)
tree7cbe0b4c236de9c2c629eca88882ca2bb9cb7573 /gcc/ada/layout.adb
parent1f159b86c1e9ca2df09d6655fc9ad836d5c133e9 (diff)
downloadgcc-bf4f18bded58c7710276877ea8648b12ac3088be.zip
gcc-bf4f18bded58c7710276877ea8648b12ac3088be.tar.gz
gcc-bf4f18bded58c7710276877ea8648b12ac3088be.tar.bz2
[Ada] Extend -gnatw.z warning to array types
The -gnatw.z switch causes the compiler to issue a warning on record types subject to both an alignment clause and a size clause, when the specified size is not a multiple of the alignment in bits, because this means that the Object_Size will be strictly larger than the specified size. It makes sense to extend this warning to array types, but not to the cases of bit-packed arrays where the size is not a multiple of storage unit and the specified alignment is the minimum one, because there would be no way to get rid of it apart from explicitly silencing it. The compiler must issue the warning: p.ads:5:03: warning: size is not a multiple of alignment for "Triplet" p.ads:5:03: warning: size of 24 specified at line 4 p.ads:5:03: warning: Object_Size will be increased to 32 on the following package: package P is type Triplet is new String (1 .. 3); for Triplet'Size use 24; for Triplet'Alignment use 4; type Arr is array (1 .. 7) of Boolean; pragma Pack (Arr); for Arr'Size use 7; for Arr'Alignment use 1; end P; 2019-07-03 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * doc/gnat_ugn/building_executable_programs_with_gnat.rst (Warning message control): Document that -gnatw.z/Z apply to array types. * freeze.adb (Freeze_Entity): Give -gnatw.z warning for array types as well, but not if the specified alignment is the minimum one. * gnat_ugn.texi: Regenerate. From-SVN: r272971
Diffstat (limited to 'gcc/ada/layout.adb')
0 files changed, 0 insertions, 0 deletions