Fix issue for nested record types with -fdump-ada-spec
authorEric Botcazou <ebotcazou@adacore.com>
Thu, 3 Jun 2021 15:54:45 +0000 (17:54 +0200)
committerEric Botcazou <ebotcazou@adacore.com>
Thu, 3 Jun 2021 15:56:59 +0000 (17:56 +0200)
commitcd4dd47265f2bff89fbbfb6a12a98a7101fb5280
treec49026b2da25ffc9688703b04b3ea096abc1a0d9
parent517155ceb971d33881cfeecd767406f0801c6512
Fix issue for nested record types with -fdump-ada-spec

Ada does not support anonymous record declarations nested in other record
declarations so -fdump-ada-spec needs to unnest them, and this contains a
few fixes for this machinery.

gcc/c-family/
* c-ada-spec.c (dump_ada_macros): Minor tweaks.
(dump_ada_decl_name): Likewise.
(dump_anonymous_type_name): Remove parent parameter and adjust.
(dump_sloc): Minor tweak.
(dump_ada_array_type): Remove type parameter and adjust.
(dump_ada_enum_type): Remove parent parameter and adjust.
(dump_ada_node): Adjust calls to above functions.
(dumped_anonymous_types): New global variable.
(dump_nested_types_1): Rename into...
(dump_nested_types): ...this.
(dump_nested_type): Remove parent and dumped_types parameters.
<ARRAY_TYPE>: Replace dumped_types with dumped_anonymous_types.
Adjust calls to dump_anonymous_type_name and dump_ada_array_type.
(dump_ada_specs): Initialize and free dumped_anonymous_types.
gcc/c-family/c-ada-spec.c