aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/doc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2020-04-13 11:10:43 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2020-06-17 04:14:04 -0400
commit741826eff5855366c65d49123b899ea40fc0c443 (patch)
treef5540a6179e08cdf3f363c3081d9f2118b1c9632 /gcc/ada/doc
parentd27ec3f60a3ac5eab05765cbbf45083e4e3dabc6 (diff)
downloadgcc-741826eff5855366c65d49123b899ea40fc0c443.zip
gcc-741826eff5855366c65d49123b899ea40fc0c443.tar.gz
gcc-741826eff5855366c65d49123b899ea40fc0c443.tar.bz2
[Ada] Adjust documentation of 'Bit and 'Descriptor_Size attributes
2020-06-17 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * doc/gnat_rm/implementation_defined_attributes.rst (Bit): Sharpen the comparison with System.Storage_Unit. (Descriptor_Size): Clear confusion about alignment and padding. * gnat_rm.texi: Regenerate.
Diffstat (limited to 'gcc/ada/doc')
-rw-r--r--gcc/ada/doc/gnat_rm/implementation_defined_attributes.rst16
1 files changed, 9 insertions, 7 deletions
diff --git a/gcc/ada/doc/gnat_rm/implementation_defined_attributes.rst b/gcc/ada/doc/gnat_rm/implementation_defined_attributes.rst
index e285ebc..cfde81e 100644
--- a/gcc/ada/doc/gnat_rm/implementation_defined_attributes.rst
+++ b/gcc/ada/doc/gnat_rm/implementation_defined_attributes.rst
@@ -93,8 +93,8 @@ Attribute Bit
``obj'Bit``, where ``obj`` is any object, yields the bit
offset within the storage unit (byte) that contains the first bit of
storage allocated for the object. The value of this attribute is of the
-type *universal_integer*, and is always a non-negative number not
-exceeding the value of ``System.Storage_Unit``.
+type *universal_integer* and is always a nonnegative number smaller
+than ``System.Storage_Unit``.
For an object that is a variable or a constant allocated in a register,
the value is zero. (The use of this attribute does not force the
@@ -241,14 +241,16 @@ the first element of the array.
.. code-block:: ada
- type Unconstr_Array is array (Positive range <>) of Boolean;
+ type Unconstr_Array is array (Short_Short_Integer range <>) of Positive;
Put_Line ("Descriptor size = " & Unconstr_Array'Descriptor_Size'Img);
-The attribute takes into account any additional padding due to type alignment.
-In the example above, the descriptor contains two values of type
-``Positive`` representing the low and high bound. Since ``Positive`` has
-a size of 31 bits and an alignment of 4, the descriptor size is ``2 * Positive'Size + 2`` or 64 bits.
+The attribute takes into account any padding due to the alignment of the
+component type. In the example above, the descriptor contains two values
+of type ``Short_Short_Integer`` representing the low and high bound. But,
+since ``Positive`` has an alignment of 4, the size of the descriptor is
+``2 * Short_Short_Integer'Size`` rounded up to the next multiple of 32,
+which yields a size of 32 bits, i.e. including 16 bits of padding.
Attribute Elaborated
====================