History

tccgen: Revert yuanbin's recent patches

This reverts commits 670993..d35138 Maybe these commits fixed something but also seemed to cause problems.

grischka committed 16 years ago

Commit 3ba37e11 parent 433ecdf1 file · +17 −19Browse files

Unified · Split

tccgen.c+17−19
@@ -4867,7 +4867,6 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c, · 4866 unmodified lines
48674867 to do it correctly (ideally, the expression parser should
48684868 be used in all cases) */
48694869 par_count = 0;
4870− /* Coo: I think we must not deal '(' */
48714870 if (tok == '(') {
48724871 AttributeDef ad1;
48734872 CType type1;
@@ -4892,14 +4891,10 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c, · 18 unmodified lines
48924891 }
48934892 s = type->ref;
48944893 f = s->next;
4895− /* Coo: skip empty struct */
4896− while (f->next && (f->type.t&VT_BTYPE)==VT_STRUCT && !f->type.ref->c)
4897− f=f->next;
48984894 array_length = 0;
48994895 index = 0;
49004896 n = s->c;
49014897 while (tok != '}') {
4902− int bit_pos;
49034898 decl_designator(type, sec, c, NULL, &f, size_only);
49044899 index = f->c;
49054900 if (!size_only && array_length < index) {
@@ -4910,25 +4905,28 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c, · 4 unmodified lines
49104905 if (index > array_length)
49114906 array_length = index;
49124907
4913− /* Coo: skip fields from same union */
4914− if (!(f->type.t&VT_BITFIELD))
4915− bit_pos=index*8;
4916− else
4917− bit_pos=f->c*8+((f->type.t>>VT_STRUCT_SHIFT)&0x3f)+((f->type.t>>(VT_STRUCT_SHIFT+6))&0x3f);
4918− do
4919− f=f->next;
4920− while (f && (((f->type.t&VT_BTYPE)==VT_STRUCT && !f->type.ref->c) ||
4921− f->c*8+((f->type.t&VT_BITFIELD)?((f->type.t>>VT_STRUCT_SHIFT)&0x3f):0)<bit_pos));
4908+ /* gr: skip fields from same union - ugly. */
4909+ while (f->next) {
4910+ ///printf("index: %2d %08x -- %2d %08x\n", f->c, f->type.t, f->next->c, f->next->type.t);
4911+ /* test for same offset */
4912+ if (f->next->c != f->c)
4913+ break;
4914+ /* if yes, test for bitfield shift */
4915+ if ((f->type.t & VT_BITFIELD) && (f->next->type.t & VT_BITFIELD)) {
4916+ int bit_pos_1 = (f->type.t >> VT_STRUCT_SHIFT) & 0x3f;
4917+ int bit_pos_2 = (f->next->type.t >> VT_STRUCT_SHIFT) & 0x3f;
4918+ //printf("bitfield %d %d\n", bit_pos_1, bit_pos_2);
4919+ if (bit_pos_1 != bit_pos_2)
4920+ break;
4921+ }
4922+ f = f->next;
4923+ }
49224924
4925+ f = f->next;
49234926 if (no_oblock && f == NULL)
49244927 break;
49254928 if (tok == '}')
49264929 break;
4927− /* Coo: skip ')' in front of ',' for initializer */
4928− while (tok==')' && par_count) {
4929− next();
4930− par_count--;
4931− }
49324930 skip(',');
49334931 }
49344932 /* put zeros at the end */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t