diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-12-18 02:23:53 +0100 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-12-18 02:23:53 +0100 |
| commit | f4f10720fe4f7a37685bf2d9a535d7bd59a64e86 (patch) | |
| tree | 22fdd8cdee71d18081665cc60a82539e8a2f4b75 /miscutils | |
| parent | 6d3b4bb24da9a07c263f3c1acf8df85382ff562c (diff) | |
| download | busybox-w32-f4f10720fe4f7a37685bf2d9a535d7bd59a64e86.tar.gz busybox-w32-f4f10720fe4f7a37685bf2d9a535d7bd59a64e86.tar.bz2 busybox-w32-f4f10720fe4f7a37685bf2d9a535d7bd59a64e86.zip | |
bc: fixed from 64-bit compile
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'miscutils')
| -rw-r--r-- | miscutils/bc.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c index 45d9eb8eb..20ce497dd 100644 --- a/miscutils/bc.c +++ b/miscutils/bc.c | |||
| @@ -3477,7 +3477,7 @@ static void bc_parse_pushIndex(BcParse *p, size_t idx) | |||
| 3477 | size_t mask; | 3477 | size_t mask; |
| 3478 | unsigned amt; | 3478 | unsigned amt; |
| 3479 | 3479 | ||
| 3480 | dbg_lex("%s:%d pushing index %d", __func__, __LINE__, idx); | 3480 | dbg_lex("%s:%d pushing index %zd", __func__, __LINE__, idx); |
| 3481 | mask = ((size_t)0xff) << (sizeof(idx) * 8 - 8); | 3481 | mask = ((size_t)0xff) << (sizeof(idx) * 8 - 8); |
| 3482 | amt = sizeof(idx); | 3482 | amt = sizeof(idx); |
| 3483 | do { | 3483 | do { |
| @@ -4086,10 +4086,10 @@ static BC_STATUS zbc_parse_if(BcParse *p) | |||
| 4086 | 4086 | ||
| 4087 | ip2_idx = p->func->labels.len; | 4087 | ip2_idx = p->func->labels.len; |
| 4088 | 4088 | ||
| 4089 | dbg_lex("%s:%d after if() body: BC_INST_JUMP to %d", __func__, __LINE__, ip2_idx); | 4089 | dbg_lex("%s:%d after if() body: BC_INST_JUMP to %zd", __func__, __LINE__, ip2_idx); |
| 4090 | bc_parse_pushJUMP(p, ip2_idx); | 4090 | bc_parse_pushJUMP(p, ip2_idx); |
| 4091 | 4091 | ||
| 4092 | dbg_lex("%s:%d rewriting 'if_zero' label to jump to 'else'-> %d", __func__, __LINE__, p->func->code.len); | 4092 | dbg_lex("%s:%d rewriting 'if_zero' label to jump to 'else'-> %zd", __func__, __LINE__, p->func->code.len); |
| 4093 | rewrite_label_to_current(p, ip_idx); | 4093 | rewrite_label_to_current(p, ip_idx); |
| 4094 | 4094 | ||
| 4095 | bc_vec_push(&p->func->labels, &ip2_idx); | 4095 | bc_vec_push(&p->func->labels, &ip2_idx); |
| @@ -4099,7 +4099,7 @@ static BC_STATUS zbc_parse_if(BcParse *p) | |||
| 4099 | if (s) RETURN_STATUS(s); | 4099 | if (s) RETURN_STATUS(s); |
| 4100 | } | 4100 | } |
| 4101 | 4101 | ||
| 4102 | dbg_lex("%s:%d rewriting label to jump after 'if' body-> %d", __func__, __LINE__, p->func->code.len); | 4102 | dbg_lex("%s:%d rewriting label to jump after 'if' body-> %zd", __func__, __LINE__, p->func->code.len); |
| 4103 | rewrite_label_to_current(p, ip_idx); | 4103 | rewrite_label_to_current(p, ip_idx); |
| 4104 | 4104 | ||
| 4105 | dbg_lex_done("%s:%d done", __func__, __LINE__); | 4105 | dbg_lex_done("%s:%d done", __func__, __LINE__); |
| @@ -4137,10 +4137,10 @@ static BC_STATUS zbc_parse_while(BcParse *p) | |||
| 4137 | s = zbc_parse_stmt_allow_NLINE_before(p, STRING_while); | 4137 | s = zbc_parse_stmt_allow_NLINE_before(p, STRING_while); |
| 4138 | if (s) RETURN_STATUS(s); | 4138 | if (s) RETURN_STATUS(s); |
| 4139 | 4139 | ||
| 4140 | dbg_lex("%s:%d BC_INST_JUMP to %d", __func__, __LINE__, cond_idx); | 4140 | dbg_lex("%s:%d BC_INST_JUMP to %zd", __func__, __LINE__, cond_idx); |
| 4141 | bc_parse_pushJUMP(p, cond_idx); | 4141 | bc_parse_pushJUMP(p, cond_idx); |
| 4142 | 4142 | ||
| 4143 | dbg_lex("%s:%d rewriting label-> %d", __func__, __LINE__, p->func->code.len); | 4143 | dbg_lex("%s:%d rewriting label-> %zd", __func__, __LINE__, p->func->code.len); |
| 4144 | rewrite_label_to_current(p, ip_idx); | 4144 | rewrite_label_to_current(p, ip_idx); |
| 4145 | 4145 | ||
| 4146 | bc_vec_pop(&p->exits); | 4146 | bc_vec_pop(&p->exits); |
| @@ -4213,10 +4213,10 @@ static BC_STATUS zbc_parse_for(BcParse *p) | |||
| 4213 | s = zbc_parse_stmt_allow_NLINE_before(p, STRING_for); | 4213 | s = zbc_parse_stmt_allow_NLINE_before(p, STRING_for); |
| 4214 | if (s) RETURN_STATUS(s); | 4214 | if (s) RETURN_STATUS(s); |
| 4215 | 4215 | ||
| 4216 | dbg_lex("%s:%d BC_INST_JUMP to %d", __func__, __LINE__, update_idx); | 4216 | dbg_lex("%s:%d BC_INST_JUMP to %zd", __func__, __LINE__, update_idx); |
| 4217 | bc_parse_pushJUMP(p, update_idx); | 4217 | bc_parse_pushJUMP(p, update_idx); |
| 4218 | 4218 | ||
| 4219 | dbg_lex("%s:%d rewriting label-> %d", __func__, __LINE__, p->func->code.len); | 4219 | dbg_lex("%s:%d rewriting label-> %zd", __func__, __LINE__, p->func->code.len); |
| 4220 | rewrite_label_to_current(p, exit_idx); | 4220 | rewrite_label_to_current(p, exit_idx); |
| 4221 | 4221 | ||
| 4222 | bc_vec_pop(&p->exits); | 4222 | bc_vec_pop(&p->exits); |
| @@ -4257,6 +4257,7 @@ static BC_STATUS zbc_parse_funcdef(BcParse *p) | |||
| 4257 | bool var, comma = false; | 4257 | bool var, comma = false; |
| 4258 | char *name; | 4258 | char *name; |
| 4259 | 4259 | ||
| 4260 | dbg_lex_enter("%s:%d entered", __func__, __LINE__); | ||
| 4260 | s = zbc_lex_next(&p->l); | 4261 | s = zbc_lex_next(&p->l); |
| 4261 | if (s) RETURN_STATUS(s); | 4262 | if (s) RETURN_STATUS(s); |
| 4262 | if (p->l.t.t != BC_LEX_NAME) | 4263 | if (p->l.t.t != BC_LEX_NAME) |
| @@ -4330,9 +4331,11 @@ static BC_STATUS zbc_parse_funcdef(BcParse *p) | |||
| 4330 | bc_parse_push(p, BC_INST_RET0); | 4331 | bc_parse_push(p, BC_INST_RET0); |
| 4331 | bc_parse_updateFunc(p, BC_PROG_MAIN); | 4332 | bc_parse_updateFunc(p, BC_PROG_MAIN); |
| 4332 | 4333 | ||
| 4334 | dbg_lex_done("%s:%d done", __func__, __LINE__); | ||
| 4333 | RETURN_STATUS(s); | 4335 | RETURN_STATUS(s); |
| 4334 | 4336 | ||
| 4335 | err: | 4337 | err: |
| 4338 | dbg_lex_done("%s:%d done (error)", __func__, __LINE__); | ||
| 4336 | free(name); | 4339 | free(name); |
| 4337 | RETURN_STATUS(s); | 4340 | RETURN_STATUS(s); |
| 4338 | } | 4341 | } |
| @@ -4873,7 +4876,6 @@ static BC_STATUS zdc_parse_cond(BcParse *p, uint8_t inst) | |||
| 4873 | static BC_STATUS zdc_parse_token(BcParse *p, BcLexType t, uint8_t flags) | 4876 | static BC_STATUS zdc_parse_token(BcParse *p, BcLexType t, uint8_t flags) |
| 4874 | { | 4877 | { |
| 4875 | BcStatus s = BC_STATUS_SUCCESS; | 4878 | BcStatus s = BC_STATUS_SUCCESS; |
| 4876 | BcInst prev; | ||
| 4877 | uint8_t inst; | 4879 | uint8_t inst; |
| 4878 | bool assign, get_token = false; | 4880 | bool assign, get_token = false; |
| 4879 | 4881 | ||
| @@ -4902,7 +4904,6 @@ static BC_STATUS zdc_parse_token(BcParse *p, BcLexType t, uint8_t flags) | |||
| 4902 | RETURN_STATUS(bc_error_bad_token()); | 4904 | RETURN_STATUS(bc_error_bad_token()); |
| 4903 | } | 4905 | } |
| 4904 | bc_parse_number(p); | 4906 | bc_parse_number(p); |
| 4905 | prev = BC_INST_NUM; | ||
| 4906 | if (t == BC_LEX_NEG) bc_parse_push(p, BC_INST_NEG); | 4907 | if (t == BC_LEX_NEG) bc_parse_push(p, BC_INST_NEG); |
| 4907 | get_token = true; | 4908 | get_token = true; |
| 4908 | break; | 4909 | break; |
