Unified · Split
| @@ -165,7 +165,9 @@ static void decr_local_scope(void) · 164 unmodified lines | |||
| 165 | static void reset_local_scope(void) | 165 | static void reset_local_scope(void) |
| 166 | { | 166 | { |
| 167 | if (cleanup_info) { | 167 | if (cleanup_info) { |
| 168 | for (int i = 0; i < cleanup_idx; ++i) { | 168 | int i = 0; |
| 169 | |||
| 170 | for (; i < cleanup_idx; ++i) { | ||
| 169 | cleanup_info = cleanup_info_store[i]; | 171 | cleanup_info = cleanup_info_store[i]; |
| 170 | tcc_free(cleanup_info->syms); | 172 | tcc_free(cleanup_info->syms); |
| 171 | tcc_free(cleanup_info); | 173 | tcc_free(cleanup_info); |
| @@ -185,7 +187,9 @@ static void reset_local_scope(void) · 13 unmodified lines | |||
| 185 | 187 | ||
| 186 | int is_scope_a_parent_of(ScopeTacker *parent, ScopeTacker *child) | 188 | int is_scope_a_parent_of(ScopeTacker *parent, ScopeTacker *child) |
| 187 | { | 189 | { |
| 188 | for (ScopeTacker *cur = parent->prev; cur; cur = cur->prev) { | 190 | ScopeTacker *cur = parent->prev; |
| 191 | |||
| 192 | for (; cur; cur = cur->prev) { | ||
| 189 | if (cur == child) | 193 | if (cur == child) |
| 190 | return 1; | 194 | return 1; |
| 191 | } | 195 | } |
| @@ -4797,11 +4801,15 @@ static void parse_builtin_params(int nc, const char *args) · 4605 unmodified lines | |||
| 4797 | 4801 | ||
| 4798 | static void try_call_scope_cleanup(ScopeTacker *scope) | 4802 | static void try_call_scope_cleanup(ScopeTacker *scope) |
| 4799 | { | 4803 | { |
| 4804 | int i; | ||
| 4805 | |||
| 4800 | if (!cleanup_info) | 4806 | if (!cleanup_info) |
| 4801 | return; | 4807 | return; |
| 4802 | 4808 | ||
| 4803 | if (cleanup_info->scope != scope) { | 4809 | if (cleanup_info->scope != scope) { |
| 4804 | for (int i = 0; i < cleanup_idx; ++i) { | 4810 | int i = 0; |
| 4811 | |||
| 4812 | for (; i < cleanup_idx; ++i) { | ||
| 4805 | cleanup_info = cleanup_info_store[i]; | 4813 | cleanup_info = cleanup_info_store[i]; |
| 4806 | if (cleanup_info->scope == scope) | 4814 | if (cleanup_info->scope == scope) |
| 4807 | goto found; | 4815 | goto found; |
| @@ -4809,7 +4817,7 @@ static void try_call_scope_cleanup(ScopeTacker *scope) · 1 unmodified line | |||
| 4809 | return; | 4817 | return; |
| 4810 | } | 4818 | } |
| 4811 | found: | 4819 | found: |
| 4812 | for (int i = cleanup_info->nb_cleanup - 1; i >= 0; --i) { | 4820 | for (i = cleanup_info->nb_cleanup - 1; i >= 0; --i) { |
| 4813 | Sym *fs = cleanup_info->syms[i].func; | 4821 | Sym *fs = cleanup_info->syms[i].func; |
| 4814 | Sym *vs = cleanup_info->syms[i].var; | 4822 | Sym *vs = cleanup_info->syms[i].var; |
| 4815 | 4823 | ||
| @@ -4827,9 +4835,11 @@ static void try_call_scope_cleanup(ScopeTacker *scope) · 11 unmodified lines | |||
| 4827 | 4835 | ||
| 4828 | static void try_call_cleanup_goto(ScopeTacker *dest_scope) | 4836 | static void try_call_cleanup_goto(ScopeTacker *dest_scope) |
| 4829 | { | 4837 | { |
| 4838 | ScopeTacker *cur_scope_tracker; | ||
| 4839 | |||
| 4830 | if (!cleanup_info) | 4840 | if (!cleanup_info) |
| 4831 | return; | 4841 | return; |
| 4832 | for (ScopeTacker *cur_scope_tracker = scope_tracker; | 4842 | for (cur_scope_tracker = scope_tracker; |
| 4833 | cur_scope_tracker && cur_scope_tracker != dest_scope; | 4843 | cur_scope_tracker && cur_scope_tracker != dest_scope; |
| 4834 | cur_scope_tracker = cur_scope_tracker->prev) { | 4844 | cur_scope_tracker = cur_scope_tracker->prev) { |
| 4835 | try_call_scope_cleanup(cur_scope_tracker); | 4845 | try_call_scope_cleanup(cur_scope_tracker); |
| @@ -4838,9 +4848,11 @@ static void try_call_cleanup_goto(ScopeTacker *dest_scope) · 2 unmodified lines | |||
| 4838 | 4848 | ||
| 4839 | static void try_call_all_cleanup(void) | 4849 | static void try_call_all_cleanup(void) |
| 4840 | { | 4850 | { |
| 4851 | ScopeTacker *cur_scope_tracker; | ||
| 4852 | |||
| 4841 | if (!cleanup_info) | 4853 | if (!cleanup_info) |
| 4842 | return; | 4854 | return; |
| 4843 | for (ScopeTacker *cur_scope_tracker = scope_tracker; | 4855 | for (cur_scope_tracker = scope_tracker; |
| 4844 | cur_scope_tracker; | 4856 | cur_scope_tracker; |
| 4845 | cur_scope_tracker = cur_scope_tracker->prev) { | 4857 | cur_scope_tracker = cur_scope_tracker->prev) { |
| 4846 | try_call_scope_cleanup(cur_scope_tracker); | 4858 | try_call_scope_cleanup(cur_scope_tracker); |
| @@ -6279,10 +6291,11 @@ static void block(int *bsym, int *csym, int is_expr) · 1432 unmodified lines | |||
| 6279 | 6291 | ||
| 6280 | if (cleanup_info) { | 6292 | if (cleanup_info) { |
| 6281 | int jmp = 0; | 6293 | int jmp = 0; |
| 6294 | int i; | ||
| 6282 | 6295 | ||
| 6283 | jmp = gjmp(jmp); | 6296 | jmp = gjmp(jmp); |
| 6284 | 6297 | ||
| 6285 | for (int i = 0; i < last_cleanup_goto; ++i) { | 6298 | for (i = 0; i < last_cleanup_goto; ++i) { |
| 6286 | struct CleanupGoto *cur = cleanup_goto_info[i]; | 6299 | struct CleanupGoto *cur = cleanup_goto_info[i]; |
| 6287 | 6300 | ||
| 6288 | if (!cur->is_valide) | 6301 | if (!cur->is_valide) |
| @@ -6553,10 +6566,11 @@ static void block(int *bsym, int *csym, int is_expr) · 264 unmodified lines | |||
| 6553 | s = label_find(b); | 6566 | s = label_find(b); |
| 6554 | if (s) { | 6567 | if (s) { |
| 6555 | int is_gen = 0; | 6568 | int is_gen = 0; |
| 6569 | int i; | ||
| 6556 | 6570 | ||
| 6557 | if (s->r == LABEL_DEFINED) | 6571 | if (s->r == LABEL_DEFINED) |
| 6558 | tcc_error("duplicate label '%s'", get_tok_str(s->v, NULL)); | 6572 | tcc_error("duplicate label '%s'", get_tok_str(s->v, NULL)); |
| 6559 | for (int i = 0; i < last_cleanup_goto; ++i) { | 6573 | for (i = 0; i < last_cleanup_goto; ++i) { |
| 6560 | struct CleanupGoto *cur = cleanup_goto_info[i]; | 6574 | struct CleanupGoto *cur = cleanup_goto_info[i]; |
| 6561 | if (cur->s == s) { | 6575 | if (cur->s == s) { |
| 6562 | cur->is_valide = 0; | 6576 | cur->is_valide = 0; |