diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-01-26 21:42:03 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-01-26 21:42:03 +0100 |
commit | a5d5953d59730d9bf9c00a727c4aeb56f6ffc944 (patch) | |
tree | c5bec5d9cd05b5f9772c98e1313c0594c5003df4 /src | |
parent | 21b9e9773d64de40994f8762173bdd8befa6acf7 (diff) | |
download | vim-git-a5d5953d59730d9bf9c00a727c4aeb56f6ffc944.tar.gz |
patch 8.2.0155: warnings from MinGW compiler; tests fail without +floatv8.2.0155
Problem: Warnings from MinGW compiler. (John Marriott) Json test fails when
building without +float feature.
Solution: Init variables. Fix Json parsing. Skip a few tests that require
the +float feature.
Diffstat (limited to 'src')
-rw-r--r-- | src/if_py_both.h | 2 | ||||
-rw-r--r-- | src/json.c | 8 | ||||
-rw-r--r-- | src/testdir/test_method.vim | 3 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/vim9compile.c | 5 | ||||
-rw-r--r-- | src/vim9execute.c | 4 | ||||
-rw-r--r-- | src/vim9script.c | 2 |
7 files changed, 22 insertions, 4 deletions
diff --git a/src/if_py_both.h b/src/if_py_both.h index 45bfeec59..3da87ccc3 100644 --- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -6357,8 +6357,8 @@ ConvertToPyObject(typval_T *tv) ? "" : (char *)tv->vval.v_string); case VAR_NUMBER: return PyLong_FromLong((long) tv->vval.v_number); -#ifdef FEAT_FLOAT case VAR_FLOAT: +#ifdef FEAT_FLOAT return PyFloat_FromDouble((double) tv->vval.v_float); #endif case VAR_LIST: diff --git a/src/json.c b/src/json.c index 6d7b1939e..da0ba4bb2 100644 --- a/src/json.c +++ b/src/json.c @@ -761,9 +761,9 @@ json_decode_item(js_read_T *reader, typval_T *res, int options) break; default: - if (VIM_ISDIGIT(*p) || (*p == '-' && VIM_ISDIGIT(p[1]))) + if (VIM_ISDIGIT(*p) || (*p == '-' + && (VIM_ISDIGIT(p[1]) || p[1] == NUL))) { -#ifdef FEAT_FLOAT char_u *sp = p; if (*sp == '-') @@ -782,6 +782,7 @@ json_decode_item(js_read_T *reader, typval_T *res, int options) } } sp = skipdigits(sp); +#ifdef FEAT_FLOAT if (*sp == '.' || *sp == 'e' || *sp == 'E') { if (cur_item == NULL) @@ -889,7 +890,8 @@ json_decode_item(js_read_T *reader, typval_T *res, int options) } #endif // check for truncated name - len = (int)(reader->js_end - (reader->js_buf + reader->js_used)); + len = (int)(reader->js_end + - (reader->js_buf + reader->js_used)); if ( (len < 5 && STRNICMP((char *)p, "false", len) == 0) #ifdef FEAT_FLOAT diff --git a/src/testdir/test_method.vim b/src/testdir/test_method.vim index b82dbb494..978e5f5b3 100644 --- a/src/testdir/test_method.vim +++ b/src/testdir/test_method.vim @@ -1,5 +1,7 @@ " Tests for ->method() +source check.vim + func Test_list_method() let l = [1, 2, 3] call assert_equal([1, 2, 3, 4], [1, 2, 3]->add(4)) @@ -118,6 +120,7 @@ func Test_method_funcref() endfunc func Test_method_float() + CheckFeature float eval 1.234->string()->assert_equal('1.234') eval -1.234->string()->assert_equal('-1.234') endfunc diff --git a/src/version.c b/src/version.c index 19a5c0d10..dc531be7d 100644 --- a/src/version.c +++ b/src/version.c @@ -743,6 +743,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 155, +/**/ 154, /**/ 153, diff --git a/src/vim9compile.c b/src/vim9compile.c index 66906221c..29595cca4 100644 --- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -1217,8 +1217,13 @@ parse_type(char_u **arg, garray_T *type_list) case 'f': if (len == 5 && STRNCMP(*arg, "float", len) == 0) { +#ifdef FEAT_FLOAT *arg += len; return &t_float; +#else + emsg(_("E1055: This Vim is not compiled with float support")); + return &t_any; +#endif } if (len == 4 && STRNCMP(*arg, "func", len) == 0) { diff --git a/src/vim9execute.c b/src/vim9execute.c index a738aa1e5..f8efa1d6c 100644 --- a/src/vim9execute.c +++ b/src/vim9execute.c @@ -1095,6 +1095,7 @@ call_def_function( // Computation with two float arguments case ISN_OPFLOAT: case ISN_COMPAREFLOAT: +#ifdef FEAT_FLOAT { typval_T *tv1 = STACK_TV_BOT(-2); typval_T *tv2 = STACK_TV_BOT(-1); @@ -1127,6 +1128,7 @@ call_def_function( else tv1->vval.v_float = res; } +#endif break; case ISN_COMPARELIST: @@ -1618,7 +1620,9 @@ ex_disassemble(exarg_T *eap) get_var_special_name(iptr->isn_arg.number)); break; case ISN_PUSHF: +#ifdef FEAT_FLOAT smsg("%4d PUSHF %g", current, iptr->isn_arg.fnumber); +#endif break; case ISN_PUSHS: smsg("%4d PUSHS \"%s\"", current, iptr->isn_arg.string); diff --git a/src/vim9script.c b/src/vim9script.c index fb1925835..9aa33d0ab 100644 --- a/src/vim9script.c +++ b/src/vim9script.c @@ -323,6 +323,7 @@ handle_import(char_u *arg_start, garray_T *gap, int import_sid) *arg = cc; return NULL; } + ufunc = NULL; } else { @@ -355,6 +356,7 @@ handle_import(char_u *arg_start, garray_T *gap, int import_sid) *arg = cc; return NULL; } + sv = NULL; } imported = new_imported(gap != NULL ? gap |