Unified · Split
| @@ -6465,7 +6465,7 @@ static void struct_decl(CType *type, int u) · 6464 unmodified lines | ||
| 6465 | 6465 | { |
| 6466 | 6466 | int a, v, size, align, maxalign, c, offset; |
| 6467 | 6467 | int bit_size, bit_pos, bsize, bt, lbit_pos; |
| 6468 | − Sym *s, *ss, **ps; | |
| 6468 | + Sym *s, *ss, *ass, **ps; | |
| 6469 | 6469 | AttributeDef ad; |
| 6470 | 6470 | CType type1, btype; |
| 6471 | 6471 | |
| @@ -6536,7 +6536,9 @@ static void struct_decl(CType *type, int u) · 64 unmodified lines | ||
| 6536 | 6536 | v = 0; |
| 6537 | 6537 | type1 = btype; |
| 6538 | 6538 | if (tok != ':') { |
| 6539 | − type_decl(&type1, &ad, &v, TYPE_DIRECT); | |
| 6539 | + type_decl(&type1, &ad, &v, TYPE_DIRECT | TYPE_ABSTRACT); | |
| 6540 | + if (v == 0 && (type1.t & VT_BTYPE) != VT_STRUCT) | |
| 6541 | + expect("identifier"); | |
| 6540 | 6542 | if ((type1.t & VT_BTYPE) == VT_FUNC || |
| 6541 | 6543 | (type1.t & (VT_TYPEDEF | VT_STATIC | VT_EXTERN | VT_INLINE))) |
| 6542 | 6544 | error("invalid type for '%s'", |
| @@ -6599,7 +6601,7 @@ static void struct_decl(CType *type, int u) · 56 unmodified lines | ||
| 6599 | 6601 | } else { |
| 6600 | 6602 | bit_pos = 0; |
| 6601 | 6603 | } |
| 6602 | − if (v) { | |
| 6604 | + if (v != 0 || (type1.t & VT_BTYPE) == VT_STRUCT) { | |
| 6603 | 6605 | /* add new memory data only if starting |
| 6604 | 6606 | bit field */ |
| 6605 | 6607 | if (lbit_pos == 0) { |
| @@ -6625,6 +6627,15 @@ static void struct_decl(CType *type, int u) · 19 unmodified lines | ||
| 6625 | 6627 | } |
| 6626 | 6628 | printf("\n"); |
| 6627 | 6629 | #endif |
| 6630 | + } | |
| 6631 | + if (v == 0 && (type1.t & VT_BTYPE) == VT_STRUCT) { | |
| 6632 | + ass = type1.ref; | |
| 6633 | + while ((ass = ass->next) != NULL) { | |
| 6634 | + ss = sym_push(ass->v, &ass->type, 0, offset + ass->c); | |
| 6635 | + *ps = ss; | |
| 6636 | + ps = &ss->next; | |
| 6637 | + } | |
| 6638 | + } else if (v) { | |
| 6628 | 6639 | ss = sym_push(v | SYM_FIELD, &type1, 0, offset); |
| 6629 | 6640 | *ps = ss; |
| 6630 | 6641 | ps = &ss->next; |