Skip to content

Commit a5d5953

Browse files
committed
patch 8.2.0155: warnings from MinGW compiler; tests fail without +float
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.
1 parent 21b9e97 commit a5d5953

7 files changed

Lines changed: 22 additions & 4 deletions

File tree

src/if_py_both.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6357,8 +6357,8 @@ ConvertToPyObject(typval_T *tv)
63576357
? "" : (char *)tv->vval.v_string);
63586358
case VAR_NUMBER:
63596359
return PyLong_FromLong((long) tv->vval.v_number);
6360-
#ifdef FEAT_FLOAT
63616360
case VAR_FLOAT:
6361+
#ifdef FEAT_FLOAT
63626362
return PyFloat_FromDouble((double) tv->vval.v_float);
63636363
#endif
63646364
case VAR_LIST:

src/json.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -761,9 +761,9 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
761761
break;
762762

763763
default:
764-
if (VIM_ISDIGIT(*p) || (*p == '-' && VIM_ISDIGIT(p[1])))
764+
if (VIM_ISDIGIT(*p) || (*p == '-'
765+
&& (VIM_ISDIGIT(p[1]) || p[1] == NUL)))
765766
{
766-
#ifdef FEAT_FLOAT
767767
char_u *sp = p;
768768

769769
if (*sp == '-')
@@ -782,6 +782,7 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
782782
}
783783
}
784784
sp = skipdigits(sp);
785+
#ifdef FEAT_FLOAT
785786
if (*sp == '.' || *sp == 'e' || *sp == 'E')
786787
{
787788
if (cur_item == NULL)
@@ -889,7 +890,8 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
889890
}
890891
#endif
891892
// check for truncated name
892-
len = (int)(reader->js_end - (reader->js_buf + reader->js_used));
893+
len = (int)(reader->js_end
894+
- (reader->js_buf + reader->js_used));
893895
if (
894896
(len < 5 && STRNICMP((char *)p, "false", len) == 0)
895897
#ifdef FEAT_FLOAT

src/testdir/test_method.vim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
" Tests for ->method()
22

3+
source check.vim
4+
35
func Test_list_method()
46
let l = [1, 2, 3]
57
call assert_equal([1, 2, 3, 4], [1, 2, 3]->add(4))
@@ -118,6 +120,7 @@ func Test_method_funcref()
118120
endfunc
119121

120122
func Test_method_float()
123+
CheckFeature float
121124
eval 1.234->string()->assert_equal('1.234')
122125
eval -1.234->string()->assert_equal('-1.234')
123126
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,8 @@ static char *(features[]) =
742742

743743
static int included_patches[] =
744744
{ /* Add new patch number below this line */
745+
/**/
746+
155,
745747
/**/
746748
154,
747749
/**/

src/vim9compile.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,8 +1217,13 @@ parse_type(char_u **arg, garray_T *type_list)
12171217
case 'f':
12181218
if (len == 5 && STRNCMP(*arg, "float", len) == 0)
12191219
{
1220+
#ifdef FEAT_FLOAT
12201221
*arg += len;
12211222
return &t_float;
1223+
#else
1224+
emsg(_("E1055: This Vim is not compiled with float support"));
1225+
return &t_any;
1226+
#endif
12221227
}
12231228
if (len == 4 && STRNCMP(*arg, "func", len) == 0)
12241229
{

src/vim9execute.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,7 @@ call_def_function(
10951095
// Computation with two float arguments
10961096
case ISN_OPFLOAT:
10971097
case ISN_COMPAREFLOAT:
1098+
#ifdef FEAT_FLOAT
10981099
{
10991100
typval_T *tv1 = STACK_TV_BOT(-2);
11001101
typval_T *tv2 = STACK_TV_BOT(-1);
@@ -1127,6 +1128,7 @@ call_def_function(
11271128
else
11281129
tv1->vval.v_float = res;
11291130
}
1131+
#endif
11301132
break;
11311133

11321134
case ISN_COMPARELIST:
@@ -1618,7 +1620,9 @@ ex_disassemble(exarg_T *eap)
16181620
get_var_special_name(iptr->isn_arg.number));
16191621
break;
16201622
case ISN_PUSHF:
1623+
#ifdef FEAT_FLOAT
16211624
smsg("%4d PUSHF %g", current, iptr->isn_arg.fnumber);
1625+
#endif
16221626
break;
16231627
case ISN_PUSHS:
16241628
smsg("%4d PUSHS \"%s\"", current, iptr->isn_arg.string);

src/vim9script.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ handle_import(char_u *arg_start, garray_T *gap, int import_sid)
323323
*arg = cc;
324324
return NULL;
325325
}
326+
ufunc = NULL;
326327
}
327328
else
328329
{
@@ -355,6 +356,7 @@ handle_import(char_u *arg_start, garray_T *gap, int import_sid)
355356
*arg = cc;
356357
return NULL;
357358
}
359+
sv = NULL;
358360
}
359361

360362
imported = new_imported(gap != NULL ? gap

0 commit comments

Comments
 (0)