mirror of
https://github.com/mirror/tinycc.git
synced 2025-01-27 06:10:06 +08:00
partially revert e23194a
see http://lists.nongnu.org/archive/html/tinycc-devel/2011-03/msg00002.html
This commit is contained in:
parent
b3a8eed49e
commit
7fc2eee55c
1
tcc.h
1
tcc.h
@ -1094,7 +1094,6 @@ ST_FUNC void gexpr(void);
|
|||||||
ST_FUNC int expr_const(void);
|
ST_FUNC int expr_const(void);
|
||||||
ST_FUNC void gen_inline_functions(void);
|
ST_FUNC void gen_inline_functions(void);
|
||||||
ST_FUNC void decl(int l);
|
ST_FUNC void decl(int l);
|
||||||
ST_FUNC void for_loop_init();
|
|
||||||
#if defined CONFIG_TCC_BCHECK || defined TCC_TARGET_C67
|
#if defined CONFIG_TCC_BCHECK || defined TCC_TARGET_C67
|
||||||
ST_FUNC Sym *get_sym_ref(CType *type, Section *sec, unsigned long offset, unsigned long size);
|
ST_FUNC Sym *get_sym_ref(CType *type, Section *sec, unsigned long offset, unsigned long size);
|
||||||
#endif
|
#endif
|
||||||
|
22
tccgen.c
22
tccgen.c
@ -4379,7 +4379,8 @@ static void block(int *bsym, int *csym, int *case_sym, int *def_sym,
|
|||||||
next();
|
next();
|
||||||
skip('(');
|
skip('(');
|
||||||
if (tok != ';') {
|
if (tok != ';') {
|
||||||
for_loop_init();
|
gexpr();
|
||||||
|
vpop();
|
||||||
}
|
}
|
||||||
skip(';');
|
skip(';');
|
||||||
d = ind;
|
d = ind;
|
||||||
@ -5405,7 +5406,7 @@ ST_FUNC void gen_inline_functions(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* 'l' is VT_LOCAL or VT_CONST to define default storage type */
|
/* 'l' is VT_LOCAL or VT_CONST to define default storage type */
|
||||||
static void decl0(int l, int is_for_loop_init)
|
ST_FUNC void decl(int l)
|
||||||
{
|
{
|
||||||
int v, has_init, r;
|
int v, has_init, r;
|
||||||
CType type, btype;
|
CType type, btype;
|
||||||
@ -5414,11 +5415,6 @@ static void decl0(int l, int is_for_loop_init)
|
|||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if (!parse_btype(&btype, &ad)) {
|
if (!parse_btype(&btype, &ad)) {
|
||||||
if (is_for_loop_init) {
|
|
||||||
gexpr();
|
|
||||||
vpop();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
/* skip redundant ';' */
|
/* skip redundant ';' */
|
||||||
/* XXX: find more elegant solution */
|
/* XXX: find more elegant solution */
|
||||||
if (tok == ';') {
|
if (tok == ';') {
|
||||||
@ -5633,8 +5629,6 @@ static void decl0(int l, int is_for_loop_init)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tok != ',') {
|
if (tok != ',') {
|
||||||
if (is_for_loop_init)
|
|
||||||
return;
|
|
||||||
skip(';');
|
skip(';');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -5643,13 +5637,3 @@ static void decl0(int l, int is_for_loop_init)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ST_FUNC void for_loop_init(void)
|
|
||||||
{
|
|
||||||
decl0(VT_LOCAL, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
ST_FUNC void decl(int l)
|
|
||||||
{
|
|
||||||
decl0(l, 0);
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user