| @@ -5419,6 +5419,7 @@ ST_FUNC void decl(int l) · 5418 unmodified lines |
| 5419 | 5419 | continue; |
| 5420 | 5420 | } |
| 5421 | 5421 | while (1) { /* iterate thru each declaration */ |
| 5422 | + char *asm_label; // associated asm label |
| 5422 | 5423 | type = btype; |
| 5423 | 5424 | type_decl(&type, &ad, &v, TYPE_DIRECT); |
| 5424 | 5425 | #if 0 |
| @@ -5439,6 +5440,18 @@ ST_FUNC void decl(int l) · 14 unmodified lines |
| 5439 | 5440 | func_decl_list(sym); |
| 5440 | 5441 | } |
| 5441 | 5442 | |
| 5443 | + asm_label = NULL; |
| 5444 | + if (gnu_ext && (tok == TOK_ASM1 || tok == TOK_ASM2 || tok == TOK_ASM3)) { |
| 5445 | + CString astr; |
| 5446 | + |
| 5447 | + asm_label_instr(&astr); |
| 5448 | + asm_label = tcc_strdup(astr.data); |
| 5449 | + cstr_free(&astr); |
| 5450 | + |
| 5451 | + /* parse one last attribute list, after asm label */ |
| 5452 | + parse_attribute(&ad); |
| 5453 | + } |
| 5454 | + |
| 5442 | 5455 | if (ad.weak) |
| 5443 | 5456 | type.t |= VT_WEAK; |
| 5444 | 5457 | #ifdef TCC_TARGET_PE |
| @@ -5548,39 +5561,15 @@ ST_FUNC void decl(int l) · 103 unmodified lines |
| 5548 | 5561 | sym = sym_push(v, &type, INT_ATTR(&ad), 0); |
| 5549 | 5562 | sym->type.t |= VT_TYPEDEF; |
| 5550 | 5563 | } else if ((type.t & VT_BTYPE) == VT_FUNC) { |
| 5551 | | − char *asm_label; // associated asm label |
| 5552 | | − Sym *fn; |
| 5553 | | − |
| 5554 | | − asm_label = NULL; |
| 5555 | 5564 | /* external function definition */ |
| 5556 | 5565 | /* specific case for func_call attribute */ |
| 5557 | 5566 | type.ref->r = INT_ATTR(&ad); |
| 5558 | | − |
| 5559 | | − if (gnu_ext && (tok == TOK_ASM1 || tok == TOK_ASM2 || tok == TOK_ASM3)) { |
| 5560 | | − CString astr; |
| 5561 | | − |
| 5562 | | − asm_label_instr(&astr); |
| 5563 | | − asm_label = tcc_strdup(astr.data); |
| 5564 | | − cstr_free(&astr); |
| 5565 | | − } |
| 5566 | | − fn = external_sym(v, &type, 0, asm_label); |
| 5567 | | − if (gnu_ext && (tok == TOK_ATTRIBUTE1 || tok == TOK_ATTRIBUTE2)) |
| 5568 | | − parse_attribute((AttributeDef *) &fn->type.ref->r); |
| 5567 | + external_sym(v, &type, 0, asm_label); |
| 5569 | 5568 | } else { |
| 5570 | | − char *asm_label; // associated asm label |
| 5571 | | − |
| 5572 | 5569 | /* not lvalue if array */ |
| 5573 | 5570 | r = 0; |
| 5574 | | − asm_label = NULL; |
| 5575 | 5571 | if (!(type.t & VT_ARRAY)) |
| 5576 | 5572 | r |= lvalue_type(type.t); |
| 5577 | | − if (tok == TOK_ASM1 || tok == TOK_ASM2 || tok == TOK_ASM3) { |
| 5578 | | − CString astr; |
| 5579 | | − |
| 5580 | | − asm_label_instr(&astr); |
| 5581 | | − asm_label = tcc_strdup(astr.data); |
| 5582 | | − cstr_free(&astr); |
| 5583 | | − } |
| 5584 | 5573 | has_init = (tok == '='); |
| 5585 | 5574 | if ((btype.t & VT_EXTERN) || |
| 5586 | 5575 | ((type.t & VT_ARRAY) && (type.t & VT_STATIC) && |