• R/O
  • SSH

vim: Commit

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

Revisãofdfe44ac6a1aca3900af8cb786b9d528a816ce0a (tree)
Hora2020-02-18 06:15:07
AutorBram Moolenaar <Bram@vim....>
CommiterBram Moolenaar

Mensagem de Log

patch 8.2.0271: the "num64" feature is available everywhere

Commit: https://github.com/vim/vim/commit/82f654e092ac5b86316bc1b30c0b07a849813186
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Feb 17 22:12:50 2020 +0100

patch 8.2.0271: the "num64" feature is available everywhere
Problem: The "num64" feature is available everywhere and building without
it causes problems.
Solution: Graduage the "num64" feature. (James McCoy, closes #5650)

Mudança Sumário

Diff

diff -r 23bd41ec57fb -r fdfe44ac6a1a src/evalfunc.c
--- a/src/evalfunc.c Mon Feb 17 21:45:05 2020 +0100
+++ b/src/evalfunc.c Mon Feb 17 22:15:07 2020 +0100
@@ -3545,9 +3545,7 @@
35453545 "mzscheme",
35463546 #endif
35473547 #endif
3548-#ifdef FEAT_NUM64
35493548 "num64",
3550-#endif
35513549 #ifdef FEAT_OLE
35523550 "ole",
35533551 #endif
diff -r 23bd41ec57fb -r fdfe44ac6a1a src/feature.h
--- a/src/feature.h Mon Feb 17 21:45:05 2020 +0100
+++ b/src/feature.h Mon Feb 17 22:15:07 2020 +0100
@@ -285,16 +285,12 @@
285285 * +eval Built-in script language and expression evaluation,
286286 * ":let", ":if", etc.
287287 * +float Floating point variables.
288- * +num64 64-bit Number.
289288 */
290289 #ifdef FEAT_NORMAL
291290 # define FEAT_EVAL
292291 # if defined(HAVE_FLOAT_FUNCS) || defined(MSWIN) || defined(MACOS_X)
293292 # define FEAT_FLOAT
294293 # endif
295-# if defined(HAVE_STDINT_H) || defined(MSWIN) || (VIM_SIZEOF_LONG >= 8)
296-# define FEAT_NUM64
297-# endif
298294 #endif
299295
300296 #ifdef FEAT_EVAL
diff -r 23bd41ec57fb -r fdfe44ac6a1a src/message.c
--- a/src/message.c Mon Feb 17 21:45:05 2020 +0100
+++ b/src/message.c Mon Feb 17 22:15:07 2020 +0100
@@ -4246,10 +4246,8 @@
42464246 # define TMP_LEN 350 // On my system 1e308 is the biggest number possible.
42474247 // That sounds reasonable to use as the maximum
42484248 // printable.
4249-# elif defined(FEAT_NUM64)
4249+# else
42504250 # define TMP_LEN 66
4251-# else
4252-# define TMP_LEN 34
42534251 # endif
42544252 char tmp[TMP_LEN];
42554253
@@ -4374,11 +4372,7 @@
43744372 if (length_modifier == 'l' && *p == 'l')
43754373 {
43764374 // double l = long long
4377-# ifdef FEAT_NUM64
43784375 length_modifier = 'L';
4379-# else
4380- length_modifier = 'l'; // treat it as a single 'l'
4381-# endif
43824376 p++;
43834377 }
43844378 }
@@ -4394,7 +4388,7 @@
43944388 default: break;
43954389 }
43964390
4397-# if defined(FEAT_EVAL) && defined(FEAT_NUM64)
4391+# if defined(FEAT_EVAL)
43984392 switch (fmt_spec)
43994393 {
44004394 case 'd': case 'u': case 'o': case 'x': case 'X':
@@ -4516,11 +4510,9 @@
45164510 long int long_arg = 0;
45174511 unsigned long int ulong_arg = 0;
45184512
4519-# ifdef FEAT_NUM64
45204513 // only defined for length modifier ll
45214514 varnumber_T llong_arg = 0;
45224515 uvarnumber_T ullong_arg = 0;
4523-# endif
45244516
45254517 // only defined for b conversion
45264518 uvarnumber_T bin_arg = 0;
@@ -4581,19 +4573,17 @@
45814573 else if (long_arg < 0)
45824574 arg_sign = -1;
45834575 break;
4584-# ifdef FEAT_NUM64
45854576 case 'L':
45864577 llong_arg =
4587-# if defined(FEAT_EVAL)
4578+# if defined(FEAT_EVAL)
45884579 tvs != NULL ? tv_nr(tvs, &arg_idx) :
4589-# endif
4580+# endif
45904581 va_arg(ap, varnumber_T);
45914582 if (llong_arg > 0)
45924583 arg_sign = 1;
45934584 else if (llong_arg < 0)
45944585 arg_sign = -1;
45954586 break;
4596-# endif
45974587 }
45984588 }
45994589 else
@@ -4622,18 +4612,16 @@
46224612 if (ulong_arg != 0)
46234613 arg_sign = 1;
46244614 break;
4625-# ifdef FEAT_NUM64
46264615 case 'L':
46274616 ullong_arg =
4628-# if defined(FEAT_EVAL)
4617+# if defined(FEAT_EVAL)
46294618 tvs != NULL ? (uvarnumber_T)
46304619 tv_nr(tvs, &arg_idx) :
4631-# endif
4620+# endif
46324621 va_arg(ap, uvarnumber_T);
46334622 if (ullong_arg != 0)
46344623 arg_sign = 1;
46354624 break;
4636-# endif
46374625 }
46384626 }
46394627
@@ -4687,17 +4675,13 @@
46874675 ;
46884676 else if (length_modifier == 'L')
46894677 {
4690-# ifdef FEAT_NUM64
4691-# ifdef MSWIN
4678+# ifdef MSWIN
46924679 f[f_l++] = 'I';
46934680 f[f_l++] = '6';
46944681 f[f_l++] = '4';
4695-# else
4682+# else
46964683 f[f_l++] = 'l';
46974684 f[f_l++] = 'l';
4698-# endif
4699-# else
4700- f[f_l++] = 'l';
47014685 # endif
47024686 }
47034687 else
@@ -4735,11 +4719,9 @@
47354719 case 'l': str_arg_l += sprintf(
47364720 tmp + str_arg_l, f, long_arg);
47374721 break;
4738-# ifdef FEAT_NUM64
47394722 case 'L': str_arg_l += sprintf(
47404723 tmp + str_arg_l, f, llong_arg);
47414724 break;
4742-# endif
47434725 }
47444726 }
47454727 else
@@ -4754,11 +4736,9 @@
47544736 case 'l': str_arg_l += sprintf(
47554737 tmp + str_arg_l, f, ulong_arg);
47564738 break;
4757-# ifdef FEAT_NUM64
47584739 case 'L': str_arg_l += sprintf(
47594740 tmp + str_arg_l, f, ullong_arg);
47604741 break;
4761-# endif
47624742 }
47634743 }
47644744
diff -r 23bd41ec57fb -r fdfe44ac6a1a src/structs.h
--- a/src/structs.h Mon Feb 17 21:45:05 2020 +0100
+++ b/src/structs.h Mon Feb 17 22:15:07 2020 +0100
@@ -1245,42 +1245,33 @@
12451245 typedef long_u hash_T; // Type for hi_hash
12461246
12471247
1248-#ifdef FEAT_NUM64
12491248 // Use 64-bit Number.
1250-# ifdef MSWIN
1251-# ifdef PROTO
1252-typedef long varnumber_T;
1253-typedef unsigned long uvarnumber_T;
1254-# define VARNUM_MIN LONG_MIN
1255-# define VARNUM_MAX LONG_MAX
1256-# define UVARNUM_MAX ULONG_MAX
1257-# else
1258-typedef __int64 varnumber_T;
1259-typedef unsigned __int64 uvarnumber_T;
1260-# define VARNUM_MIN _I64_MIN
1261-# define VARNUM_MAX _I64_MAX
1262-# define UVARNUM_MAX _UI64_MAX
1263-# endif
1264-# elif defined(HAVE_STDINT_H)
1265-typedef int64_t varnumber_T;
1266-typedef uint64_t uvarnumber_T;
1267-# define VARNUM_MIN INT64_MIN
1268-# define VARNUM_MAX INT64_MAX
1269-# define UVARNUM_MAX UINT64_MAX
1270-# else
1249+#ifdef MSWIN
1250+# ifdef PROTO
12711251 typedef long varnumber_T;
12721252 typedef unsigned long uvarnumber_T;
12731253 # define VARNUM_MIN LONG_MIN
12741254 # define VARNUM_MAX LONG_MAX
12751255 # define UVARNUM_MAX ULONG_MAX
1256+# else
1257+typedef __int64 varnumber_T;
1258+typedef unsigned __int64 uvarnumber_T;
1259+# define VARNUM_MIN _I64_MIN
1260+# define VARNUM_MAX _I64_MAX
1261+# define UVARNUM_MAX _UI64_MAX
12761262 # endif
1263+#elif defined(HAVE_STDINT_H)
1264+typedef int64_t varnumber_T;
1265+typedef uint64_t uvarnumber_T;
1266+# define VARNUM_MIN INT64_MIN
1267+# define VARNUM_MAX INT64_MAX
1268+# define UVARNUM_MAX UINT64_MAX
12771269 #else
1278-// Use 32-bit Number.
1279-typedef int varnumber_T;
1280-typedef unsigned int uvarnumber_T;
1281-# define VARNUM_MIN INT_MIN
1282-# define VARNUM_MAX INT_MAX
1283-# define UVARNUM_MAX UINT_MAX
1270+typedef long varnumber_T;
1271+typedef unsigned long uvarnumber_T;
1272+# define VARNUM_MIN LONG_MIN
1273+# define VARNUM_MAX LONG_MAX
1274+# define UVARNUM_MAX ULONG_MAX
12841275 #endif
12851276
12861277 typedef double float_T;
diff -r 23bd41ec57fb -r fdfe44ac6a1a src/testdir/test_expr.vim
--- a/src/testdir/test_expr.vim Mon Feb 17 21:45:05 2020 +0100
+++ b/src/testdir/test_expr.vim Mon Feb 17 22:15:07 2020 +0100
@@ -382,9 +382,7 @@
382382 endfunc
383383
384384 function Test_printf_64bit()
385- if has('num64')
386- call assert_equal("123456789012345", printf('%d', 123456789012345))
387- endif
385+ call assert_equal("123456789012345", printf('%d', 123456789012345))
388386 endfunc
389387
390388 function Test_printf_spec_s()
@@ -423,12 +421,8 @@
423421 call assert_equal(" 0b1111011", printf('%#10b', 123))
424422 call assert_equal("0B01111011", printf('%#010B', 123))
425423 call assert_equal("1001001100101100000001011010010", printf('%b', 1234567890))
426- if has('num64')
427- call assert_equal("11100000100100010000110000011011101111101111001", printf('%b', 123456789012345))
428- call assert_equal("1111111111111111111111111111111111111111111111111111111111111111", printf('%b', -1))
429- else
430- call assert_equal("11111111111111111111111111111111", printf('%b', -1))
431- endif
424+ call assert_equal("11100000100100010000110000011011101111101111001", printf('%b', 123456789012345))
425+ call assert_equal("1111111111111111111111111111111111111111111111111111111111111111", printf('%b', -1))
432426 endfunc
433427
434428 func Test_substitute_expr()
diff -r 23bd41ec57fb -r fdfe44ac6a1a src/testdir/test_largefile.vim
--- a/src/testdir/test_largefile.vim Mon Feb 17 21:45:05 2020 +0100
+++ b/src/testdir/test_largefile.vim Mon Feb 17 22:15:07 2020 +0100
@@ -24,11 +24,6 @@
2424 w
2525 " Check if the file size is 4,000,000,000 bytes.
2626 let fsize=getfsize(fname)
27- if has('num64')
28- call assert_true(fsize == 4000000000)
29- else
30- " getfsize() returns -2 if a Number is 32 bits.
31- call assert_true(fsize == -2)
32- endif
27+ call assert_true(fsize == 4000000000)
3328 call delete(fname)
3429 endfunc
diff -r 23bd41ec57fb -r fdfe44ac6a1a src/testdir/test_sort.vim
--- a/src/testdir/test_sort.vim Mon Feb 17 21:45:05 2020 +0100
+++ b/src/testdir/test_sort.vim Mon Feb 17 22:15:07 2020 +0100
@@ -1295,9 +1295,8 @@
12951295 \ '2147483647'], getline(1, '$'))
12961296 bwipe!
12971297
1298- if has('num64')
1299- new
1300- a
1298+ new
1299+ a
13011300 -9223372036854775808
13021301 -9223372036854775807
13031302
@@ -1312,22 +1311,21 @@
13121311 abc
13131312
13141313 .
1315- sort n
1316- call assert_equal(['',
1317- \ 'abc',
1318- \ '',
1319- \ '-9223372036854775808',
1320- \ '-9223372036854775808',
1321- \ '-9223372036854775807',
1322- \ '-9223372036854775806',
1323- \ '-1',
1324- \ '0',
1325- \ '1',
1326- \ '9223372036854775806',
1327- \ '9223372036854775807',
1328- \ '9223372036854775807'], getline(1, '$'))
1329- bwipe!
1330- endif
1314+ sort n
1315+ call assert_equal(['',
1316+ \ 'abc',
1317+ \ '',
1318+ \ '-9223372036854775808',
1319+ \ '-9223372036854775808',
1320+ \ '-9223372036854775807',
1321+ \ '-9223372036854775806',
1322+ \ '-1',
1323+ \ '0',
1324+ \ '1',
1325+ \ '9223372036854775806',
1326+ \ '9223372036854775807',
1327+ \ '9223372036854775807'], getline(1, '$'))
1328+ bwipe!
13311329 endfunc
13321330
13331331
diff -r 23bd41ec57fb -r fdfe44ac6a1a src/testdir/test_vimscript.vim
--- a/src/testdir/test_vimscript.vim Mon Feb 17 21:45:05 2020 +0100
+++ b/src/testdir/test_vimscript.vim Mon Feb 17 22:15:07 2020 +0100
@@ -1416,10 +1416,6 @@
14161416 "-------------------------------------------------------------------------------
14171417
14181418 func Test_num64()
1419- if !has('num64')
1420- return
1421- endif
1422-
14231419 call assert_notequal( 4294967296, 0)
14241420 call assert_notequal(-4294967296, 0)
14251421 call assert_equal( 4294967296, 0xFFFFffff + 1)
@@ -1692,27 +1688,15 @@
16921688 " Test special cases: division or modulus with 0.
16931689 let x = 1
16941690 let x /= 0
1695- if has('num64')
1696- call assert_equal(0x7FFFFFFFFFFFFFFF, x)
1697- else
1698- call assert_equal(0x7fffffff, x)
1699- endif
1691+ call assert_equal(0x7FFFFFFFFFFFFFFF, x)
17001692
17011693 let x = -1
17021694 let x /= 0
1703- if has('num64')
1704- call assert_equal(-0x7FFFFFFFFFFFFFFF, x)
1705- else
1706- call assert_equal(-0x7fffffff, x)
1707- endif
1695+ call assert_equal(-0x7FFFFFFFFFFFFFFF, x)
17081696
17091697 let x = 0
17101698 let x /= 0
1711- if has('num64')
1712- call assert_equal(-0x7FFFFFFFFFFFFFFF - 1, x)
1713- else
1714- call assert_equal(-0x7FFFFFFF - 1, x)
1715- endif
1699+ call assert_equal(-0x7FFFFFFFFFFFFFFF - 1, x)
17161700
17171701 let x = 1
17181702 let x %= 0
diff -r 23bd41ec57fb -r fdfe44ac6a1a src/version.c
--- a/src/version.c Mon Feb 17 21:45:05 2020 +0100
+++ b/src/version.c Mon Feb 17 22:15:07 2020 +0100
@@ -436,11 +436,7 @@
436436 #else
437437 "-netbeans_intg",
438438 #endif
439-#ifdef FEAT_NUM64
440439 "+num64",
441-#else
442- "-num64",
443-#endif
444440 #ifdef FEAT_GUI_MSWIN
445441 # ifdef FEAT_OLE
446442 "+ole",
@@ -743,6 +739,8 @@
743739 static int included_patches[] =
744740 { /* Add new patch number below this line */
745741 /**/
742+ 271,
743+/**/
746744 270,
747745 /**/
748746 269,
Show on old repository browser