mirror of
https://github.com/mirror/tinycc.git
synced 2025-03-12 09:00:09 +08:00
tccgen: Revert yuanbin's recent patches
This reverts commits 670993..d35138 Maybe these commits fixed something but also seemed to cause problems.
This commit is contained in:
parent
433ecdfc9d
commit
3ba37e1e3f
36
tccgen.c
36
tccgen.c
@ -4867,7 +4867,6 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c,
|
|||||||
to do it correctly (ideally, the expression parser should
|
to do it correctly (ideally, the expression parser should
|
||||||
be used in all cases) */
|
be used in all cases) */
|
||||||
par_count = 0;
|
par_count = 0;
|
||||||
/* Coo: I think we must not deal '(' */
|
|
||||||
if (tok == '(') {
|
if (tok == '(') {
|
||||||
AttributeDef ad1;
|
AttributeDef ad1;
|
||||||
CType type1;
|
CType type1;
|
||||||
@ -4892,14 +4891,10 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c,
|
|||||||
}
|
}
|
||||||
s = type->ref;
|
s = type->ref;
|
||||||
f = s->next;
|
f = s->next;
|
||||||
/* Coo: skip empty struct */
|
|
||||||
while (f->next && (f->type.t&VT_BTYPE)==VT_STRUCT && !f->type.ref->c)
|
|
||||||
f=f->next;
|
|
||||||
array_length = 0;
|
array_length = 0;
|
||||||
index = 0;
|
index = 0;
|
||||||
n = s->c;
|
n = s->c;
|
||||||
while (tok != '}') {
|
while (tok != '}') {
|
||||||
int bit_pos;
|
|
||||||
decl_designator(type, sec, c, NULL, &f, size_only);
|
decl_designator(type, sec, c, NULL, &f, size_only);
|
||||||
index = f->c;
|
index = f->c;
|
||||||
if (!size_only && array_length < index) {
|
if (!size_only && array_length < index) {
|
||||||
@ -4910,25 +4905,28 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c,
|
|||||||
if (index > array_length)
|
if (index > array_length)
|
||||||
array_length = index;
|
array_length = index;
|
||||||
|
|
||||||
/* Coo: skip fields from same union */
|
/* gr: skip fields from same union - ugly. */
|
||||||
if (!(f->type.t&VT_BITFIELD))
|
while (f->next) {
|
||||||
bit_pos=index*8;
|
///printf("index: %2d %08x -- %2d %08x\n", f->c, f->type.t, f->next->c, f->next->type.t);
|
||||||
else
|
/* test for same offset */
|
||||||
bit_pos=f->c*8+((f->type.t>>VT_STRUCT_SHIFT)&0x3f)+((f->type.t>>(VT_STRUCT_SHIFT+6))&0x3f);
|
if (f->next->c != f->c)
|
||||||
do
|
break;
|
||||||
f=f->next;
|
/* if yes, test for bitfield shift */
|
||||||
while (f && (((f->type.t&VT_BTYPE)==VT_STRUCT && !f->type.ref->c) ||
|
if ((f->type.t & VT_BITFIELD) && (f->next->type.t & VT_BITFIELD)) {
|
||||||
f->c*8+((f->type.t&VT_BITFIELD)?((f->type.t>>VT_STRUCT_SHIFT)&0x3f):0)<bit_pos));
|
int bit_pos_1 = (f->type.t >> VT_STRUCT_SHIFT) & 0x3f;
|
||||||
|
int bit_pos_2 = (f->next->type.t >> VT_STRUCT_SHIFT) & 0x3f;
|
||||||
|
//printf("bitfield %d %d\n", bit_pos_1, bit_pos_2);
|
||||||
|
if (bit_pos_1 != bit_pos_2)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
f = f->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
f = f->next;
|
||||||
if (no_oblock && f == NULL)
|
if (no_oblock && f == NULL)
|
||||||
break;
|
break;
|
||||||
if (tok == '}')
|
if (tok == '}')
|
||||||
break;
|
break;
|
||||||
/* Coo: skip ')' in front of ',' for initializer */
|
|
||||||
while (tok==')' && par_count) {
|
|
||||||
next();
|
|
||||||
par_count--;
|
|
||||||
}
|
|
||||||
skip(',');
|
skip(',');
|
||||||
}
|
}
|
||||||
/* put zeros at the end */
|
/* put zeros at the end */
|
||||||
|
Loading…
Reference in New Issue
Block a user