diff options
-rw-r--r-- | miscutils/bc.c | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c index aa0a2c636..6dc0f5441 100644 --- a/miscutils/bc.c +++ b/miscutils/bc.c | |||
@@ -2393,6 +2393,9 @@ static BcStatus bc_num_stream(BcNum *n, BcNum *base) | |||
2393 | { | 2393 | { |
2394 | return bc_num_printNum(n, base, 1, bc_num_printChar); | 2394 | return bc_num_printNum(n, base, 1, bc_num_printChar); |
2395 | } | 2395 | } |
2396 | #if ERRORS_ARE_FATAL | ||
2397 | # define bc_num_stream(...) (bc_num_stream(__VA_ARGS__), BC_STATUS_SUCCESS) | ||
2398 | #endif | ||
2396 | #endif | 2399 | #endif |
2397 | 2400 | ||
2398 | static bool bc_num_strValid(const char *val, size_t base) | 2401 | static bool bc_num_strValid(const char *val, size_t base) |
@@ -3211,6 +3214,9 @@ static BcStatus bc_lex_comment(BcLex *l) | |||
3211 | 3214 | ||
3212 | return BC_STATUS_SUCCESS; | 3215 | return BC_STATUS_SUCCESS; |
3213 | } | 3216 | } |
3217 | #if ERRORS_ARE_FATAL | ||
3218 | # define bc_lex_comment(...) (bc_lex_comment(__VA_ARGS__), BC_STATUS_SUCCESS) | ||
3219 | #endif | ||
3214 | 3220 | ||
3215 | static FAST_FUNC BcStatus bc_lex_token(BcLex *l) | 3221 | static FAST_FUNC BcStatus bc_lex_token(BcLex *l) |
3216 | { | 3222 | { |
@@ -5560,6 +5566,9 @@ static BcStatus bc_program_binOpPrep(BcResult **l, BcNum **ln, | |||
5560 | 5566 | ||
5561 | return s; | 5567 | return s; |
5562 | } | 5568 | } |
5569 | #if ERRORS_ARE_FATAL | ||
5570 | # define bc_program_binOpPrep(...) (bc_program_binOpPrep(__VA_ARGS__), BC_STATUS_SUCCESS) | ||
5571 | #endif | ||
5563 | 5572 | ||
5564 | static void bc_program_binOpRetire(BcResult *r) | 5573 | static void bc_program_binOpRetire(BcResult *r) |
5565 | { | 5574 | { |
@@ -5947,6 +5956,9 @@ static BcStatus bc_program_assignStr(BcResult *r, BcVec *v, | |||
5947 | 5956 | ||
5948 | return BC_STATUS_SUCCESS; | 5957 | return BC_STATUS_SUCCESS; |
5949 | } | 5958 | } |
5959 | #if ERRORS_ARE_FATAL | ||
5960 | # define bc_program_assignStr(...) (bc_program_assignStr(__VA_ARGS__), BC_STATUS_SUCCESS) | ||
5961 | #endif | ||
5950 | #endif // ENABLE_DC | 5962 | #endif // ENABLE_DC |
5951 | 5963 | ||
5952 | static BcStatus bc_program_copyToVar(char *name, bool var) | 5964 | static BcStatus bc_program_copyToVar(char *name, bool var) |
@@ -5990,6 +6002,9 @@ static BcStatus bc_program_copyToVar(char *name, bool var) | |||
5990 | 6002 | ||
5991 | return s; | 6003 | return s; |
5992 | } | 6004 | } |
6005 | #if ERRORS_ARE_FATAL | ||
6006 | # define bc_program_copyToVar(...) (bc_program_copyToVar(__VA_ARGS__), BC_STATUS_SUCCESS) | ||
6007 | #endif | ||
5993 | 6008 | ||
5994 | static BcStatus bc_program_assign(char inst) | 6009 | static BcStatus bc_program_assign(char inst) |
5995 | { | 6010 | { |
@@ -6212,7 +6227,6 @@ static BcStatus bc_program_incdec(char inst) | |||
6212 | 6227 | ||
6213 | static BcStatus bc_program_call(char *code, size_t *idx) | 6228 | static BcStatus bc_program_call(char *code, size_t *idx) |
6214 | { | 6229 | { |
6215 | BcStatus s = BC_STATUS_SUCCESS; | ||
6216 | BcInstPtr ip; | 6230 | BcInstPtr ip; |
6217 | size_t i, nparams = bc_program_index(code, idx); | 6231 | size_t i, nparams = bc_program_index(code, idx); |
6218 | BcFunc *func; | 6232 | BcFunc *func; |
@@ -6233,6 +6247,7 @@ static BcStatus bc_program_call(char *code, size_t *idx) | |||
6233 | ip.len = G.prog.results.len - nparams; | 6247 | ip.len = G.prog.results.len - nparams; |
6234 | 6248 | ||
6235 | for (i = 0; i < nparams; ++i) { | 6249 | for (i = 0; i < nparams; ++i) { |
6250 | BcStatus s; | ||
6236 | 6251 | ||
6237 | a = bc_vec_item(&func->autos, nparams - 1 - i); | 6252 | a = bc_vec_item(&func->autos, nparams - 1 - i); |
6238 | arg = bc_vec_top(&G.prog.results); | 6253 | arg = bc_vec_top(&G.prog.results); |
@@ -6264,10 +6279,12 @@ static BcStatus bc_program_call(char *code, size_t *idx) | |||
6264 | 6279 | ||
6265 | return BC_STATUS_SUCCESS; | 6280 | return BC_STATUS_SUCCESS; |
6266 | } | 6281 | } |
6282 | #if ERRORS_ARE_FATAL | ||
6283 | # define bc_program_call(...) (bc_program_call(__VA_ARGS__), BC_STATUS_SUCCESS) | ||
6284 | #endif | ||
6267 | 6285 | ||
6268 | static BcStatus bc_program_return(char inst) | 6286 | static BcStatus bc_program_return(char inst) |
6269 | { | 6287 | { |
6270 | BcStatus s; | ||
6271 | BcResult res; | 6288 | BcResult res; |
6272 | BcFunc *f; | 6289 | BcFunc *f; |
6273 | size_t i; | 6290 | size_t i; |
@@ -6280,7 +6297,7 @@ static BcStatus bc_program_return(char inst) | |||
6280 | res.t = BC_RESULT_TEMP; | 6297 | res.t = BC_RESULT_TEMP; |
6281 | 6298 | ||
6282 | if (inst == BC_INST_RET) { | 6299 | if (inst == BC_INST_RET) { |
6283 | 6300 | BcStatus s; | |
6284 | BcNum *num; | 6301 | BcNum *num; |
6285 | BcResult *operand = bc_vec_top(&G.prog.results); | 6302 | BcResult *operand = bc_vec_top(&G.prog.results); |
6286 | 6303 | ||
@@ -6296,7 +6313,6 @@ static BcStatus bc_program_return(char inst) | |||
6296 | 6313 | ||
6297 | // We need to pop arguments as well, so this takes that into account. | 6314 | // We need to pop arguments as well, so this takes that into account. |
6298 | for (i = 0; i < f->autos.len; ++i) { | 6315 | for (i = 0; i < f->autos.len; ++i) { |
6299 | |||
6300 | BcVec *v; | 6316 | BcVec *v; |
6301 | BcId *a = bc_vec_item(&f->autos, i); | 6317 | BcId *a = bc_vec_item(&f->autos, i); |
6302 | 6318 | ||
@@ -6310,6 +6326,9 @@ static BcStatus bc_program_return(char inst) | |||
6310 | 6326 | ||
6311 | return BC_STATUS_SUCCESS; | 6327 | return BC_STATUS_SUCCESS; |
6312 | } | 6328 | } |
6329 | #if ERRORS_ARE_FATAL | ||
6330 | # define bc_program_return(...) (bc_program_return(__VA_ARGS__), BC_STATUS_SUCCESS) | ||
6331 | #endif | ||
6313 | #endif // ENABLE_BC | 6332 | #endif // ENABLE_BC |
6314 | 6333 | ||
6315 | static unsigned long bc_program_scale(BcNum *n) | 6334 | static unsigned long bc_program_scale(BcNum *n) |
@@ -6558,6 +6577,9 @@ static BcStatus bc_program_printStream(void) | |||
6558 | 6577 | ||
6559 | return s; | 6578 | return s; |
6560 | } | 6579 | } |
6580 | #if ERRORS_ARE_FATAL | ||
6581 | # define bc_program_printStream(...) (bc_program_printStream(__VA_ARGS__), BC_STATUS_SUCCESS) | ||
6582 | #endif | ||
6561 | 6583 | ||
6562 | static BcStatus bc_program_nquit(void) | 6584 | static BcStatus bc_program_nquit(void) |
6563 | { | 6585 | { |
@@ -7096,6 +7118,9 @@ err: | |||
7096 | free(data); | 7118 | free(data); |
7097 | return s; | 7119 | return s; |
7098 | } | 7120 | } |
7121 | #if ERRORS_ARE_FATAL | ||
7122 | # define bc_vm_file(...) (bc_vm_file(__VA_ARGS__), BC_STATUS_SUCCESS) | ||
7123 | #endif | ||
7099 | 7124 | ||
7100 | static BcStatus bc_vm_stdin(void) | 7125 | static BcStatus bc_vm_stdin(void) |
7101 | { | 7126 | { |