Patch 8.2.0271
Problem: The "num64" feature is available everywhere and building without
it causes problems.
Solution: Graduage the "num64" feature. (James McCoy, closes #5650)
Files: src/evalfunc.c, src/feature.h, src/message.c, src/structs.h,
src/testdir/test_expr.vim, src/testdir/test_largefile.vim,
src/testdir/test_sort.vim, src/testdir/test_vimscript.vim,
src/version.c
*** ../vim-8.2.0270/src/evalfunc.c 2020-02-14 16:52:08.319436425 +0100
--- src/evalfunc.c 2020-02-17 22:06:21.915681275 +0100
***************
*** 3545,3553 ****
"mzscheme",
#endif
#endif
- #ifdef FEAT_NUM64
"num64",
- #endif
#ifdef FEAT_OLE
"ole",
#endif
--- 3545,3551 ----
*** ../vim-8.2.0270/src/feature.h 2019-12-17 21:27:14.690319902 +0100
--- src/feature.h 2020-02-17 22:06:21.915681275 +0100
***************
*** 285,300 ****
* +eval Built-in script language and expression evaluation,
* ":let", ":if", etc.
* +float Floating point variables.
- * +num64 64-bit Number.
*/
#ifdef FEAT_NORMAL
# define FEAT_EVAL
# if defined(HAVE_FLOAT_FUNCS) || defined(MSWIN) || defined(MACOS_X)
# define FEAT_FLOAT
# endif
- # if defined(HAVE_STDINT_H) || defined(MSWIN) || (VIM_SIZEOF_LONG >= 8)
- # define FEAT_NUM64
- # endif
#endif
#ifdef FEAT_EVAL
--- 285,296 ----
*** ../vim-8.2.0270/src/message.c 2020-01-26 15:52:33.023833239 +0100
--- src/message.c 2020-02-17 22:06:21.915681275 +0100
***************
*** 4246,4255 ****
# define TMP_LEN 350 // On my system 1e308 is the biggest number possible.
// That sounds reasonable to use as the maximum
// printable.
- # elif defined(FEAT_NUM64)
- # define TMP_LEN 66
# else
! # define TMP_LEN 34
# endif
char tmp[TMP_LEN];
--- 4246,4253 ----
# define TMP_LEN 350 // On my system 1e308 is the biggest number possible.
// That sounds reasonable to use as the maximum
// printable.
# else
! # define TMP_LEN 66
# endif
char tmp[TMP_LEN];
***************
*** 4374,4384 ****
if (length_modifier == 'l' && *p == 'l')
{
// double l = long long
- # ifdef FEAT_NUM64
length_modifier = 'L';
- # else
- length_modifier = 'l'; // treat it as a single 'l'
- # endif
p++;
}
}
--- 4372,4378 ----
***************
*** 4394,4400 ****
default: break;
}
! # if defined(FEAT_EVAL) && defined(FEAT_NUM64)
switch (fmt_spec)
{
case 'd': case 'u': case 'o': case 'x': case 'X':
--- 4388,4394 ----
default: break;
}
! # if defined(FEAT_EVAL)
switch (fmt_spec)
{
case 'd': case 'u': case 'o': case 'x': case 'X':
***************
*** 4516,4526 ****
long int long_arg = 0;
unsigned long int ulong_arg = 0;
- # ifdef FEAT_NUM64
// only defined for length modifier ll
varnumber_T llong_arg = 0;
uvarnumber_T ullong_arg = 0;
- # endif
// only defined for b conversion
uvarnumber_T bin_arg = 0;
--- 4510,4518 ----
***************
*** 4581,4599 ****
else if (long_arg < 0)
arg_sign = -1;
break;
- # ifdef FEAT_NUM64
case 'L':
llong_arg =
! # if defined(FEAT_EVAL)
tvs != NULL ? tv_nr(tvs, &arg_idx) :
! # endif
va_arg(ap, varnumber_T);
if (llong_arg > 0)
arg_sign = 1;
else if (llong_arg < 0)
arg_sign = -1;
break;
- # endif
}
}
else
--- 4573,4589 ----
else if (long_arg < 0)
arg_sign = -1;
break;
case 'L':
llong_arg =
! # if defined(FEAT_EVAL)
tvs != NULL ? tv_nr(tvs, &arg_idx) :
! # endif
va_arg(ap, varnumber_T);
if (llong_arg > 0)
arg_sign = 1;
else if (llong_arg < 0)
arg_sign = -1;
break;
}
}
else
***************
*** 4622,4639 ****
if (ulong_arg != 0)
arg_sign = 1;
break;
- # ifdef FEAT_NUM64
case 'L':
ullong_arg =
! # if defined(FEAT_EVAL)
tvs != NULL ? (uvarnumber_T)
tv_nr(tvs, &arg_idx) :
! # endif
va_arg(ap, uvarnumber_T);
if (ullong_arg != 0)
arg_sign = 1;
break;
- # endif
}
}
--- 4612,4627 ----
if (ulong_arg != 0)
arg_sign = 1;
break;
case 'L':
ullong_arg =
! # if defined(FEAT_EVAL)
tvs != NULL ? (uvarnumber_T)
tv_nr(tvs, &arg_idx) :
! # endif
va_arg(ap, uvarnumber_T);
if (ullong_arg != 0)
arg_sign = 1;
break;
}
}
***************
*** 4687,4703 ****
;
else if (length_modifier == 'L')
{
! # ifdef FEAT_NUM64
! # ifdef MSWIN
f[f_l++] = 'I';
f[f_l++] = '6';
f[f_l++] = '4';
- # else
- f[f_l++] = 'l';
- f[f_l++] = 'l';
- # endif
# else
f[f_l++] = 'l';
# endif
}
else
--- 4675,4687 ----
;
else if (length_modifier == 'L')
{
! # ifdef MSWIN
f[f_l++] = 'I';
f[f_l++] = '6';
f[f_l++] = '4';
# else
f[f_l++] = 'l';
+ f[f_l++] = 'l';
# endif
}
else
***************
*** 4735,4745 ****
case 'l': str_arg_l += sprintf(
tmp + str_arg_l, f, long_arg);
break;
- # ifdef FEAT_NUM64
case 'L': str_arg_l += sprintf(
tmp + str_arg_l, f, llong_arg);
break;
- # endif
}
}
else
--- 4719,4727 ----
***************
*** 4754,4764 ****
case 'l': str_arg_l += sprintf(
tmp + str_arg_l, f, ulong_arg);
break;
- # ifdef FEAT_NUM64
case 'L': str_arg_l += sprintf(
tmp + str_arg_l, f, ullong_arg);
break;
- # endif
}
}
--- 4736,4744 ----
*** ../vim-8.2.0270/src/structs.h 2020-02-06 17:51:31.306336443 +0100
--- src/structs.h 2020-02-17 22:06:21.915681275 +0100
***************
*** 1245,1286 ****
typedef long_u hash_T; // Type for hi_hash
- #ifdef FEAT_NUM64
// Use 64-bit Number.
! # ifdef MSWIN
! # ifdef PROTO
typedef long varnumber_T;
typedef unsigned long uvarnumber_T;
! # define VARNUM_MIN LONG_MIN
! # define VARNUM_MAX LONG_MAX
! # define UVARNUM_MAX ULONG_MAX
! # else
typedef __int64 varnumber_T;
typedef unsigned __int64 uvarnumber_T;
! # define VARNUM_MIN _I64_MIN
! # define VARNUM_MAX _I64_MAX
! # define UVARNUM_MAX _UI64_MAX
! # endif
! # elif defined(HAVE_STDINT_H)
typedef int64_t varnumber_T;
typedef uint64_t uvarnumber_T;
! # define VARNUM_MIN INT64_MIN
! # define VARNUM_MAX INT64_MAX
! # define UVARNUM_MAX UINT64_MAX
! # else
typedef long varnumber_T;
typedef unsigned long uvarnumber_T;
! # define VARNUM_MIN LONG_MIN
! # define VARNUM_MAX LONG_MAX
! # define UVARNUM_MAX ULONG_MAX
! # endif
! #else
! // Use 32-bit Number.
! typedef int varnumber_T;
! typedef unsigned int uvarnumber_T;
! # define VARNUM_MIN INT_MIN
! # define VARNUM_MAX INT_MAX
! # define UVARNUM_MAX UINT_MAX
#endif
typedef double float_T;
--- 1245,1277 ----
typedef long_u hash_T; // Type for hi_hash
// Use 64-bit Number.
! #ifdef MSWIN
! # ifdef PROTO
typedef long varnumber_T;
typedef unsigned long uvarnumber_T;
! # define VARNUM_MIN LONG_MIN
! # define VARNUM_MAX LONG_MAX
! # define UVARNUM_MAX ULONG_MAX
! # else
typedef __int64 varnumber_T;
typedef unsigned __int64 uvarnumber_T;
! # define VARNUM_MIN _I64_MIN
! # define VARNUM_MAX _I64_MAX
! # define UVARNUM_MAX _UI64_MAX
! # endif
! #elif defined(HAVE_STDINT_H)
typedef int64_t varnumber_T;
typedef uint64_t uvarnumber_T;
! # define VARNUM_MIN INT64_MIN
! # define VARNUM_MAX INT64_MAX
! # define UVARNUM_MAX UINT64_MAX
! #else
typedef long varnumber_T;
typedef unsigned long uvarnumber_T;
! # define VARNUM_MIN LONG_MIN
! # define VARNUM_MAX LONG_MAX
! # define UVARNUM_MAX ULONG_MAX
#endif
typedef double float_T;
*** ../vim-8.2.0270/src/testdir/test_expr.vim 2020-02-16 16:18:45.657781422
+0100
--- src/testdir/test_expr.vim 2020-02-17 22:06:21.915681275 +0100
***************
*** 382,390 ****
endfunc
function Test_printf_64bit()
! if has('num64')
! call assert_equal("123456789012345", printf('%d', 123456789012345))
! endif
endfunc
function Test_printf_spec_s()
--- 382,388 ----
endfunc
function Test_printf_64bit()
! call assert_equal("123456789012345", printf('%d', 123456789012345))
endfunc
function Test_printf_spec_s()
***************
*** 423,434 ****
call assert_equal(" 0b1111011", printf('%#10b', 123))
call assert_equal("0B01111011", printf('%#010B', 123))
call assert_equal("1001001100101100000001011010010", printf('%b',
1234567890))
! if has('num64')
! call assert_equal("11100000100100010000110000011011101111101111001",
printf('%b', 123456789012345))
! call
assert_equal("1111111111111111111111111111111111111111111111111111111111111111",
printf('%b', -1))
! else
! call assert_equal("11111111111111111111111111111111", printf('%b', -1))
! endif
endfunc
func Test_substitute_expr()
--- 421,428 ----
call assert_equal(" 0b1111011", printf('%#10b', 123))
call assert_equal("0B01111011", printf('%#010B', 123))
call assert_equal("1001001100101100000001011010010", printf('%b',
1234567890))
! call assert_equal("11100000100100010000110000011011101111101111001",
printf('%b', 123456789012345))
! call
assert_equal("1111111111111111111111111111111111111111111111111111111111111111",
printf('%b', -1))
endfunc
func Test_substitute_expr()
*** ../vim-8.2.0270/src/testdir/test_largefile.vim 2016-07-01
21:42:24.000000000 +0200
--- src/testdir/test_largefile.vim 2020-02-17 22:06:21.919681264 +0100
***************
*** 24,34 ****
w
" Check if the file size is 4,000,000,000 bytes.
let fsize=getfsize(fname)
! if has('num64')
! call assert_true(fsize == 4000000000)
! else
! " getfsize() returns -2 if a Number is 32 bits.
! call assert_true(fsize == -2)
! endif
call delete(fname)
endfunc
--- 24,29 ----
w
" Check if the file size is 4,000,000,000 bytes.
let fsize=getfsize(fname)
! call assert_true(fsize == 4000000000)
call delete(fname)
endfunc
*** ../vim-8.2.0270/src/testdir/test_sort.vim 2020-02-11 22:03:43.038846226
+0100
--- src/testdir/test_sort.vim 2020-02-17 22:06:21.919681264 +0100
***************
*** 1295,1303 ****
\ '2147483647'], getline(1, '$'))
bwipe!
! if has('num64')
! new
! a
-9223372036854775808
-9223372036854775807
--- 1295,1302 ----
\ '2147483647'], getline(1, '$'))
bwipe!
! new
! a
-9223372036854775808
-9223372036854775807
***************
*** 1312,1333 ****
abc
.
! sort n
! call assert_equal(['',
! \ 'abc',
! \ '',
! \ '-9223372036854775808',
! \ '-9223372036854775808',
! \ '-9223372036854775807',
! \ '-9223372036854775806',
! \ '-1',
! \ '0',
! \ '1',
! \ '9223372036854775806',
! \ '9223372036854775807',
! \ '9223372036854775807'], getline(1, '$'))
! bwipe!
! endif
endfunc
--- 1311,1331 ----
abc
.
! sort n
! call assert_equal(['',
! \ 'abc',
! \ '',
! \ '-9223372036854775808',
! \ '-9223372036854775808',
! \ '-9223372036854775807',
! \ '-9223372036854775806',
! \ '-1',
! \ '0',
! \ '1',
! \ '9223372036854775806',
! \ '9223372036854775807',
! \ '9223372036854775807'], getline(1, '$'))
! bwipe!
endfunc
*** ../vim-8.2.0270/src/testdir/test_vimscript.vim 2020-02-17
21:33:26.270098788 +0100
--- src/testdir/test_vimscript.vim 2020-02-17 22:06:21.919681264 +0100
***************
*** 1416,1425 ****
"-------------------------------------------------------------------------------
func Test_num64()
- if !has('num64')
- return
- endif
-
call assert_notequal( 4294967296, 0)
call assert_notequal(-4294967296, 0)
call assert_equal( 4294967296, 0xFFFFffff + 1)
--- 1416,1421 ----
***************
*** 1692,1718 ****
" Test special cases: division or modulus with 0.
let x = 1
let x /= 0
! if has('num64')
! call assert_equal(0x7FFFFFFFFFFFFFFF, x)
! else
! call assert_equal(0x7fffffff, x)
! endif
let x = -1
let x /= 0
! if has('num64')
! call assert_equal(-0x7FFFFFFFFFFFFFFF, x)
! else
! call assert_equal(-0x7fffffff, x)
! endif
let x = 0
let x /= 0
! if has('num64')
! call assert_equal(-0x7FFFFFFFFFFFFFFF - 1, x)
! else
! call assert_equal(-0x7FFFFFFF - 1, x)
! endif
let x = 1
let x %= 0
--- 1688,1702 ----
" Test special cases: division or modulus with 0.
let x = 1
let x /= 0
! call assert_equal(0x7FFFFFFFFFFFFFFF, x)
let x = -1
let x /= 0
! call assert_equal(-0x7FFFFFFFFFFFFFFF, x)
let x = 0
let x /= 0
! call assert_equal(-0x7FFFFFFFFFFFFFFF - 1, x)
let x = 1
let x %= 0
*** ../vim-8.2.0270/src/version.c 2020-02-17 21:33:26.270098788 +0100
--- src/version.c 2020-02-17 22:07:03.723544505 +0100
***************
*** 436,446 ****
#else
"-netbeans_intg",
#endif
- #ifdef FEAT_NUM64
"+num64",
- #else
- "-num64",
- #endif
#ifdef FEAT_GUI_MSWIN
# ifdef FEAT_OLE
"+ole",
--- 436,442 ----
*** ../vim-8.2.0270/src/version.c 2020-02-17 21:33:26.270098788 +0100
--- src/version.c 2020-02-17 22:07:03.723544505 +0100
***************
*** 744,745 ****
--- 740,743 ----
{ /* Add new patch number below this line */
+ /**/
+ 271,
/**/
--
Where do you want to crash today?
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202002172113.01HLDeix022430%40masaka.moolenaar.net.