From: nasm-bot f. C. G. <gor...@gm...> - 2018-12-01 18:36:19
|
Commit-ID: 194f93322fcd3f368a46564c7e3a2b8e9caa5ccf Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=194f93322fcd3f368a46564c7e3a2b8e9caa5ccf Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sat, 1 Dec 2018 20:01:40 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sat, 1 Dec 2018 20:01:40 +0300 float: Use nasm_error helpers Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- asm/float.c | 60 +++++++++++++++++++++++++----------------------------------- 1 file changed, 25 insertions(+), 35 deletions(-) diff --git a/asm/float.c b/asm/float.c index 32aabc0..eaa6cd2 100644 --- a/asm/float.c +++ b/asm/float.c @@ -182,9 +182,8 @@ static int32_t read_exponent(const char *string, int32_t max) } else if (*string == '_') { /* do nothing */ } else { - nasm_error(ERR_NONFATAL, - "invalid character in floating-point constant %s: '%c'", - "exponent", *string); + nasm_nonfatal("invalid character in floating-point constant %s: '%c'", + "exponent", *string); return INT32_MAX; } string++; @@ -219,8 +218,7 @@ static bool ieee_flconvert(const char *string, fp_limb *mant, if (!seendot) { seendot = true; } else { - nasm_error(ERR_NONFATAL, - "too many periods in floating-point constant"); + nasm_nonfatal("too many periods in floating-point constant"); return false; } } else if (*string >= '0' && *string <= '9') { @@ -234,9 +232,9 @@ static bool ieee_flconvert(const char *string, fp_limb *mant, *p++ = *string - '0'; } else { if (!warned) { - nasm_error(ERR_WARNING|ERR_WARN_FL_TOOLONG|ERR_PASS2, - "floating-point constant significand contains " - "more than %i digits", MANT_DIGITS); + nasm_warnf(ERR_WARN_FL_TOOLONG|ERR_PASS2, + "floating-point constant significand contains " + "more than %i digits", MANT_DIGITS); warned = true; } } @@ -247,9 +245,9 @@ static bool ieee_flconvert(const char *string, fp_limb *mant, } else if (*string == '_') { /* do nothing */ } else { - nasm_error(ERR_NONFATAL|ERR_PASS2, - "invalid character in floating-point constant %s: '%c'", - "significand", *string); + nasm_nonfatalf(ERR_PASS2, + "invalid character in floating-point constant %s: '%c'", + "significand", *string); return false; } string++; @@ -533,8 +531,7 @@ static bool ieee_flconvert_bin(const char *string, int bits, if (!seendot) seendot = true; else { - nasm_error(ERR_NONFATAL, - "too many periods in floating-point constant"); + nasm_nonfatal("too many periods in floating-point constant"); return false; } } else if ((v = hexval(c)) < (unsigned int)radix) { @@ -576,8 +573,7 @@ static bool ieee_flconvert_bin(const char *string, int bits, } else if (c == '_') { /* ignore */ } else { - nasm_error(ERR_NONFATAL, - "floating-point constant: `%c' is invalid character", c); + nasm_nonfatal("floating-point constant: `%c' is invalid character", c); return false; } } @@ -676,8 +672,7 @@ static int to_packed_bcd(const char *str, const char *p, int tv = -1; if (fmt != &ieee_80) { - nasm_error(ERR_NONFATAL, - "packed BCD requires an 80-bit format"); + nasm_nonfatal("packed BCD requires an 80-bit format"); return 0; } @@ -685,10 +680,8 @@ static int to_packed_bcd(const char *str, const char *p, c = *p--; if (c >= '0' && c <= '9') { if (tv < 0) { - if (n == 9) { - nasm_error(ERR_WARNING|ERR_PASS2, - "packed BCD truncated to 18 digits"); - } + if (n == 9) + nasm_warnf(ERR_PASS2, "packed BCD truncated to 18 digits"); tv = c-'0'; } else { if (n < 9) @@ -699,8 +692,7 @@ static int to_packed_bcd(const char *str, const char *p, } else if (c == '_') { /* do nothing */ } else { - nasm_error(ERR_NONFATAL, - "invalid character `%c' in packed BCD constant", c); + nasm_nonfatal("invalid character `%c' in packed BCD constant", c); return 0; } } @@ -760,8 +752,7 @@ static int to_float(const char *str, int s, uint8_t *result, type = FL_INFINITY; break; default: - nasm_error(ERR_NONFATAL, - "internal error: unknown FP constant token `%s'\n", str); + nasm_nonfatal("internal error: unknown FP constant token `%s'", str); type = FL_QNAN; break; } @@ -808,8 +799,8 @@ static int to_float(const char *str, int s, uint8_t *result, type = FL_NORMAL; } else if (exponent > 0) { if (pass0 == 1) - nasm_error(ERR_WARNING|ERR_WARN_FL_OVERFLOW|ERR_PASS2, - "overflow in floating-point constant"); + nasm_warnf(ERR_WARN_FL_OVERFLOW|ERR_PASS2, + "overflow in floating-point constant"); type = FL_INFINITY; } else { /* underflow or denormal; the denormal code handles @@ -843,13 +834,12 @@ static int to_float(const char *str, int s, uint8_t *result, } else { if (daz || is_zero(mant)) { /* Flush denormals to zero */ - nasm_error(ERR_WARNING|ERR_WARN_FL_UNDERFLOW|ERR_PASS2, - "underflow in floating-point constant"); + nasm_warnf(ERR_WARN_FL_UNDERFLOW|ERR_PASS2, + "underflow in floating-point constant"); goto zero; - } else { - nasm_error(ERR_WARNING|ERR_WARN_FL_DENORM|ERR_PASS2, - "denormal floating-point constant"); - } + } else + nasm_warnf(ERR_WARN_FL_DENORM|ERR_PASS2, + "denormal floating-point constant"); } break; } @@ -863,8 +853,8 @@ static int to_float(const char *str, int s, uint8_t *result, ieee_shr(mant, 1); exponent++; if (exponent >= (expmax << 1)-1) { - nasm_error(ERR_WARNING|ERR_WARN_FL_OVERFLOW|ERR_PASS2, - "overflow in floating-point constant"); + nasm_warnf(ERR_WARN_FL_OVERFLOW|ERR_PASS2, + "overflow in floating-point constant"); type = FL_INFINITY; goto overflow; } |