Patch 8.2.3573
Problem: Cannot decide whether to skip test that fails with 64 bit ints.
(closes #9072)
Solution: Add v:sizeofint, v:sizeoflong and v:sizeofpointer. Improve the
check for multiply overflow.
Files: runtime/doc/eval.txt, src/vim.h, src/evalvars.c, src/register.c,
src/testdir/test_put.vim
*** ../vim-8.2.3572/runtime/doc/eval.txt 2021-10-24 20:34:01.426895140
+0100
--- runtime/doc/eval.txt 2021-11-02 21:27:43.951976995 +0000
***************
*** 2133,2139 ****
v:numbermax Maximum value of a number.
*v:numbermin* *numbermin-variable*
! v:numbermin Minimum value of a number (negative)
*v:numbersize* *numbersize-variable*
v:numbersize Number of bits in a Number. This is normally 64, but on some
--- 2150,2156 ----
v:numbermax Maximum value of a number.
*v:numbermin* *numbermin-variable*
! v:numbermin Minimum value of a number (negative).
*v:numbersize* *numbersize-variable*
v:numbersize Number of bits in a Number. This is normally 64, but on some
***************
*** 2273,2278 ****
--- 2290,2310 ----
< "shell_error" also works, for backwards compatibility, unless
|scriptversion| is 3 or higher.
+ *v:sizeofint* *sizeofint-variable*
+ v:sizeofint Number of bytes in an int. Depends on how Vim was compiled.
+ This is only useful for deciding whether a test will give the
+ expected result.
+
+ *v:sizeoflong* *sizeoflong-variable*
+ v:sizeoflong Number of bytes in a long. Depends on how Vim was compiled.
+ This is only useful for deciding whether a test will give the
+ expected result.
+
+ *v:sizeofpointer* *sizeofpointer-variable*
+ v:sizeofpointer Number of bytes in a pointer. Depends on how Vim was
compiled.
+ This is only useful for deciding whether a test will give the
+ expected result.
+
*v:statusmsg* *statusmsg-variable*
v:statusmsg Last given status message. It's allowed to set this variable.
*** ../vim-8.2.3572/src/vim.h 2021-10-28 20:49:02.639759677 +0100
--- src/vim.h 2021-11-02 21:11:13.836226978 +0000
***************
*** 2060,2066 ****
#define VV_COLLATE 97
#define VV_EXITING 98
#define VV_COLORNAMES 99
! #define VV_LEN 100 // number of v: vars
// used for v_number in VAR_BOOL and VAR_SPECIAL
#define VVAL_FALSE 0L // VAR_BOOL
--- 2060,2069 ----
#define VV_COLLATE 97
#define VV_EXITING 98
#define VV_COLORNAMES 99
! #define VV_SIZEOFINT 100
! #define VV_SIZEOFLONG 101
! #define VV_SIZEOFPOINTER 102
! #define VV_LEN 103 // number of v: vars
// used for v_number in VAR_BOOL and VAR_SPECIAL
#define VVAL_FALSE 0L // VAR_BOOL
*** ../vim-8.2.3572/src/evalvars.c 2021-10-24 20:34:01.430895189 +0100
--- src/evalvars.c 2021-11-02 21:12:49.121348089 +0000
***************
*** 150,155 ****
--- 150,158 ----
{VV_NAME("collate", VAR_STRING), VV_RO},
{VV_NAME("exiting", VAR_SPECIAL), VV_RO},
{VV_NAME("colornames", VAR_DICT), VV_RO},
+ {VV_NAME("sizeofint", VAR_NUMBER), VV_RO},
+ {VV_NAME("sizeoflong", VAR_NUMBER), VV_RO},
+ {VV_NAME("sizeofpointer", VAR_NUMBER), VV_RO},
};
// shorthand
***************
*** 234,239 ****
--- 237,245 ----
set_vim_var_nr(VV_NUMBERMAX, VARNUM_MAX);
set_vim_var_nr(VV_NUMBERMIN, VARNUM_MIN);
set_vim_var_nr(VV_NUMBERSIZE, sizeof(varnumber_T) * 8);
+ set_vim_var_nr(VV_SIZEOFINT, sizeof(int));
+ set_vim_var_nr(VV_SIZEOFLONG, sizeof(long));
+ set_vim_var_nr(VV_SIZEOFPOINTER, sizeof(char *));
set_vim_var_nr(VV_TYPE_NUMBER, VAR_TYPE_NUMBER);
set_vim_var_nr(VV_TYPE_STRING, VAR_TYPE_STRING);
*** ../vim-8.2.3572/src/register.c 2021-10-19 20:08:41.455362440 +0100
--- src/register.c 2021-11-02 21:29:23.929170187 +0000
***************
*** 2014,2020 ****
long multlen = count * yanklen;
totlen = multlen;
! if (totlen != multlen)
{
emsg(_(e_resulting_text_too_long));
break;
--- 2014,2021 ----
long multlen = count * yanklen;
totlen = multlen;
! if (totlen != multlen || totlen / count != yanklen
! || totlen / yanklen != count)
{
emsg(_(e_resulting_text_too_long));
break;
*** ../vim-8.2.3572/src/testdir/test_put.vim 2021-11-01 22:58:39.561553087
+0000
--- src/testdir/test_put.vim 2021-11-02 21:22:35.808303959 +0000
***************
*** 149,161 ****
endfunc
func Test_very_large_count()
- " FIXME: should actually check if sizeof(int) == sizeof(long)
- CheckNotMSWindows
-
- if v:numbersize != 64
- throw 'Skipped: only works with 64 bit numbers'
- endif
-
new
let @" = 'x'
call assert_fails('norm 44444444444444p', 'E1240:')
--- 149,154 ----
*** ../vim-8.2.3572/src/version.c 2021-11-02 20:56:04.189640051 +0000
--- src/version.c 2021-11-02 21:15:32.039272016 +0000
***************
*** 759,760 ****
--- 759,762 ----
{ /* Add new patch number below this line */
+ /**/
+ 3573,
/**/
--
Facepalm statement #6: "Estland is a fantasy place, just like Middle Earth and
Madagaskar"
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ 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/20211102214023.5DCEEC80053%40moolenaar.net.