summaryrefslogtreecommitdiff
path: root/gcc/godump.c
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2012-04-22 18:51:44 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2012-04-22 18:51:44 +0000
commit5150d596ee984da8bfd982d3fd8fbd59a9a7aa28 (patch)
treedc74fb1f36cb378bbb8295d9aa9daefe37eff0f2 /gcc/godump.c
parent3f006c48bf2b503dbdba4bb4b98422cb79bd8777 (diff)
downloadgcc-5150d596ee984da8bfd982d3fd8fbd59a9a7aa28.tar.gz
* godump.c (go_output_typedef): Dump size of structs.
mksysinfo, syscall: Change Sizeof names from var to const. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@186678 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/godump.c')
-rw-r--r--gcc/godump.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/godump.c b/gcc/godump.c
index a42e641d181..ab1edc620f9 100644
--- a/gcc/godump.c
+++ b/gcc/godump.c
@@ -1024,12 +1024,25 @@ go_output_typedef (struct godump_container *container, tree decl)
fprintf (go_dump_file, "type _%s ",
IDENTIFIER_POINTER (DECL_NAME (decl)));
go_output_type (container);
+
+ if (RECORD_OR_UNION_TYPE_P (TREE_TYPE (decl)))
+ {
+ HOST_WIDE_INT size = int_size_in_bytes (TREE_TYPE (decl));
+
+ if (size > 0)
+ fprintf (go_dump_file,
+ "\nconst _sizeof_%s = " HOST_WIDE_INT_PRINT_DEC,
+ IDENTIFIER_POINTER (DECL_NAME (decl)),
+ size);
+ }
+
pointer_set_insert (container->decls_seen, decl);
}
else if (RECORD_OR_UNION_TYPE_P (TREE_TYPE (decl)))
{
void **slot;
const char *type;
+ HOST_WIDE_INT size;
type = IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE ((decl))));
/* If type defined already, skip. */
@@ -1047,6 +1060,13 @@ go_output_typedef (struct godump_container *container, tree decl)
fprintf (go_dump_file, "type _%s ",
IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE (decl))));
go_output_type (container);
+
+ size = int_size_in_bytes (TREE_TYPE (decl));
+ if (size > 0)
+ fprintf (go_dump_file,
+ "\nconst _sizeof_%s = " HOST_WIDE_INT_PRINT_DEC,
+ IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE (decl))),
+ size);
}
else
return;