]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Allow making empty aggregates positional
authorRonan Desplanques <desplanques@adacore.com>
Wed, 19 Jun 2024 07:26:35 +0000 (09:26 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Thu, 1 Aug 2024 15:14:34 +0000 (17:14 +0200)
commita9302802e56547ba14e8bdd7bbf667bb3a253155
treef9a5f9e31751c517ad23d41a9c992167b1786192
parentf61d9979a75b171a917ffcd03da5e4e5f62bcc50
ada: Allow making empty aggregates positional

This patch makes Exp_Aggr.Convert_To_Positional accepts appropriate
empty aggregates. The end goal is to remove violations of the
No_Elaboration_Code restriction in some cases of library-level array
objects.

gcc/ada/

* exp_aggr.adb (Flatten): Do not reject empty aggregates. Adjust
criterion for emitting warning about ineffective others clause.
* sem_aggr.adb (Array_Aggr_Subtype): Fix typo. Add handling of
aggregates that were converted to positional form.
(Resolve_Aggregate): Tweak criterion for transforming into a
string literal.
(Resolve_Array_Aggregate): Tweak criterion for reusing existing
bounds of aggregate.
(Retrieve_Aggregate_Bounds): New procedure.
* sem_util.adb (Has_Static_Empty_Array_Bounds): New function.
* sem_util.ads (Has_Static_Empty_Array_Bounds): Likewise.
gcc/ada/exp_aggr.adb
gcc/ada/sem_aggr.adb
gcc/ada/sem_util.adb
gcc/ada/sem_util.ads