[Ada] Improve detection of illegal Iterable aspects
commit8b9bbdc362efe420633e43850092d01f467aa6d8
authorPiotr Trojanek <trojanek@adacore.com>
Fri, 5 Aug 2022 14:31:19 +0000 (5 16:31 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 6 Sep 2022 07:14:20 +0000 (6 09:14 +0200)
tree1f66eea81dcb093b509dd15270d2da67373caaef
parentd6b15134378bfba88effc523f4eb2c20a9486a63
[Ada] Improve detection of illegal Iterable aspects

Handling of aspect Iterable was lacking guards against illegal code, so
the compiler either crashed or emitted cryptic errors while expanding
loops that rely on this aspect.

gcc/ada/

* doc/gnat_rm/implementation_defined_aspects.rst
(Aspect Iterable): Include Last and Previous primitives in
syntactic and semantic description.
* exp_attr.adb
(Expand_N_Attribute_Reference): Don't expect attributes like
Iterable that can only appear in attribute definition clauses.
* sem_ch13.adb
(Analyze_Attribute_Definition_Clause): Prevent crash on
non-aggregate Iterable attribute; improve basic diagnosis of
attribute values.
(Resolve_Iterable_Operation): Improve checks for illegal
primitives in aspect Iterable, e.g. with wrong number of formal
parameters.
(Validate_Iterable_Aspect): Prevent crashes on syntactically
illegal aspect expression.
* sem_util.adb
(Get_Cursor_Type): Fix style.
* gnat_ugn.texi, gnat_rm.texi: Regenerate.
gcc/ada/doc/gnat_rm/implementation_defined_aspects.rst
gcc/ada/exp_attr.adb
gcc/ada/gnat_rm.texi
gcc/ada/gnat_ugn.texi
gcc/ada/sem_ch13.adb
gcc/ada/sem_util.adb