| @@ -1958,7 +1958,7 @@ ST_FUNC int type_size(CType *type, int *a) · 1957 unmodified lines |
| 1958 | 1958 | if (bt == VT_STRUCT) { |
| 1959 | 1959 | /* struct/union */ |
| 1960 | 1960 | s = type->ref; |
| 1961 | | − *a = s->r & 0xffffff; |
| 1961 | + *a = s->r; |
| 1962 | 1962 | return s->c; |
| 1963 | 1963 | } else if (bt == VT_PTR) { |
| 1964 | 1964 | if (type->t & VT_ARRAY) { |
| @@ -2610,7 +2610,7 @@ static void parse_attribute(AttributeDef *ad) · 645 unmodified lines |
| 2610 | 2610 | static void struct_decl(CType *type, int u) |
| 2611 | 2611 | { |
| 2612 | 2612 | int a, v, size, align, maxalign, c, offset; |
| 2613 | | − int bit_size, bit_pos, bsize, bt, lbit_pos, prevbt, resize; |
| 2613 | + int bit_size, bit_pos, bsize, bt, lbit_pos, prevbt; |
| 2614 | 2614 | Sym *s, *ss, *ass, **ps; |
| 2615 | 2615 | AttributeDef ad; |
| 2616 | 2616 | CType type1, btype; |
| @@ -2671,7 +2671,6 @@ static void struct_decl(CType *type, int u) · 54 unmodified lines |
| 2671 | 2671 | } |
| 2672 | 2672 | skip('}'); |
| 2673 | 2673 | } else { |
| 2674 | | − resize = 0; |
| 2675 | 2674 | maxalign = 1; |
| 2676 | 2675 | ps = &s->next; |
| 2677 | 2676 | prevbt = VT_INT; |
| @@ -2762,8 +2761,6 @@ static void struct_decl(CType *type, int u) · 84 unmodified lines |
| 2762 | 2761 | offset = c; |
| 2763 | 2762 | if (size > 0) |
| 2764 | 2763 | c += size; |
| 2765 | | − if (size < 0) |
| 2766 | | − resize = 1; |
| 2767 | 2764 | } else { |
| 2768 | 2765 | offset = 0; |
| 2769 | 2766 | if (size > c) |
| @@ -2804,7 +2801,7 @@ static void struct_decl(CType *type, int u) · 34 unmodified lines |
| 2804 | 2801 | skip('}'); |
| 2805 | 2802 | /* store size and alignment */ |
| 2806 | 2803 | s->c = (c + maxalign - 1) & -maxalign; |
| 2807 | | − s->r = maxalign | (resize ? (1 << 31) : 0); |
| 2804 | + s->r = maxalign; |
| 2808 | 2805 | } |
| 2809 | 2806 | } |
| 2810 | 2807 | } |
| @@ -3147,8 +3144,6 @@ static void post_type(CType *type, AttributeDef *ad) · 336 unmodified lines |
| 3147 | 3144 | /* we push a anonymous symbol which will contain the array |
| 3148 | 3145 | element type */ |
| 3149 | 3146 | s = sym_push(SYM_FIELD, type, 0, n); |
| 3150 | | − if (n < 0) |
| 3151 | | − ARRAY_RESIZE(s->r) = 1; |
| 3152 | 3147 | type->t = t1 | VT_ARRAY | VT_PTR; |
| 3153 | 3148 | type->ref = s; |
| 3154 | 3149 | } |
| @@ -4884,8 +4879,6 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c, · 1729 unmodified lines |
| 4884 | 4879 | } |
| 4885 | 4880 | } else { |
| 4886 | 4881 | index = 0; |
| 4887 | | − if (ARRAY_RESIZE(s->r)) |
| 4888 | | − n = -1; |
| 4889 | 4882 | while (tok != '}') { |
| 4890 | 4883 | decl_designator(type, sec, c, &index, NULL, size_only); |
| 4891 | 4884 | if (n >= 0 && index >= n) |
| @@ -4959,8 +4952,6 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c, · 67 unmodified lines |
| 4959 | 4952 | array_length = 0; |
| 4960 | 4953 | index = 0; |
| 4961 | 4954 | n = s->c; |
| 4962 | | − if (s->r & (1<<31)) |
| 4963 | | − n = -1; |
| 4964 | 4955 | while (tok != '}') { |
| 4965 | 4956 | decl_designator(type, sec, c, NULL, &f, size_only); |
| 4966 | 4957 | index = f->c; |
| @@ -4997,7 +4988,7 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c, · 30 unmodified lines |
| 4997 | 4988 | skip(','); |
| 4998 | 4989 | } |
| 4999 | 4990 | /* put zeros at the end */ |
| 5000 | | − if (!size_only && n >= 0 && array_length < n) { |
| 4991 | + if (!size_only && array_length < n) { |
| 5001 | 4992 | init_putz(type, sec, c + array_length, |
| 5002 | 4993 | n - array_length); |
| 5003 | 4994 | } |
| @@ -5007,8 +4998,6 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c, · 3 unmodified lines |
| 5007 | 4998 | skip(')'); |
| 5008 | 4999 | par_count--; |
| 5009 | 5000 | } |
| 5010 | | − if (n < 0) |
| 5011 | | − s->c = array_length; |
| 5012 | 5001 | } else if (tok == '{') { |
| 5013 | 5002 | next(); |
| 5014 | 5003 | decl_initializer(type, sec, c, first, size_only); |
| @@ -5056,9 +5045,6 @@ static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r, · 41 unmodified lines |
| 5056 | 5045 | TokenString init_str; |
| 5057 | 5046 | Section *sec; |
| 5058 | 5047 | |
| 5059 | | − /* resize the struct */ |
| 5060 | | − if ((type->t & VT_BTYPE) == VT_STRUCT && (type->ref->r & (1<<31)) != 0) |
| 5061 | | − type->ref->c = -1; |
| 5062 | 5048 | size = type_size(type, &align); |
| 5063 | 5049 | /* If unknown size, we must evaluate it before |
| 5064 | 5050 | evaluating initializers because |