summaryrefslogtreecommitdiff
path: root/gcc/ada/sem_attr.ads
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/sem_attr.ads')
-rw-r--r--gcc/ada/sem_attr.ads33
1 files changed, 27 insertions, 6 deletions
diff --git a/gcc/ada/sem_attr.ads b/gcc/ada/sem_attr.ads
index 71ac668c757..7258593aabf 100644
--- a/gcc/ada/sem_attr.ads
+++ b/gcc/ada/sem_attr.ads
@@ -554,12 +554,33 @@ package Sem_Attr is
-------------------
Attribute_Valid_Scalars => True,
- -- Obj'Valid_Scalars applies to objects of scalar types, on which it is
- -- equivalent to Obj'Valid, and objects of array and record types, on
- -- which it amounts to applying 'Valid to each subcomponent of Obj. It
- -- does not apply to prefixes of classwide type, or of a formal generic
- -- type that has an unknown discriminant (which could be instantiated
- -- with a classwide type).
+ -- Obj'Valid_Scalars can be applied to any object. The result depends
+ -- on the type of the object:
+ --
+ -- For a scalar type, the result is the same as obj'Valid
+ --
+ -- For an array object, the result is True if the result of applying
+ -- Valid_Scalars to every component is True. For an empty array the
+ -- result is True.
+ --
+ -- For a record object, the result is True if the result of applying
+ -- Valid_Scalars to every component is True. For class-wide types,
+ -- only the components of the base type are checked. For variant
+ -- records, only the components actually present are checked. The
+ -- discriminants, if any, are also checked. If there are no components
+ -- or discriminants, the result is True.
+ --
+ -- For any other type that has discriminants, the result is True if
+ -- the result of applying Valid_Scalars to each discriminant is True.
+ --
+ -- For all other types, the result is always True
+ --
+ -- A warning is given for a trivially True result, when the attribute
+ -- is applied to an object that is not of scalar, array, or record
+ -- type, or in the composite case if no scalar subcomponents exist. For
+ -- a variant record, the warning is given only if none of the variants
+ -- have scalar subcomponents. In addition, the warning is suppressed
+ -- for private types, or generic formal types in an instance.
----------------
-- Value_Size --