see http://lists.nongnu.org/archive/html/tinycc-devel/2011-03/msg00002.html
Unified · Split
| @@ -1094,7 +1094,6 @@ ST_FUNC void gexpr(void); · 1093 unmodified lines | |||
| 1094 | ST_FUNC int expr_const(void); | 1094 | ST_FUNC int expr_const(void); |
| 1095 | ST_FUNC void gen_inline_functions(void); | 1095 | ST_FUNC void gen_inline_functions(void); |
| 1096 | ST_FUNC void decl(int l); | 1096 | ST_FUNC void decl(int l); |
| 1097 | ST_FUNC void for_loop_init(); | ||
| 1098 | #if defined CONFIG_TCC_BCHECK || defined TCC_TARGET_C67 | 1097 | #if defined CONFIG_TCC_BCHECK || defined TCC_TARGET_C67 |
| 1099 | ST_FUNC Sym *get_sym_ref(CType *type, Section *sec, unsigned long offset, unsigned long size); | 1098 | ST_FUNC Sym *get_sym_ref(CType *type, Section *sec, unsigned long offset, unsigned long size); |
| 1100 | #endif | 1099 | #endif |
| @@ -4379,7 +4379,8 @@ static void block(int *bsym, int *csym, int *case_sym, int *def_sym, · 4378 unmodified lines | |||
| 4379 | next(); | 4379 | next(); |
| 4380 | skip('('); | 4380 | skip('('); |
| 4381 | if (tok != ';') { | 4381 | if (tok != ';') { |
| 4382 | for_loop_init(); | 4382 | gexpr(); |
| 4383 | vpop(); | ||
| 4383 | } | 4384 | } |
| 4384 | skip(';'); | 4385 | skip(';'); |
| 4385 | d = ind; | 4386 | d = ind; |
| @@ -5405,7 +5406,7 @@ ST_FUNC void gen_inline_functions(void) · 1019 unmodified lines | |||
| 5405 | } | 5406 | } |
| 5406 | 5407 | ||
| 5407 | /* 'l' is VT_LOCAL or VT_CONST to define default storage type */ | 5408 | /* 'l' is VT_LOCAL or VT_CONST to define default storage type */ |
| 5408 | static void decl0(int l, int is_for_loop_init) | 5409 | ST_FUNC void decl(int l) |
| 5409 | { | 5410 | { |
| 5410 | int v, has_init, r; | 5411 | int v, has_init, r; |
| 5411 | CType type, btype; | 5412 | CType type, btype; |
| @@ -5414,11 +5415,6 @@ static void decl0(int l, int is_for_loop_init) · 2 unmodified lines | |||
| 5414 | 5415 | ||
| 5415 | while (1) { | 5416 | while (1) { |
| 5416 | if (!parse_btype(&btype, &ad)) { | 5417 | if (!parse_btype(&btype, &ad)) { |
| 5417 | if (is_for_loop_init) { | ||
| 5418 | gexpr(); | ||
| 5419 | vpop(); | ||
| 5420 | return; | ||
| 5421 | } | ||
| 5422 | /* skip redundant ';' */ | 5418 | /* skip redundant ';' */ |
| 5423 | /* XXX: find more elegant solution */ | 5419 | /* XXX: find more elegant solution */ |
| 5424 | if (tok == ';') { | 5420 | if (tok == ';') { |
| @@ -5633,8 +5629,6 @@ static void decl0(int l, int is_for_loop_init) · 208 unmodified lines | |||
| 5633 | } | 5629 | } |
| 5634 | } | 5630 | } |
| 5635 | if (tok != ',') { | 5631 | if (tok != ',') { |
| 5636 | if (is_for_loop_init) | ||
| 5637 | return; | ||
| 5638 | skip(';'); | 5632 | skip(';'); |
| 5639 | break; | 5633 | break; |
| 5640 | } | 5634 | } |
| @@ -5643,13 +5637,3 @@ static void decl0(int l, int is_for_loop_init) · 2 unmodified lines | |||
| 5643 | } | 5637 | } |
| 5644 | } | 5638 | } |
| 5645 | } | 5639 | } |
| 5646 | |||
| 5647 | ST_FUNC void for_loop_init(void) | ||
| 5648 | { | ||
| 5649 | decl0(VT_LOCAL, 1); | ||
| 5650 | } | ||
| 5651 | |||
| 5652 | ST_FUNC void decl(int l) | ||
| 5653 | { | ||
| 5654 | decl0(l, 0); | ||
| 5655 | } | ||