aboutsummaryrefslogtreecommitdiff
path: root/tccgen.c
diff options
context:
space:
mode:
authorgrischka <grischka>2009-06-17 02:09:52 +0200
committergrischka <grischka>2009-06-17 02:09:52 +0200
commit6a004ed19f61c77e5074a7960aaec75ec40aaa3d (patch)
treedbebe1808472b7aa1aca58564a0e2ee57473adf4 /tccgen.c
parentc3701df16cf1ce9e1cb88ff0e3c789ecc2c4114d (diff)
downloadtinycc-6a004ed19f61c77e5074a7960aaec75ec40aaa3d.tar.gz
tinycc-6a004ed19f61c77e5074a7960aaec75ec40aaa3d.tar.bz2
allow redefinition of func_old_type functions
void *memcpy(void*, const void*, unsigned); This gave an error if memcpy() has been used before implicitely, e.g. for structure passing etc.
Diffstat (limited to 'tccgen.c')
-rw-r--r--tccgen.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/tccgen.c b/tccgen.c
index 933f76d..7ac05d3 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -115,10 +115,13 @@ static Sym *external_sym(int v, CType *type, int r)
/* push forward reference */
s = sym_push(v, type, r | VT_CONST | VT_SYM, 0);
s->type.t |= VT_EXTERN;
- } else {
- if (!is_compatible_types(&s->type, type))
- error("incompatible types for redefinition of '%s'",
- get_tok_str(v, NULL));
+ } else if (s->type.ref == func_old_type.ref) {
+ s->type.ref = type->ref;
+ s->r = r | VT_CONST | VT_SYM;
+ s->type.t |= VT_EXTERN;
+ } else if (!is_compatible_types(&s->type, type)) {
+ error("incompatible types for redefinition of '%s'",
+ get_tok_str(v, NULL));
}
return s;
}