mirror of
https://github.com/mirror/tinycc.git
synced 2025-01-25 06:00:11 +08:00
use static declaration from prototype
static int func(); ... int func() { } As result, func needs to be static.
This commit is contained in:
parent
69fdb57edd
commit
a342bbadc8
11
tccgen.c
11
tccgen.c
@ -5032,16 +5032,21 @@ static void decl(int l)
|
||||
if (sym) {
|
||||
if ((sym->type.t & VT_BTYPE) != VT_FUNC)
|
||||
goto func_error1;
|
||||
/* specific case: if not func_call defined, we put
|
||||
the one of the prototype */
|
||||
/* XXX: should have default value */
|
||||
|
||||
r = sym->type.ref->r;
|
||||
/* use func_call from prototype if not defined */
|
||||
if (FUNC_CALL(r) != FUNC_CDECL
|
||||
&& FUNC_CALL(type.ref->r) == FUNC_CDECL)
|
||||
FUNC_CALL(type.ref->r) = FUNC_CALL(r);
|
||||
|
||||
/* use export from prototype */
|
||||
if (FUNC_EXPORT(r))
|
||||
FUNC_EXPORT(type.ref->r) = 1;
|
||||
|
||||
/* use static from prototype */
|
||||
if (sym->type.t & VT_STATIC)
|
||||
type.t = (type.t & ~VT_EXTERN) | VT_STATIC;
|
||||
|
||||
if (!is_compatible_types(&sym->type, &type)) {
|
||||
func_error1:
|
||||
error("incompatible types for redefinition of '%s'",
|
||||
|
Loading…
Reference in New Issue
Block a user