diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2020-11-28 16:37:12 +0100 |
---|---|---|
committer | Eric Botcazou <ebotcazou@adacore.com> | 2020-11-28 16:39:20 +0100 |
commit | 8e59ff5541889817a160afda130bcbcdb70c4b90 (patch) | |
tree | 406d9d6a006b432b49dfd48a68f5668f83976001 /gcc | |
parent | b1adbc27c4a85ded4db81ed65b1cefce4cee8d15 (diff) | |
download | gcc-8e59ff5541889817a160afda130bcbcdb70c4b90.zip gcc-8e59ff5541889817a160afda130bcbcdb70c4b90.tar.gz gcc-8e59ff5541889817a160afda130bcbcdb70c4b90.tar.bz2 |
Improve support of simple bit-fields in -fdump-ada-spec
This fixes an issue with nested structures and adds an Alignment clause
to counter the effect of the Pack aspect.
gcc/c-family/ChangeLog:
* c-ada-spec.c (dump_nested_type) <RECORD_TYPE>: Remove obsolete code.
(dump_ada_structure): Also deal with convention, unchecked union and
bit-field for nested types. In the latter case, print an Alignment
aspect along with the Pack aspect.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/c-family/c-ada-spec.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/gcc/c-family/c-ada-spec.c b/gcc/c-family/c-ada-spec.c index 266a7fe..883036f 100644 --- a/gcc/c-family/c-ada-spec.c +++ b/gcc/c-family/c-ada-spec.c @@ -2598,16 +2598,6 @@ dump_nested_type (pretty_printer *buffer, tree field, tree t, tree parent, pp_string (buffer, " is "); dump_ada_structure (buffer, field_type, t, true, spc); - - pp_string (buffer, "with Convention => C_Pass_By_Copy"); - - if (TREE_CODE (field_type) == UNION_TYPE) - { - pp_comma (buffer); - newline_and_indent (buffer, spc + 5); - pp_string (buffer, "Unchecked_Union => True"); - } - pp_semicolon (buffer); newline_and_indent (buffer, spc); break; @@ -3318,10 +3308,7 @@ dump_ada_structure (pretty_printer *buffer, tree node, tree type, bool nested, newline_and_indent (buffer, spc); /* We disregard the methods for anonymous nested types. */ - if (nested) - return; - - if (has_nontrivial_methods (node)) + if (has_nontrivial_methods (node) && !nested) { pp_string (buffer, "with Import => True,"); newline_and_indent (buffer, spc + 5); @@ -3339,12 +3326,20 @@ dump_ada_structure (pretty_printer *buffer, tree node, tree type, bool nested, if (bitfield_used) { + char buf[32]; pp_comma (buffer); newline_and_indent (buffer, spc + 5); pp_string (buffer, "Pack => True"); + pp_comma (buffer); + newline_and_indent (buffer, spc + 5); + sprintf (buf, "Alignment => %d", TYPE_ALIGN (node) / BITS_PER_UNIT); + pp_string (buffer, buf); bitfield_used = false; } + if (nested) + return; + need_semicolon = !dump_ada_methods (buffer, node, spc); /* Print the static fields of the structure, if any. */ |