diff options
| author | yuanbin <Administrator@yuan.(none)> | 2010-06-13 01:12:36 +0800 |
|---|---|---|
| committer | yuanbin <Administrator@yuan.(none)> | 2010-06-13 01:12:36 +0800 |
| commit | d6ce75b4d6627d5992e839460aee5de4f9743958 (patch) | |
| tree | 7ea726eca1de50a4df90d9b16eaffd8cd3fefa9d | |
| parent | dd72577759f146041571de60e826765d073e1f06 (diff) | |
| download | tinycc-d6ce75b4d6627d5992e839460aee5de4f9743958.tar.gz tinycc-d6ce75b4d6627d5992e839460aee5de4f9743958.tar.bz2 | |
tccgen.c: skip fields from same union
| -rwxr-xr-x[-rw-r--r--] | tccgen.c | 31 |
1 files changed, 5 insertions, 26 deletions
@@ -4861,13 +4861,6 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c, } s = type->ref; f = s->next;
- /* Coo: initial last member of union */ - while (f->next && f->next->c==f->c) {
- if ((f->type.t&VT_BITFIELD) && (f->next->type.t&VT_BITFIELD)
- && ((f->type.t>>VT_STRUCT_SHIFT)&0x3f)!=((f->next->type.t>>VT_STRUCT_SHIFT)&0x3f))
- break;
- f = f->next;
- }
array_length = 0; index = 0; n = s->c; @@ -4882,26 +4875,12 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c, if (index > array_length) array_length = index; + /* Coo: skip fields from same union */
+ while (f->next && f->next->c<index) + f=f->next; +
f = f->next;
- /* Coo: initial last member of union */
- if (f)
- /* gr: skip fields from same union - ugly. */ - while (f->next) { - ///printf("index: %2d %08x -- %2d %08x\n", f->c, f->type.t, f->next->c, f->next->type.t); - /* test for same offset */ - if (f->next->c != f->c) - break; - /* if yes, test for bitfield shift */ - if ((f->type.t & VT_BITFIELD) && (f->next->type.t & VT_BITFIELD)) { - 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; - } - else if (no_oblock)
+ if (no_oblock && f == NULL)
break;
if (tok == '}') break; |
