History

use static declaration from prototype

static int func(); ... int func() { } As result, func needs to be static.

grischka committed 17 years ago

Commit a342bba1 parent 69fdb571 file · +8 −3Browse files

Unified · Split

tccgen.c+8−3
@@ -5032,16 +5032,21 @@ static void decl(int l) · 5031 unmodified lines
5032 if (sym) {5032 if (sym) {
5033 if ((sym->type.t & VT_BTYPE) != VT_FUNC)5033 if ((sym->type.t & VT_BTYPE) != VT_FUNC)
5034 goto func_error1;5034 goto func_error1;
5035 /* specific case: if not func_call defined, we put5035
5036 the one of the prototype */
5037 /* XXX: should have default value */
5038 r = sym->type.ref->r;5036 r = sym->type.ref->r;
5037 /* use func_call from prototype if not defined */
5039 if (FUNC_CALL(r) != FUNC_CDECL5038 if (FUNC_CALL(r) != FUNC_CDECL
5040 && FUNC_CALL(type.ref->r) == FUNC_CDECL)5039 && FUNC_CALL(type.ref->r) == FUNC_CDECL)
5041 FUNC_CALL(type.ref->r) = FUNC_CALL(r);5040 FUNC_CALL(type.ref->r) = FUNC_CALL(r);
5041
5042 /* use export from prototype */
5042 if (FUNC_EXPORT(r))5043 if (FUNC_EXPORT(r))
5043 FUNC_EXPORT(type.ref->r) = 1;5044 FUNC_EXPORT(type.ref->r) = 1;
5044 5045
5046 /* use static from prototype */
5047 if (sym->type.t & VT_STATIC)
5048 type.t = (type.t & ~VT_EXTERN) | VT_STATIC;
5049
5045 if (!is_compatible_types(&sym->type, &type)) {5050 if (!is_compatible_types(&sym->type, &type)) {
5046 func_error1:5051 func_error1:
5047 error("incompatible types for redefinition of '%s'", 5052 error("incompatible types for redefinition of '%s'",

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t