Unified · Split
| @@ -4824,7 +4824,7 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c, · 4823 unmodified lines | |||
| 4824 | /* patch type size if needed */ | 4824 | /* patch type size if needed */ |
| 4825 | if (n < 0) | 4825 | if (n < 0) |
| 4826 | s->c = array_length; | 4826 | s->c = array_length; |
| 4827 | } else if ((type->t & VT_BTYPE) == VT_STRUCT && | 4827 | } else if ((type->t & VT_BTYPE) == VT_STRUCT && |
| 4828 | (sec || !first || tok == '{')) { | 4828 | (sec || !first || tok == '{')) { |
| 4829 | int par_count; | 4829 | int par_count; |
| 4830 | 4830 | ||
| @@ -4837,7 +4837,7 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c, · 6 unmodified lines | |||
| 4837 | to do it correctly (ideally, the expression parser should | 4837 | to do it correctly (ideally, the expression parser should |
| 4838 | be used in all cases) */ | 4838 | be used in all cases) */ |
| 4839 | par_count = 0; | 4839 | par_count = 0; |
| 4840 | /* Coo: I think we must not deal '(' */ | 4840 | /* Coo: I think we must not deal '(' */ |
| 4841 | if (tok == '(') { | 4841 | if (tok == '(') { |
| 4842 | AttributeDef ad1; | 4842 | AttributeDef ad1; |
| 4843 | CType type1; | 4843 | CType type1; |
| @@ -4861,15 +4861,15 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c, · 17 unmodified lines | |||
| 4861 | no_oblock = 0; | 4861 | no_oblock = 0; |
| 4862 | } | 4862 | } |
| 4863 | s = type->ref; | 4863 | s = type->ref; |
| 4864 | f = s->next; | 4864 | f = s->next; |
| 4865 | /* Coo: skip empty struct */ | 4865 | /* Coo: skip empty struct */ |
| 4866 | while (f->next && (f->type.t&VT_BTYPE)==VT_STRUCT && !f->type.ref->c) | 4866 | while (f->next && (f->type.t&VT_BTYPE)==VT_STRUCT && !f->type.ref->c) |
| 4867 | f=f->next; | 4867 | f=f->next; |
| 4868 | array_length = 0; | 4868 | array_length = 0; |
| 4869 | index = 0; | 4869 | index = 0; |
| 4870 | n = s->c; | 4870 | n = s->c; |
| 4871 | while (tok != '}') { | 4871 | while (tok != '}') { |
| 4872 | int bit_pos; | 4872 | int bit_pos; |
| 4873 | decl_designator(type, sec, c, NULL, &f, size_only); | 4873 | decl_designator(type, sec, c, NULL, &f, size_only); |
| 4874 | index = f->c; | 4874 | index = f->c; |
| 4875 | if (!size_only && array_length < index) { | 4875 | if (!size_only && array_length < index) { |
| @@ -4880,25 +4880,25 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c, · 4 unmodified lines | |||
| 4880 | if (index > array_length) | 4880 | if (index > array_length) |
| 4881 | array_length = index; | 4881 | array_length = index; |
| 4882 | 4882 | ||
| 4883 | /* Coo: skip fields from same union */ | 4883 | /* Coo: skip fields from same union */ |
| 4884 | if (!(f->type.t&VT_BITFIELD)) | 4884 | if (!(f->type.t&VT_BITFIELD)) |
| 4885 | bit_pos=index*8; | 4885 | bit_pos=index*8; |
| 4886 | else | 4886 | else |
| 4887 | bit_pos=f->c*8+((f->type.t>>VT_STRUCT_SHIFT)&0x3f)+((f->type.t>>(VT_STRUCT_SHIFT+6))&0x3f); | 4887 | bit_pos=f->c*8+((f->type.t>>VT_STRUCT_SHIFT)&0x3f)+((f->type.t>>(VT_STRUCT_SHIFT+6))&0x3f); |
| 4888 | do | 4888 | do |
| 4889 | f=f->next; | 4889 | f=f->next; |
| 4890 | while (f && (((f->type.t&VT_BTYPE)==VT_STRUCT && !f->type.ref->c) || | 4890 | while (f && (((f->type.t&VT_BTYPE)==VT_STRUCT && !f->type.ref->c) || |
| 4891 | f->c*8+((f->type.t&VT_BITFIELD)?((f->type.t>>VT_STRUCT_SHIFT)&0x3f):0)<bit_pos)); | 4891 | f->c*8+((f->type.t&VT_BITFIELD)?((f->type.t>>VT_STRUCT_SHIFT)&0x3f):0)<bit_pos)); |
| 4892 | 4892 | ||
| 4893 | if (no_oblock && f == NULL) | 4893 | if (no_oblock && f == NULL) |
| 4894 | break; | 4894 | break; |
| 4895 | if (tok == '}') | 4895 | if (tok == '}') |
| 4896 | break; | 4896 | break; |
| 4897 | /* Coo: skip ')' in front of ',' for initializer */ | 4897 | /* Coo: skip ')' in front of ',' for initializer */ |
| 4898 | while (tok==')' && par_count) { | 4898 | while (tok==')' && par_count) { |
| 4899 | next(); | 4899 | next(); |
| 4900 | par_count--; | 4900 | par_count--; |
| 4901 | } | 4901 | } |
| 4902 | skip(','); | 4902 | skip(','); |
| 4903 | } | 4903 | } |
| 4904 | /* put zeros at the end */ | 4904 | /* put zeros at the end */ |