mirror of git://gcc.gnu.org/git/gcc.git
go-gcc.cc (Gcc_backend::non_zero_size_type): If a struct has a fields...
* go-gcc.cc (Gcc_backend::non_zero_size_type): If a struct has a fields, recreate those fields with the first one with a non-zero size. From-SVN: r201222
This commit is contained in:
parent
08d22f9b41
commit
f1e1872559
|
|
@ -1,3 +1,9 @@
|
||||||
|
2013-07-24 Ian Lance Taylor <iant@google.com>
|
||||||
|
|
||||||
|
* go-gcc.cc (Gcc_backend::non_zero_size_type): If a struct has a
|
||||||
|
fields, recreate those fields with the first one with a non-zero
|
||||||
|
size.
|
||||||
|
|
||||||
2013-07-23 Ian Lance Taylor <iant@google.com>
|
2013-07-23 Ian Lance Taylor <iant@google.com>
|
||||||
|
|
||||||
* go-backend.c: Don't #include "rtl.h".
|
* go-backend.c: Don't #include "rtl.h".
|
||||||
|
|
|
||||||
|
|
@ -1242,20 +1242,41 @@ Gcc_backend::non_zero_size_type(tree type)
|
||||||
switch (TREE_CODE(type))
|
switch (TREE_CODE(type))
|
||||||
{
|
{
|
||||||
case RECORD_TYPE:
|
case RECORD_TYPE:
|
||||||
{
|
if (TYPE_FIELDS(type) != NULL_TREE)
|
||||||
if (go_non_zero_struct == NULL_TREE)
|
{
|
||||||
{
|
tree ns = make_node(RECORD_TYPE);
|
||||||
type = make_node(RECORD_TYPE);
|
tree field_trees = NULL_TREE;
|
||||||
tree field = build_decl(UNKNOWN_LOCATION, FIELD_DECL,
|
tree *pp = &field_trees;
|
||||||
get_identifier("dummy"),
|
for (tree field = TYPE_FIELDS(type);
|
||||||
boolean_type_node);
|
field != NULL_TREE;
|
||||||
DECL_CONTEXT(field) = type;
|
field = DECL_CHAIN(field))
|
||||||
TYPE_FIELDS(type) = field;
|
{
|
||||||
layout_type(type);
|
tree ft = TREE_TYPE(field);
|
||||||
go_non_zero_struct = type;
|
if (field == TYPE_FIELDS(type))
|
||||||
}
|
ft = non_zero_size_type(ft);
|
||||||
return go_non_zero_struct;
|
tree f = build_decl(DECL_SOURCE_LOCATION(field), FIELD_DECL,
|
||||||
}
|
DECL_NAME(field), ft);
|
||||||
|
DECL_CONTEXT(f) = ns;
|
||||||
|
*pp = f;
|
||||||
|
pp = &DECL_CHAIN(f);
|
||||||
|
}
|
||||||
|
TYPE_FIELDS(ns) = field_trees;
|
||||||
|
layout_type(ns);
|
||||||
|
return ns;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (go_non_zero_struct == NULL_TREE)
|
||||||
|
{
|
||||||
|
type = make_node(RECORD_TYPE);
|
||||||
|
tree field = build_decl(UNKNOWN_LOCATION, FIELD_DECL,
|
||||||
|
get_identifier("dummy"),
|
||||||
|
boolean_type_node);
|
||||||
|
DECL_CONTEXT(field) = type;
|
||||||
|
TYPE_FIELDS(type) = field;
|
||||||
|
layout_type(type);
|
||||||
|
go_non_zero_struct = type;
|
||||||
|
}
|
||||||
|
return go_non_zero_struct;
|
||||||
|
|
||||||
case ARRAY_TYPE:
|
case ARRAY_TYPE:
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue