History

tccgen: skip fields from same union

yuanbin committed 16 years ago

Commit 952e83e1 parent d6ce75b1 file · +8 −2Browse files

Unified · Split

tccgen.c+8−2
@@ -4865,6 +4865,7 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c, · 4864 unmodified lines
48654865 index = 0;
48664866 n = s->c;
48674867 while (tok != '}') {
4868+ int bit_pos;
48684869 decl_designator(type, sec, c, NULL, &f, size_only);
48694870 index = f->c;
48704871 if (!size_only && array_length < index) {
@@ -4876,8 +4877,13 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c, · 5 unmodified lines
48764877 array_length = index;
48774878
48784879 /* Coo: skip fields from same union */
4879− while (f->next && f->next->c<index)
4880− f=f->next;
4880+ if ((f->type.t&VT_BITFIELD)==0)
4881+ bit_pos=index*8;
4882+ else
4883+ bit_pos=f->c*8+((f->type.t>>VT_STRUCT_SHIFT)&0x3f)+((f->type.t>>(VT_STRUCT_SHIFT+6))&0x3f);
4884+ while (f->next && f->next->c<index &&
4885+ ((f->next->type.t&VT_BITFIELD)==0 || f->next->c*8+((f->next->type.t>>VT_STRUCT_SHIFT)&0x3f)<bit_pos))
4886+ f=f->next;
48814887
48824888 f = f->next;
48834889 if (no_oblock && f == NULL)

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