diff options
| author | Joe Soroka <gits@joesoroka.com> | 2011-03-03 00:55:02 -0800 |
|---|---|---|
| committer | Joe Soroka <gits@joesoroka.com> | 2011-03-03 00:55:02 -0800 |
| commit | 3beb38323624f871292c4e8b99d01d59bb9ab2d4 (patch) | |
| tree | d93543cd3ee97c023e53615bee4fca0e43b0549a /tccgen.c | |
| parent | 823f83263012524b27033e908df86b592ee1a21b (diff) | |
| download | tinycc-3beb38323624f871292c4e8b99d01d59bb9ab2d4.tar.gz tinycc-3beb38323624f871292c4e8b99d01d59bb9ab2d4.tar.bz2 | |
handle post-asm-label attributes on variables
Diffstat (limited to 'tccgen.c')
| -rw-r--r-- | tccgen.c | 39 |
1 files changed, 14 insertions, 25 deletions
@@ -5419,6 +5419,7 @@ ST_FUNC void decl(int l) continue; } while (1) { /* iterate thru each declaration */ + char *asm_label; // associated asm label type = btype; type_decl(&type, &ad, &v, TYPE_DIRECT); #if 0 @@ -5439,6 +5440,18 @@ ST_FUNC void decl(int l) func_decl_list(sym); } + asm_label = NULL; + if (gnu_ext && (tok == TOK_ASM1 || tok == TOK_ASM2 || tok == TOK_ASM3)) { + CString astr; + + asm_label_instr(&astr); + asm_label = tcc_strdup(astr.data); + cstr_free(&astr); + + /* parse one last attribute list, after asm label */ + parse_attribute(&ad); + } + if (ad.weak) type.t |= VT_WEAK; #ifdef TCC_TARGET_PE @@ -5548,39 +5561,15 @@ ST_FUNC void decl(int l) sym = sym_push(v, &type, INT_ATTR(&ad), 0); sym->type.t |= VT_TYPEDEF; } else if ((type.t & VT_BTYPE) == VT_FUNC) { - char *asm_label; // associated asm label - Sym *fn; - - asm_label = NULL; /* external function definition */ /* specific case for func_call attribute */ type.ref->r = INT_ATTR(&ad); - - if (gnu_ext && (tok == TOK_ASM1 || tok == TOK_ASM2 || tok == TOK_ASM3)) { - CString astr; - - asm_label_instr(&astr); - asm_label = tcc_strdup(astr.data); - cstr_free(&astr); - } - fn = external_sym(v, &type, 0, asm_label); - if (gnu_ext && (tok == TOK_ATTRIBUTE1 || tok == TOK_ATTRIBUTE2)) - parse_attribute((AttributeDef *) &fn->type.ref->r); + external_sym(v, &type, 0, asm_label); } else { - char *asm_label; // associated asm label - /* not lvalue if array */ r = 0; - asm_label = NULL; if (!(type.t & VT_ARRAY)) r |= lvalue_type(type.t); - if (tok == TOK_ASM1 || tok == TOK_ASM2 || tok == TOK_ASM3) { - CString astr; - - asm_label_instr(&astr); - asm_label = tcc_strdup(astr.data); - cstr_free(&astr); - } has_init = (tok == '='); if ((btype.t & VT_EXTERN) || ((type.t & VT_ARRAY) && (type.t & VT_STATIC) && |
