diff options
author | Lewis Russell <lewis6991@gmail.com> | 2022-03-24 11:14:04 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-24 12:14:04 +0100 |
commit | fcd57980f91ca01227b46de1659e6228115e1278 (patch) | |
tree | 5664b765c65c7fef78315d0ae91505f796a1e7df /src/nvim/eval.c | |
parent | 0c4575311936bb015eecbf806074393170ef2038 (diff) | |
download | rneovim-fcd57980f91ca01227b46de1659e6228115e1278.tar.gz rneovim-fcd57980f91ca01227b46de1659e6228115e1278.tar.bz2 rneovim-fcd57980f91ca01227b46de1659e6228115e1278.zip |
chore: add additional compiler flags (#17815)
Added:
- -Wdouble-promotion
- -Wmissing-noreturn
- -Wmissing-format-attribute
- -Wsuggest-attribute={pure,const,malloc,cold}
Resolves: #343
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r-- | src/nvim/eval.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 7f937a3137..fbbc543893 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -3976,18 +3976,11 @@ static int eval6(char_u **arg, typval_T *rettv, int evaluate, int want_string) f1 = f1 * f2; } else if (op == '/') { // Division by zero triggers error from AddressSanitizer - f1 = (f2 == 0 - ? ( + f1 = (f2 == 0 ? ( #ifdef NAN - f1 == 0 - ? NAN - : + f1 == 0 ? (float_T)NAN : #endif - (f1 > 0 - ? INFINITY - : -INFINITY) - ) - : f1 / f2); + (f1 > 0 ? (float_T)INFINITY : (float_T)-INFINITY)) : f1 / f2); } else { emsg(_("E804: Cannot use '%' with Float")); return FAIL; @@ -5842,15 +5835,15 @@ size_t string2float(const char *const text, float_T *const ret_value) // MS-Windows does not deal with "inf" and "nan" properly if (STRNICMP(text, "inf", 3) == 0) { - *ret_value = INFINITY; + *ret_value = (float_T)INFINITY; return 3; } if (STRNICMP(text, "-inf", 3) == 0) { - *ret_value = -INFINITY; + *ret_value = (float_T)-INFINITY; return 4; } if (STRNICMP(text, "nan", 3) == 0) { - *ret_value = NAN; + *ret_value = (float_T)NAN; return 3; } *ret_value = strtod(text, &s); |