diff options
| author | Detlef Riekenberg <tcc.dev@web.de> | 2010-04-06 00:33:15 +0200 |
|---|---|---|
| committer | Detlef Riekenberg <tcc.dev@web.de> | 2010-04-06 00:33:15 +0200 |
| commit | 264a103610e3ee86b27b8cbb0e4ec81cd654d980 (patch) | |
| tree | e1944a9dc42fd2b9bae4347e0a1f14e7cefdc05b /tccgen.c | |
| parent | 34dabe496f367db5b6cece5ac0b396dc9c074c99 (diff) | |
| download | tinycc-264a103610e3ee86b27b8cbb0e4ec81cd654d980.tar.gz tinycc-264a103610e3ee86b27b8cbb0e4ec81cd654d980.tar.bz2 | |
tccgen: Detect (but ignore) function redirection
tcc is now able to parse <stdio.h> from gcc, when
__GNUC__ is also defined
--
By by ... Detlef
Diffstat (limited to 'tccgen.c')
| -rw-r--r-- | tccgen.c | 31 |
1 files changed, 30 insertions, 1 deletions
@@ -5419,10 +5419,39 @@ 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) { + Sym *fn; /* external function definition */ /* specific case for func_call attribute */ type.ref->r = INT_ATTR(&ad); - external_sym(v, &type, 0); + fn = external_sym(v, &type, 0); + + if (gnu_ext && (tok == TOK_ASM1 || tok == TOK_ASM2 || tok == TOK_ASM3)) { + char target[256]; + + *target = 0; + next(); + skip('('); + /* Part 1: __USER_LABEL_PREFIX__ (user defined) */ + if (tok == TOK_STR) + pstrcat(target, sizeof(target), tokc.cstr->data); + else + pstrcat(target, sizeof(target), get_tok_str(tok, NULL)); + + next(); + /* Part 2: api name */ + if (tok == TOK_STR) + pstrcat(target, sizeof(target), tokc.cstr->data); + else + pstrcat(target, sizeof(target), get_tok_str(tok, NULL)); + + next(); + skip(')'); + if (tcc_state->warn_unsupported) + warning("ignoring redirection from %s to %s\n", get_tok_str(v, NULL), target); + + if (tok == TOK_ATTRIBUTE1 || tok == TOK_ATTRIBUTE2) + parse_attribute((AttributeDef *) &fn->type.ref->r); + } } else { /* not lvalue if array */ r = 0; |
